commit d4bcd004a6ff49bb195ee9152e82dcb97a875b28
parent 0110249ed22ad6d538d268b32f4cc9b75efd0816
Author: Ricard Wanderlof <polluxsynth@butoba.net>
Date: Mon, 21 Mar 2022 00:48:59 +0100
SVFilter.cpp: Avoid clicks when UI updates freq, Q or gain (#348)
In the setstages() method, only call cleanup() when needed,
i.e. when the number of stages is actually changed (same as
in AnalogFilter.cpp).
(The reason this is a problem is because setstages() is
called whenever the frequency, Q, filter tracking or gain
is changed in the UI).
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/DSP/SVFilter.cpp b/src/DSP/SVFilter.cpp
@@ -151,9 +151,11 @@ void SVFilter::setstages(int stages_)
{
if(stages_ >= MAX_FILTER_STAGES)
stages_ = MAX_FILTER_STAGES - 1;
- stages = stages_;
- cleanup();
- computefiltercoefs();
+ if (stages != stages_) {
+ stages = stages_;
+ cleanup();
+ computefiltercoefs();
+ }
}
float *SVFilter::getfilteroutfortype(SVFilter::fstage &x) {