Bug2583 residual: Re-placement of cutlines when generating sound
This commit is contained in:
parent
0fcf9ffb52
commit
197ebc2994
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
|
#include "TimeWarper.h"
|
||||||
|
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
@ -1874,28 +1875,14 @@ bool Effect::ProcessTrack(int count,
|
||||||
{
|
{
|
||||||
auto pProject = FindProject();
|
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
|
// Transfer the data from the temporary tracks to the actual ones
|
||||||
genLeft->Flush();
|
genLeft->Flush();
|
||||||
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
||||||
auto &selectedRegion = ViewInfo::Get( *pProject ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( *pProject ).selectedRegion;
|
||||||
left->ClearAndPaste(mT0,
|
auto t1 = selectedRegion.t1();
|
||||||
selectedRegion.t1(), genLeft.get(), true, true,
|
PasteTimeWarper warper{ t1, mT0 + genLeft->GetEndTime() };
|
||||||
nullptr /* &warper */);
|
left->ClearAndPaste(mT0, t1, genLeft.get(), true, true,
|
||||||
|
&warper);
|
||||||
|
|
||||||
if (genRight)
|
if (genRight)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,8 +75,7 @@ bool Generator::Process()
|
||||||
else {
|
else {
|
||||||
// Transfer the data from the temporary track to the actual one
|
// Transfer the data from the temporary track to the actual one
|
||||||
tmp->Flush();
|
tmp->Flush();
|
||||||
StepTimeWarper warper{
|
PasteTimeWarper warper{ mT1, mT0+GetDuration() };
|
||||||
mT0+GetDuration(), GetDuration()-(mT1-mT0) };
|
|
||||||
const auto &selectedRegion =
|
const auto &selectedRegion =
|
||||||
ViewInfo::Get( *pProject ).selectedRegion;
|
ViewInfo::Get( *pProject ).selectedRegion;
|
||||||
track->ClearAndPaste(
|
track->ClearAndPaste(
|
||||||
|
|
|
@ -138,15 +138,6 @@ GeometricOutputTimeWarper::GeometricOutputTimeWarper(double tStart, double tEnd,
|
||||||
wxASSERT(tStart < 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)
|
PasteTimeWarper::PasteTimeWarper(double oldT1, double newT1)
|
||||||
: mOldT1{ oldT1 }, mNewT1{ newT1 }
|
: mOldT1{ oldT1 }, mNewT1{ newT1 }
|
||||||
{ }
|
{ }
|
||||||
|
|
|
@ -43,9 +43,6 @@ split points in the input.
|
||||||
\class GeometricOutputRateTimeWarper
|
\class GeometricOutputRateTimeWarper
|
||||||
\brief TimeScale - rate varies geometrically with output
|
\brief TimeScale - rate varies geometrically with output
|
||||||
|
|
||||||
\class StepTimeWarper
|
|
||||||
\brief Unit slope but with a jump
|
|
||||||
|
|
||||||
\class PasteTimeWarper
|
\class PasteTimeWarper
|
||||||
\brief Unit slope but with either a jump (pasting more) or a flat interval (pasting less)
|
\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;
|
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
|
class PasteTimeWarper final : public TimeWarper
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue