gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 574bf0e1923403f8745684b8d1f43c00f9466948
parent a7314785d84d05ec7cf5a2a5ad91cab1b17d5ee4
Author: Tal Aviram <me@talaviram.com>
Date:   Tue, 24 Aug 2021 08:11:43 +0300

controller - parameter: add lambda support for adding code on value change.

Diffstat:
Msource/jucePlugin/VirusParameter.cpp | 2++
Msource/jucePlugin/VirusParameter.h | 4++++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/source/jucePlugin/VirusParameter.cpp b/source/jucePlugin/VirusParameter.cpp @@ -24,6 +24,8 @@ namespace Virus m_ctrl.constructMessage({static_cast<uint8_t>(m_desc.page), m_partNum, m_desc.index, value})); m_lastValue = value; } + if (onValueChanged) + onValueChanged(); } void Parameter::setValueFromSynth(int newValue, const bool notifyHost) diff --git a/source/jucePlugin/VirusParameter.h b/source/jucePlugin/VirusParameter.h @@ -64,6 +64,10 @@ namespace Virus return m_desc.textToValueFunction(text, m_desc); } + // allow 'injecting' additional code for specific parameter. + // eg. multi/single value change requires triggering more logic. + std::function<void()> onValueChanged = {}; + private: juce::String genId(const Description &d, int part); void valueChanged(juce::Value &) override;