1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Bug 208 - Some effects (including equalization effects) delete Envelope Control Points, or do not move them when timeline change

This commit is contained in:
Leland Lucius 2020-08-08 19:40:02 -05:00
parent f09f03e44b
commit c13a074cb2

View File

@ -736,6 +736,7 @@ void WaveTrack::ClearAndPaste(double t0, // Start of time to clear
return;
}
std::vector<EnvPoint> envPoints;
std::vector<double> splits;
WaveClipHolders cuts;
@ -783,6 +784,12 @@ void WaveTrack::ClearAndPaste(double t0, // Start of time to clear
else
++it;
}
// Save the envelope points
const auto &env = *clip->GetEnvelope();
for (size_t i = 0, numPoints = env.GetNumberOfPoints(); i < numPoints; ++i) {
envPoints.push_back(env[i]);
}
}
const auto tolerance = 2.0 / GetRate();
@ -790,7 +797,6 @@ void WaveTrack::ClearAndPaste(double t0, // Start of time to clear
// Now, clear the selection
HandleClear(t0, t1, false, false);
{
// And paste in the NEW data
Paste(t0, src);
{
@ -878,6 +884,13 @@ void WaveTrack::ClearAndPaste(double t0, // Start of time to clear
}
}
}
// Restore the envelope points
for (auto point : envPoints) {
auto t = warper->Warp(point.GetT());
WaveClip *clip = GetClipAtTime(t);
clip->GetEnvelope()->Insert(t, point.GetVal());
}
}
}