diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index dfdab8045..176920653 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -17,6 +17,7 @@ #include "../Audacity.h" #include "Effect.h" +#include "TimeWarper.h" #include "../Experimental.h" @@ -1874,28 +1875,14 @@ bool Effect::ProcessTrack(int count, { auto pProject = FindProject(); - // PRL: this code was here and could not have been the right - // intent, mixing time and sampleCount values: - // StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0)); - - // This looks like what it should have been: - // StepTimeWarper warper(mT0 + genDur, genDur - (mT1 - mT0)); - // But rather than fix it, I will just disable the use of it for now. - // The purpose was to remap split lines inside the selected region when - // a generator replaces it with sound of different duration. But - // the "correct" version might have the effect of mapping some splits too - // far left, to before the selection. - // In practice the wrong version probably did nothing most of the time, - // because the cutoff time for the step time warper was 44100 times too - // far from mT0. - // Transfer the data from the temporary tracks to the actual ones genLeft->Flush(); // mT1 gives us the NEW selection. We want to replace up to GetSel1(). auto &selectedRegion = ViewInfo::Get( *pProject ).selectedRegion; - left->ClearAndPaste(mT0, - selectedRegion.t1(), genLeft.get(), true, true, - nullptr /* &warper */); + auto t1 = selectedRegion.t1(); + PasteTimeWarper warper{ t1, mT0 + genLeft->GetEndTime() }; + left->ClearAndPaste(mT0, t1, genLeft.get(), true, true, + &warper); if (genRight) { diff --git a/src/effects/Generator.cpp b/src/effects/Generator.cpp index 680d35367..1889dac9c 100644 --- a/src/effects/Generator.cpp +++ b/src/effects/Generator.cpp @@ -75,8 +75,7 @@ bool Generator::Process() else { // Transfer the data from the temporary track to the actual one tmp->Flush(); - StepTimeWarper warper{ - mT0+GetDuration(), GetDuration()-(mT1-mT0) }; + PasteTimeWarper warper{ mT1, mT0+GetDuration() }; const auto &selectedRegion = ViewInfo::Get( *pProject ).selectedRegion; track->ClearAndPaste( diff --git a/src/effects/TimeWarper.cpp b/src/effects/TimeWarper.cpp index 808f7b16f..aa07b58ef 100644 --- a/src/effects/TimeWarper.cpp +++ b/src/effects/TimeWarper.cpp @@ -138,15 +138,6 @@ GeometricOutputTimeWarper::GeometricOutputTimeWarper(double tStart, double tEnd, wxASSERT(tStart < tEnd); } -StepTimeWarper::StepTimeWarper(double tStep, double offset) -: mTStep(tStep), mOffset(offset) -{ } - -double StepTimeWarper::Warp(double originalTime) const -{ - return originalTime + ((originalTime > mTStep) ? mOffset : 0.0); -} - PasteTimeWarper::PasteTimeWarper(double oldT1, double newT1) : mOldT1{ oldT1 }, mNewT1{ newT1 } { } diff --git a/src/effects/TimeWarper.h b/src/effects/TimeWarper.h index 1e0cecc6b..4a79bcd1d 100644 --- a/src/effects/TimeWarper.h +++ b/src/effects/TimeWarper.h @@ -43,9 +43,6 @@ split points in the input. \class GeometricOutputRateTimeWarper \brief TimeScale - rate varies geometrically with output -\class StepTimeWarper -\brief Unit slope but with a jump - \class PasteTimeWarper \brief Unit slope but with either a jump (pasting more) or a flat interval (pasting less) @@ -180,16 +177,6 @@ public: double Warp(double originalTime) const override; }; -class StepTimeWarper final : public TimeWarper -{ -private: - double mTStep; - double mOffset; -public: - StepTimeWarper(double tStep, double offset); - double Warp(double originalTime) const override; -}; - class PasteTimeWarper final : public TimeWarper { private: