commit 2b9ec6878985c3a5ac438ad0ccdb454c86508c96
parent e76f8b2946b138031e45d8414118357be73a7436
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 11 Aug 2024 18:07:53 +0200
clicking on the Octave LED sets value to closest octave
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/source/nord/n2x/n2xJucePlugin/n2xOctLed.cpp b/source/nord/n2x/n2xJucePlugin/n2xOctLed.cpp
@@ -6,7 +6,6 @@ namespace n2xJucePlugin
{
OctLed::OctLed(Editor& _editor) : ParameterDrivenLed(_editor, "O2Pitch_LED", "O2Pitch")
{
- disableClick();
bind();
}
@@ -16,4 +15,14 @@ namespace n2xJucePlugin
const bool active = v / 12 * 12 == v;
return active;
}
+
+ void OctLed::onClick(pluginLib::Parameter* _targetParameter, bool _toggleState)
+ {
+ const auto v = _targetParameter->getUnnormalizedValue();
+ auto newV = v + 6;
+ newV /= 12;
+ newV *= 12;
+ if(newV != v)
+ _targetParameter->setUnnormalizedValueNotifyingHost(newV, pluginLib::Parameter::Origin::Ui);
+ }
}
diff --git a/source/nord/n2x/n2xJucePlugin/n2xOctLed.h b/source/nord/n2x/n2xJucePlugin/n2xOctLed.h
@@ -10,5 +10,6 @@ namespace n2xJucePlugin
explicit OctLed(Editor& _editor);
protected:
bool updateToggleState(const pluginLib::Parameter* _parameter) const override;
+ void onClick(pluginLib::Parameter* _targetParameter, bool _toggleState) override;
};
}