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

Bug 1686 - Equalization effects ignore and remove any amplitude envelope

This commit is contained in:
Leland Lucius 2020-08-09 03:07:41 -05:00
parent 238bb952ef
commit 58adb94747

View File

@ -1373,6 +1373,8 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
output->Append((samplePtr)buffer.get(), floatSample, mM - 1); output->Append((samplePtr)buffer.get(), floatSample, mM - 1);
output->Flush(); output->Flush();
std::vector<EnvPoint> envPoints;
// now move the appropriate bit of the output back to the track // now move the appropriate bit of the output back to the track
// (this could be enhanced in the future to use the tails) // (this could be enhanced in the future to use the tails)
double offsetT0 = t->LongSamplesToTime(offset); double offsetT0 = t->LongSamplesToTime(offset);
@ -1412,7 +1414,14 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
//save them //save them
clipStartEndTimes.push_back(std::pair<double,double>(clipStartT,clipEndT)); clipStartEndTimes.push_back(std::pair<double,double>(clipStartT,clipEndT));
// 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]);
} }
}
//now go thru and replace the old clips with NEW //now go thru and replace the old clips with NEW
for(unsigned int i = 0; i < clipStartEndTimes.size(); i++) for(unsigned int i = 0; i < clipStartEndTimes.size(); i++)
{ {
@ -1429,6 +1438,12 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
clipRealStartEndTimes[i].second >= startT+lenT) ) clipRealStartEndTimes[i].second >= startT+lenT) )
t->Join(clipRealStartEndTimes[i].first,clipRealStartEndTimes[i].second); t->Join(clipRealStartEndTimes[i].first,clipRealStartEndTimes[i].second);
} }
// Restore the envelope points
for (auto point : envPoints) {
WaveClip *clip = t->GetClipAtTime(point.GetT());
clip->GetEnvelope()->Insert(point.GetT(), point.GetVal());
}
} }
return bLoopSuccess; return bLoopSuccess;