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 3bba8d8a2a35a382d2470b07f39a0f186ae47f68
parent f7d6010f63f739b786b6ebea317b54b4f5cb4d0a
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Wed, 31 Jul 2024 21:29:11 +0200

support custom "off" value for new toggle buttons + other toggle button fixes

Diffstat:
Msource/jucePluginLib/parameterbinding.cpp | 11+++++++++--
Msource/juceUiLib/uiObject.cpp | 3+++
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/source/jucePluginLib/parameterbinding.cpp b/source/jucePluginLib/parameterbinding.cpp @@ -195,16 +195,23 @@ namespace pluginLib const bool hasCustomValue = _control.getProperties().contains("parametervalue"); int paramValue = 1; + int paramValueOff = -1; if(hasCustomValue) - paramValue = _control.getProperties()["value"]; + paramValue = _control.getProperties()["parametervalue"]; + if(_control.getProperties().contains("parametervalueoff")) + paramValueOff = _control.getProperties()["parametervalueoff"]; - _control.onClick = [&_control, param, paramValue, hasCustomValue] + _control.onClick = [&_control, param, paramValue, hasCustomValue, paramValueOff] { const auto on = _control.getToggleState(); if(hasCustomValue) { if(on) param->setUnnormalizedValueNotifyingHost(paramValue, Parameter::Origin::Ui); + else if(paramValueOff != -1) + param->setUnnormalizedValueNotifyingHost(paramValueOff, Parameter::Origin::Ui); + else + _control.setToggleState(true, juce::dontSendNotification); } else { diff --git a/source/juceUiLib/uiObject.cpp b/source/juceUiLib/uiObject.cpp @@ -597,6 +597,9 @@ namespace genericUI auto value = getPropertyInt("value", -1); if(value != -1) _target.getProperties().set("parametervalue", value); + auto valueOff = getPropertyInt("valueOff", -1); + if(valueOff != -1) + _target.getProperties().set("parametervalueoff", valueOff); } _editor.getInterface().bindParameter(_target, index);