Honor the base gain and volume before modifiers

This commit is contained in:
Paul Ferrand 2020-08-09 23:17:31 +02:00
parent 1b5a841d97
commit 9b11530331

View file

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