commit d8b0f45e5f167f23a2554dc425141d9a7bee17b7
parent 5895c17f8579d3e3da4566e4e9bfc416e3ab52dc
Author: Hans Petter Selasky <hps@selasky.org>
Date: Sat, 4 Apr 2020 11:52:20 +0200
Correctly check if filtercutoff_relfreq is set by implementing isSet()
function in smooth_float class.
Signed-off-by: Hans Petter Selasky <hps@selasky.org>
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/Synth/SynthNote.cpp b/src/Synth/SynthNote.cpp
@@ -184,12 +184,10 @@ void SynthNote::setFilterCutoff(float value)
float SynthNote::getFilterCutoffRelFreq(void)
{
- const float value = filtercutoff_relfreq;
-
- if (value == 0.0f)
+ if (filtercutoff_relfreq.isSet() == false)
return (ctl.filtercutoff.relfreq);
else
- return (value);
+ return (filtercutoff_relfreq);
}
float SynthNote::getRandomFloat() {
diff --git a/src/globals.h b/src/globals.h
@@ -374,6 +374,9 @@ public:
init = true;
}
};
+ bool isSet() const {
+ return (init);
+ };
};
}