Honor the base gain and volume before modifiers

This commit is contained in:
Paul Ferrand 2020-08-09 23:17:31 +02:00 committed by Jean Pierre Cimalando
parent 20bc1e93d0
commit a81149044a

View file

@ -360,12 +360,14 @@ void sfz::Voice::amplitudeEnvelope(absl::Span<float> modulationSpan) noexcept
egEnvelope.getBlock(modulationSpan);
// Amplitude envelope
applyGain1<float>(baseGain, modulationSpan);
if (float* mod = mm.getModulationByKey(amplitudeKey)) {
for (size_t i = 0; i < numSamples; ++i)
modulationSpan[i] *= normalizePercents(mod[i]);
}
// Volume envelope
applyGain1<float>(db2mag(baseVolumedB), modulationSpan);
if (float* mod = mm.getModulationByKey(volumeKey)) {
for (size_t i = 0; i < numSamples; ++i)
modulationSpan[i] *= db2mag(mod[i]);