commit 7953b2ce50f579bd4c257d1f4d49da122e97cfb2 parent 248abc25366c8d7703ea4c815396c488b0cd1ca7 Author: dsp56300 <dsp56300@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:22:24 +0200 show active slots with only half brightness if they're not bound to first midi channel Diffstat:
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/source/nord/n2x/n2xJucePlugin/n2xParameterDrivenLed.cpp b/source/nord/n2x/n2xJucePlugin/n2xParameterDrivenLed.cpp @@ -28,6 +28,11 @@ namespace n2xJucePlugin }; } + void ParameterDrivenLed::updateState(juce::Button& _target, const pluginLib::Parameter* _source) const + { + _target.setToggleState(updateToggleState(_source), juce::dontSendNotification); + } + void ParameterDrivenLed::bind() { const auto& c = m_editor.getN2xController(); @@ -49,6 +54,6 @@ namespace n2xJucePlugin void ParameterDrivenLed::updateStateFromParameter(const pluginLib::Parameter* _parameter) const { - m_led->setToggleState(updateToggleState(_parameter), juce::dontSendNotification); + updateState(*m_led, _parameter); } } diff --git a/source/nord/n2x/n2xJucePlugin/n2xParameterDrivenLed.h b/source/nord/n2x/n2xJucePlugin/n2xParameterDrivenLed.h @@ -22,6 +22,7 @@ namespace n2xJucePlugin virtual ~ParameterDrivenLed() = default; protected: + virtual void updateState(juce::Button& _target, const pluginLib::Parameter* _source) const; virtual bool updateToggleState(const pluginLib::Parameter* _parameter) const = 0; virtual void onClick(pluginLib::Parameter* _targetParameter, bool _toggleState) {} diff --git a/source/nord/n2x/n2xJucePlugin/n2xPartLed.cpp b/source/nord/n2x/n2xJucePlugin/n2xPartLed.cpp @@ -19,6 +19,13 @@ namespace n2xJucePlugin disableClick(); } + void PartLed::updateState(juce::Button& _target, const pluginLib::Parameter* _source) const + { + ParameterDrivenLed::updateState(_target, _source); + const auto ch = _source->getUnnormalizedValue(); + _target.setAlpha(ch > 0 && ch <= 15 ? 0.5f : 1.0f); + } + bool PartLed::updateToggleState(const pluginLib::Parameter* _parameter) const { return _parameter->getUnnormalizedValue() <= 15; diff --git a/source/nord/n2x/n2xJucePlugin/n2xPartLed.h b/source/nord/n2x/n2xJucePlugin/n2xPartLed.h @@ -10,6 +10,7 @@ namespace n2xJucePlugin PartLed(Editor& _editor, uint8_t _slot); protected: + void updateState(juce::Button& _target, const pluginLib::Parameter* _source) const override; bool updateToggleState(const pluginLib::Parameter* _parameter) const override; private: