mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +02:00
Bug 1844 - Nyquist effects move subsequent envelope points by selection's length
Also renamed Envelop::Paste to Envelope::PasteEnvelope, since it was hard to find just its usages, given the many usages of WaveTrack::Paste.
This commit is contained in:
parent
511b810fdc
commit
0022e0c06c
@ -754,7 +754,7 @@ void Envelope::CollapseRegion( double t0, double t1, double sampleDur )
|
|||||||
// envelope point applies to the first sample, but the t=tracklen
|
// envelope point applies to the first sample, but the t=tracklen
|
||||||
// envelope point applies one-past the last actual sample.
|
// envelope point applies one-past the last actual sample.
|
||||||
// t0 should be in the domain of this; if not, it is trimmed.
|
// t0 should be in the domain of this; if not, it is trimmed.
|
||||||
void Envelope::Paste( double t0, const Envelope *e, double sampleDur )
|
void Envelope::PasteEnvelope( double t0, const Envelope *e, double sampleDur )
|
||||||
// NOFAIL-GUARANTEE
|
// NOFAIL-GUARANTEE
|
||||||
{
|
{
|
||||||
const bool wasEmpty = (this->mEnv.size() == 0);
|
const bool wasEmpty = (this->mEnv.size() == 0);
|
||||||
@ -774,7 +774,8 @@ void Envelope::Paste( double t0, const Envelope *e, double sampleDur )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make t0 relative and trim it to the domain of this
|
// Make t0 relative to the offset of the envelope we are pasting into,
|
||||||
|
// and trim it to the domain of this
|
||||||
t0 = std::min( mTrackLen, std::max( 0.0, t0 - mOffset ) );
|
t0 = std::min( mTrackLen, std::max( 0.0, t0 - mOffset ) );
|
||||||
|
|
||||||
// Adjust if the insertion point rounds off near a discontinuity in this
|
// Adjust if the insertion point rounds off near a discontinuity in this
|
||||||
@ -812,7 +813,13 @@ void Envelope::Paste( double t0, const Envelope *e, double sampleDur )
|
|||||||
for ( size_t index = insertAt, last = insertAt + otherSize;
|
for ( size_t index = insertAt, last = insertAt + otherSize;
|
||||||
index < last; ++index ) {
|
index < last; ++index ) {
|
||||||
auto &point = mEnv[ index ];
|
auto &point = mEnv[ index ];
|
||||||
point.SetT( point.GetT() + otherOffset + t0 );
|
// The mOffset of the envelope-pasted-from is irrelevant.
|
||||||
|
// The GetT() times in it are relative to its start.
|
||||||
|
// The new GetT() times are relative to the envelope-pasted-to start.
|
||||||
|
// We are pasting at t0 relative to the envelope-pasted-to start.
|
||||||
|
// Hence we adjust by just t0.
|
||||||
|
// Bug 1844 was that we also adjusted by the envelope-pasted-from offset.
|
||||||
|
point.SetT( point.GetT() + /*otherOffset +*/ t0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treat removable discontinuities
|
// Treat removable discontinuities
|
||||||
|
@ -131,7 +131,9 @@ public:
|
|||||||
// Envelope has no notion of rate and control point times are not quantized;
|
// Envelope has no notion of rate and control point times are not quantized;
|
||||||
// but a tolerance is needed in the Paste routine, and better to inform it
|
// but a tolerance is needed in the Paste routine, and better to inform it
|
||||||
// of an appropriate number, than use hidden arbitrary constants.
|
// of an appropriate number, than use hidden arbitrary constants.
|
||||||
void Paste(double t0, const Envelope *e, double sampleDur);
|
// The function is called 'PasteEnvelope' rather than 'Paste' to make it
|
||||||
|
// easier to find where it is used in source code.
|
||||||
|
void PasteEnvelope(double t0, const Envelope *e, double sampleDur);
|
||||||
|
|
||||||
void InsertSpace(double t0, double tlen);
|
void InsertSpace(double t0, double tlen);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void TimeTrack::Paste(double t, const Track * src)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
|
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
|
||||||
mEnvelope->Paste
|
mEnvelope->PasteEnvelope
|
||||||
(t, static_cast<const TimeTrack*>(src)->mEnvelope.get(), sampleTime);
|
(t, static_cast<const TimeTrack*>(src)->mEnvelope.get(), sampleTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1625,7 +1625,7 @@ void WaveClip::Paste(double t0, const WaveClip* other)
|
|||||||
// Assume NOFAIL-GUARANTEE in the remaining
|
// Assume NOFAIL-GUARANTEE in the remaining
|
||||||
MarkChanged();
|
MarkChanged();
|
||||||
auto sampleTime = 1.0 / GetRate();
|
auto sampleTime = 1.0 / GetRate();
|
||||||
mEnvelope->Paste
|
mEnvelope->PasteEnvelope
|
||||||
(s0.as_double()/mRate + mOffset, pastedClip->mEnvelope.get(), sampleTime);
|
(s0.as_double()/mRate + mOffset, pastedClip->mEnvelope.get(), sampleTime);
|
||||||
OffsetCutLines(t0, pastedClip->GetEndTime() - pastedClip->GetStartTime());
|
OffsetCutLines(t0, pastedClip->GetEndTime() - pastedClip->GetStartTime());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user