commit d8c68657434b348f771a5fd1fb3cb73c705689c7
parent abe6f2be6d4816384ec3ce5eff2020ea16a73a14
Author: Matt Demanett <matt@demanett.net>
Date: Mon, 10 Aug 2020 22:43:12 -0400
LVCF: fix mode lights when module is inactive.
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/LVCF.cpp b/src/LVCF.cpp
@@ -99,8 +99,12 @@ void LVCF::removeChannel(int c) {
_engines[c] = NULL;
}
+MultimodeFilter::Mode LVCF::modeParamValue() {
+ return (MultimodeFilter::Mode)(1 + clamp((int)params[MODE_PARAM].getValue(), 0, 4));
+}
+
void LVCF::modulate() {
- MultimodeFilter::Mode mode = (MultimodeFilter::Mode)(1 + clamp((int)params[MODE_PARAM].getValue(), 0, 4));
+ MultimodeFilter::Mode mode = modeParamValue();
if (_mode != mode || _poles != _polesSetting) {
_mode = mode;
_poles = _polesSetting;
@@ -136,10 +140,11 @@ void LVCF::modulateChannel(int c) {
}
void LVCF::processAlways(const ProcessArgs& args) {
- lights[LOWPASS_LIGHT].value = _mode == MultimodeFilter::LOWPASS_MODE;
- lights[HIGHPASS_LIGHT].value = _mode == MultimodeFilter::HIGHPASS_MODE;
- lights[BANDPASS_LIGHT].value = _mode == MultimodeFilter::BANDPASS_MODE;
- lights[BANDREJECT_LIGHT].value = _mode == MultimodeFilter::BANDREJECT_MODE;
+ MultimodeFilter::Mode mode = modeParamValue();
+ lights[LOWPASS_LIGHT].value = mode == MultimodeFilter::LOWPASS_MODE;
+ lights[HIGHPASS_LIGHT].value = mode == MultimodeFilter::HIGHPASS_MODE;
+ lights[BANDPASS_LIGHT].value = mode == MultimodeFilter::BANDPASS_MODE;
+ lights[BANDREJECT_LIGHT].value = mode == MultimodeFilter::BANDREJECT_MODE;
}
void LVCF::processAll(const ProcessArgs& args) {
diff --git a/src/LVCF.hpp b/src/LVCF.hpp
@@ -83,6 +83,7 @@ struct LVCF : BGModule {
int channels() override;
void addChannel(int c) override;
void removeChannel(int c) override;
+ MultimodeFilter::Mode modeParamValue();
void modulate() override;
void modulateChannel(int c) override;
void processAlways(const ProcessArgs& args) override;