Fix bug 617 based on Steve's patch.
This commit is contained in:
parent
6af101f15d
commit
635243e86f
|
@ -51,6 +51,11 @@ EffectChangeTempo::EffectChangeTempo()
|
||||||
m_ToLength = 0.0;
|
m_ToLength = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double EffectChangeTempo::CalcPreviewInputLength(double previewLength)
|
||||||
|
{
|
||||||
|
return previewLength * (100.0 + m_PercentChange) / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
wxString EffectChangeTempo::GetEffectDescription() {
|
wxString EffectChangeTempo::GetEffectDescription() {
|
||||||
// Note: This is useful only after change amount has been set.
|
// Note: This is useful only after change amount has been set.
|
||||||
return wxString::Format(_("Applied effect: %s %.1f%%"),
|
return wxString::Format(_("Applied effect: %s %.1f%%"),
|
||||||
|
|
|
@ -59,6 +59,8 @@ class EffectChangeTempo : public EffectSoundTouch {
|
||||||
|
|
||||||
virtual bool CheckWhetherSkipEffect() { return (m_PercentChange == 0.0); }
|
virtual bool CheckWhetherSkipEffect() { return (m_PercentChange == 0.0); }
|
||||||
virtual bool Process();
|
virtual bool Process();
|
||||||
|
|
||||||
|
double CalcPreviewInputLength(double previewLength);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_PercentChange; // percent change to apply to tempo
|
double m_PercentChange; // percent change to apply to tempo
|
||||||
|
|
|
@ -403,6 +403,11 @@ long TrapLong(long x, long min, long max)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Effect::CalcPreviewInputLength(double previewLength)
|
||||||
|
{
|
||||||
|
return previewLength;
|
||||||
|
}
|
||||||
|
|
||||||
wxString Effect::GetPreviewName()
|
wxString Effect::GetPreviewName()
|
||||||
{
|
{
|
||||||
return _("Pre&view");
|
return _("Pre&view");
|
||||||
|
@ -417,12 +422,12 @@ void Effect::Preview()
|
||||||
// Mix a few seconds of audio from all of the tracks
|
// Mix a few seconds of audio from all of the tracks
|
||||||
double previewLen = 6.0;
|
double previewLen = 6.0;
|
||||||
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
|
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
|
||||||
|
|
||||||
WaveTrack *mixLeft = NULL;
|
WaveTrack *mixLeft = NULL;
|
||||||
WaveTrack *mixRight = NULL;
|
WaveTrack *mixRight = NULL;
|
||||||
double rate = mProjectRate;
|
double rate = mProjectRate;
|
||||||
double t0 = mT0;
|
double t0 = mT0;
|
||||||
double t1 = t0 + previewLen;
|
double t1 = t0 + CalcPreviewInputLength(previewLen);
|
||||||
|
|
||||||
if (t1 > mT1)
|
if (t1 > mT1)
|
||||||
t1 = mT1;
|
t1 = mT1;
|
||||||
|
@ -488,6 +493,8 @@ void Effect::Preview()
|
||||||
if (mixRight)
|
if (mixRight)
|
||||||
playbackTracks.Add(mixRight);
|
playbackTracks.Add(mixRight);
|
||||||
|
|
||||||
|
t1 = wxMin(mixLeft->GetEndTime(), t0 + previewLen);
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
NoteTrackArray empty;
|
NoteTrackArray empty;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -128,6 +128,10 @@ class AUDACITY_DLL_API Effect {
|
||||||
// Only override it if you need to do preprocessing or cleanup.
|
// Only override it if you need to do preprocessing or cleanup.
|
||||||
virtual void Preview();
|
virtual void Preview();
|
||||||
|
|
||||||
|
// Most effects just use the previewLength, but time-stretching/compressing
|
||||||
|
// effects need to use a different input length, so override this method.
|
||||||
|
virtual double CalcPreviewInputLength(double previewLength);
|
||||||
|
|
||||||
// Get an unique ID assigned to each registered effect.
|
// Get an unique ID assigned to each registered effect.
|
||||||
// The first effect will have ID zero.
|
// The first effect will have ID zero.
|
||||||
int GetID() {
|
int GetID() {
|
||||||
|
|
Loading…
Reference in New Issue