From 3a9fd31a0fe3295ff933ddb4537d1eef564e84d4 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Tue, 11 Feb 2020 09:33:16 +0100 Subject: [PATCH] The modulated gain is added to the base one --- src/sfizz/Voice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 636fd5ba..36496790 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -56,7 +56,7 @@ void sfz::Voice::startVoice(Region* region, int delay, int number, uint8_t value float gain { baseGain }; if (region->amplitudeCC) - gain *= normalizeCC(resources.midiState.getCCValue(region->amplitudeCC->first)) * normalizePercents(region->amplitudeCC->second); + gain += normalizeCC(resources.midiState.getCCValue(region->amplitudeCC->first)) * normalizePercents(region->amplitudeCC->second); amplitudeEnvelope.reset(Default::normalizedRange.clamp(gain)); float crossfadeGain { region->getCrossfadeGain(resources.midiState.getCCArray()) }; @@ -186,7 +186,7 @@ void sfz::Voice::registerCC(int delay, int ccNumber, uint8_t ccValue) noexcept delay = max(delay, minEnvelopeDelay); if (region->amplitudeCC && ccNumber == region->amplitudeCC->first) { - const float newGain { baseGain * normalizeCC(ccValue) * normalizePercents(region->amplitudeCC->second) }; + const float newGain { baseGain + normalizeCC(ccValue) * normalizePercents(region->amplitudeCC->second) }; amplitudeEnvelope.registerEvent(delay, Default::normalizedRange.clamp(newGain)); }