commit fbf6ec00a674a16f7470b2d80967824610a91b54
parent 4237d18d735eb0176d71ae50cc3bf697290ad861
Author: Hans Petter Selasky <hps@selasky.org>
Date: Sun, 5 Apr 2020 02:37:26 +0200
Make sure the first call to SynthNote::setFilterCutoff() makes the relfreq
value start at the current controller value. Else there will be a sudden
jump in the parameter causing audio discontinuity.
Signed-off-by: Hans Petter Selasky <hps@selasky.org>
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/Synth/SynthNote.cpp b/src/Synth/SynthNote.cpp
@@ -176,6 +176,10 @@ void SynthNote::setPitch(float log2_freq_) {
void SynthNote::setFilterCutoff(float value)
{
+ /* set current value, if first time */
+ if (filtercutoff_relfreq.isSet() == false)
+ filtercutoff_relfreq = ctl.filtercutoff.relfreq;
+ /* update value */
filtercutoff_relfreq =
(value - 64.0f) * ctl.filtercutoff.depth / 4096.0f * 3.321928f;
}