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;
|
||||
}
|
||||
|
||||
double EffectChangeTempo::CalcPreviewInputLength(double previewLength)
|
||||
{
|
||||
return previewLength * (100.0 + m_PercentChange) / 100.0;
|
||||
}
|
||||
|
||||
wxString EffectChangeTempo::GetEffectDescription() {
|
||||
// Note: This is useful only after change amount has been set.
|
||||
return wxString::Format(_("Applied effect: %s %.1f%%"),
|
||||
|
|
|
@ -60,6 +60,8 @@ class EffectChangeTempo : public EffectSoundTouch {
|
|||
virtual bool CheckWhetherSkipEffect() { return (m_PercentChange == 0.0); }
|
||||
virtual bool Process();
|
||||
|
||||
double CalcPreviewInputLength(double previewLength);
|
||||
|
||||
private:
|
||||
double m_PercentChange; // percent change to apply to tempo
|
||||
// -100% is meaningless, but sky's the upper limit
|
||||
|
|
|
@ -403,6 +403,11 @@ long TrapLong(long x, long min, long max)
|
|||
return x;
|
||||
}
|
||||
|
||||
double Effect::CalcPreviewInputLength(double previewLength)
|
||||
{
|
||||
return previewLength;
|
||||
}
|
||||
|
||||
wxString Effect::GetPreviewName()
|
||||
{
|
||||
return _("Pre&view");
|
||||
|
@ -422,7 +427,7 @@ void Effect::Preview()
|
|||
WaveTrack *mixRight = NULL;
|
||||
double rate = mProjectRate;
|
||||
double t0 = mT0;
|
||||
double t1 = t0 + previewLen;
|
||||
double t1 = t0 + CalcPreviewInputLength(previewLen);
|
||||
|
||||
if (t1 > mT1)
|
||||
t1 = mT1;
|
||||
|
@ -488,6 +493,8 @@ void Effect::Preview()
|
|||
if (mixRight)
|
||||
playbackTracks.Add(mixRight);
|
||||
|
||||
t1 = wxMin(mixLeft->GetEndTime(), t0 + previewLen);
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
NoteTrackArray empty;
|
||||
#endif
|
||||
|
|
|
@ -128,6 +128,10 @@ class AUDACITY_DLL_API Effect {
|
|||
// Only override it if you need to do preprocessing or cleanup.
|
||||
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.
|
||||
// The first effect will have ID zero.
|
||||
int GetID() {
|
||||
|
|
Loading…
Reference in New Issue