diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 5e7184804..e7da0dbac 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -1373,6 +1373,8 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, output->Append((samplePtr)buffer.get(), floatSample, mM - 1); output->Flush(); + std::vector envPoints; + // now move the appropriate bit of the output back to the track // (this could be enhanced in the future to use the tails) double offsetT0 = t->LongSamplesToTime(offset); @@ -1412,7 +1414,14 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t, //save them clipStartEndTimes.push_back(std::pair(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 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) ) 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;