From de7d47a9f171fcb8ca76d682c23123168a517086 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 1 Apr 2021 02:47:40 +0200 Subject: [PATCH] Handle multiplicative depth modulations --- src/sfizz/modulations/ModMatrix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sfizz/modulations/ModMatrix.cpp b/src/sfizz/modulations/ModMatrix.cpp index 3d780ef4..7c64244f 100644 --- a/src/sfizz/modulations/ModMatrix.cpp +++ b/src/sfizz/modulations/ModMatrix.cpp @@ -423,7 +423,12 @@ float* ModMatrix::getModulation(TargetId targetId) for (uint32_t i = 0; i < numFrames; ++i) buffer[i] = sourceDepth * sourceBuffer[i]; } + else if (targetFlags & kModIsMultiplicative) { + for (uint32_t i = 0; i < numFrames; ++i) + buffer[i] = (sourceDepth * sourceDepthMod[i]) * sourceBuffer[i]; + } else { + ASSERT(targetFlags & kModIsAdditive); for (uint32_t i = 0; i < numFrames; ++i) buffer[i] = (sourceDepth + sourceDepthMod[i]) * sourceBuffer[i]; } @@ -435,7 +440,7 @@ float* ModMatrix::getModulation(TargetId targetId) multiplyMul1(sourceDepth, sourceBuffer, buffer); else { for (uint32_t i = 0; i < numFrames; ++i) - buffer[i] *= (sourceDepth + sourceDepthMod[i]) * sourceBuffer[i]; + buffer[i] *= (sourceDepth * sourceDepthMod[i]) * sourceBuffer[i]; } } else {