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 7795202891079b0eda2e905d9d25035451e2f130
parent d377d5cece6c9d32b96129fcf443affaa26d8d92
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 30 May 2024 22:32:55 +0200

do not set parameter as unlocked if one region is unlocked but other regions are still locking it

Diffstat:
Msource/jucePluginLib/parameterlocking.cpp | 12+++++++-----
Msource/jucePluginLib/parameterlocking.h | 2+-
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/source/jucePluginLib/parameterlocking.cpp b/source/jucePluginLib/parameterlocking.cpp @@ -116,18 +116,20 @@ namespace pluginLib return false; } - void ParameterLocking::setParametersLocked(const ParameterRegion& _parameterRegion, bool _locked) + void ParameterLocking::setParametersLocked(const ParameterRegion& _parameterRegion, const bool _locked) const { for (const auto& param : _parameterRegion.getParams()) { + // if a region is unlocked but other regions still lock the same parameter, do nothing + if(!_locked && isParameterLocked(param.first)) + continue; + const auto idx = m_controller.getParameterIndexByName(param.first); for(uint8_t part=0; part<16; ++part) { - auto* param = m_controller.getParameter(idx, part); - - if(param) - param->setLocked(_locked); + if(auto* p = m_controller.getParameter(idx, part)) + p->setLocked(_locked); } } } diff --git a/source/jucePluginLib/parameterlocking.h b/source/jucePluginLib/parameterlocking.h @@ -25,7 +25,7 @@ namespace pluginLib bool isParameterLocked(const std::string& _name) const; private: - void setParametersLocked(const ParameterRegion& _parameterRegion, bool _locked); + void setParametersLocked(const ParameterRegion& _parameterRegion, bool _locked) const; Controller& m_controller;