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 2c0dda8b46a0ff81fd803039f5b867d7173f8bdd
parent e8c5c87500f39f80250d7a824882f5b803268da7
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat,  8 Jun 2024 02:10:45 +0200

parameter link now is relative, not absolute

Diffstat:
Msource/jucePluginLib/parameterlink.cpp | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/source/jucePluginLib/parameterlink.cpp b/source/jucePluginLib/parameterlink.cpp @@ -49,19 +49,22 @@ namespace pluginLib void ParameterLink::onSourceValueChanged() { - const auto newValue = m_source->getUnnormalizedValue(); + const auto newSourceValue = m_source->getUnnormalizedValue(); - if(newValue == m_sourceValue) + if(newSourceValue == m_sourceValue) return; - m_sourceValue = newValue; + const auto sourceDiff = newSourceValue - m_sourceValue; + + m_sourceValue = newSourceValue; const auto origin = m_source->getChangeOrigin(); for (auto* p : m_targets) { - const auto v = p->getDescription().range.clipValue(newValue); - p->setUnnormalizedValue(v, origin); + const auto newTargetValue = p->getUnnormalizedValue() + sourceDiff; + const auto clampedTargetValue = p->getDescription().range.clipValue(newTargetValue); + p->setUnnormalizedValue(clampedTargetValue, origin); } } }