mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
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 "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)
|
||||
{
|
||||
|
@ -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(
|
||||
|
@ -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 }
|
||||
{ }
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user