Bug2583 residual: Re-placement of cutlines when generating sound

This commit is contained in:
Paul Licameli 2021-01-25 12:06:24 -05:00
parent 0fcf9ffb52
commit 197ebc2994
4 changed files with 6 additions and 42 deletions

View File

@ -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)
{

View File

@ -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(

View File

@ -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 }
{ }

View File

@ -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: