mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Fix bug 617 based on Steve's patch.
This commit is contained in:
@@ -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%%"),
|
||||
|
@@ -59,6 +59,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
|
||||
|
@@ -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");
|
||||
@@ -417,12 +422,12 @@ void Effect::Preview()
|
||||
// Mix a few seconds of audio from all of the tracks
|
||||
double previewLen = 6.0;
|
||||
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
|
||||
|
||||
|
||||
WaveTrack *mixLeft = NULL;
|
||||
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() {
|
||||
|
Reference in New Issue
Block a user