From 32ce73fe33804786039e4e882a898049f646435b Mon Sep 17 00:00:00 2001 From: bsp2 Date: Wed, 5 Sep 2018 19:30:58 +0200 Subject: [PATCH] fix Alikins.SpecificValue module --- .../repos/Alikins/src/MsDisplayWidget.hpp | 2 + .../repos/Alikins/src/SpecificValue.cpp | 42 ++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/plugins/community/repos/Alikins/src/MsDisplayWidget.hpp b/plugins/community/repos/Alikins/src/MsDisplayWidget.hpp index 3932a86d..b1d503df 100644 --- a/plugins/community/repos/Alikins/src/MsDisplayWidget.hpp +++ b/plugins/community/repos/Alikins/src/MsDisplayWidget.hpp @@ -1,6 +1,7 @@ #include #include +namespace rack_plugin_Alikins { // From AS DelayPlus.cpp https://github.com/AScustomWorks/AS struct MsDisplayWidget : TransparentWidget { @@ -47,3 +48,4 @@ struct MsDisplayWidget : TransparentWidget { } }; +} // namespace rack_plugin_Alikins diff --git a/plugins/community/repos/Alikins/src/SpecificValue.cpp b/plugins/community/repos/Alikins/src/SpecificValue.cpp index 3aa82102..a3db16fa 100644 --- a/plugins/community/repos/Alikins/src/SpecificValue.cpp +++ b/plugins/community/repos/Alikins/src/SpecificValue.cpp @@ -20,7 +20,7 @@ struct SpecificValue : Module }; enum InputIds { - VALUE1_INPUT, + VALUE1_INPUT, NUM_INPUTS }; enum OutputIds @@ -431,7 +431,7 @@ SmallPurpleTrimpot::SmallPurpleTrimpot() : Trimpot() { } struct PurpleTrimpot : Trimpot { - Module *module; + Module *module; bool initialized = false; PurpleTrimpot(); void step() override; @@ -450,22 +450,34 @@ PurpleTrimpot::PurpleTrimpot() : Trimpot() { // over the trimpot, we kind of jitter arround. // maybe run this via an onChange()? void PurpleTrimpot::step() { - //debug("paramId=%d this->initialized: %d initialized: %d this->value: %f value: %f param.value: %f", + //debug("paramId=%d this->initialized: %d initialized: %d this->value: %f value: %f param.value: %f", // paramId, this->initialized, initialized, this->value, value, module->params[paramId].value); - if (this->value != module->params[paramId].value) { - if (this != RACK_PLUGIN_UI_HOVERED_WIDGET && this->initialized) { - // this->value = module->params[paramId].value; - setValue(module->params[paramId].value); - } else { - module->params[paramId].value = this->value; + if(module->inputs[SpecificValue::VALUE1_INPUT].active) + { + if (this->value != module->params[paramId].value) { + if (this != RACK_PLUGIN_UI_HOVERED_WIDGET && this->initialized) { + // // // this->value = module->params[paramId].value; + setValue(module->params[paramId].value); + } + else + { + module->params[paramId].value = this->value; this->initialized |= true; - } - EventChange e; - onChange(e); - } + EventChange e; + onChange(e); + } + } + } + else + { + module->params[paramId].value = this->value; + this->initialized |= true; + EventChange e; + onChange(e); + } - Trimpot::step(); + Trimpot::step(); } void PurpleTrimpot::reset() { @@ -627,7 +639,7 @@ void SpecificValueWidget::step() { prev_octave = module->params[SpecificValue::OCTAVE_PARAM].value; prev_input = module->params[SpecificValue::VALUE1_INPUT].value; EventChange e; - onChange(e); + onChange(e); } }