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 3377e370684ed010d5b38007bbd151252661e243
parent 4c9e7167a4c67d7861463937ea57e2a916a6f5ee
Author: Tal Aviram <me@talaviram.com>
Date:   Thu, 23 Sep 2021 23:00:28 +0300

controller - fix discrete parameters not transitive for defaults.

Diffstat:
Msource/jucePlugin/VirusParameter.h | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/source/jucePlugin/VirusParameter.h b/source/jucePlugin/VirusParameter.h @@ -65,8 +65,14 @@ namespace Virus { if (m_desc.textToValueFunction) return convertTo0to1(m_desc.textToValueFunction(text, m_desc)); - else - return convertTo0to1(text.getFloatValue()); + if (m_desc.valueToTextFunction) + { + // brute force but this should be O(1) of 128... + for (auto i = 0; i < 128; i++) + if (m_desc.valueToTextFunction(i, m_desc) == text) + return convertTo0to1(i); + } + return convertTo0to1(text.getFloatValue()); } juce::String getText(float normalisedValue, int /*maximumStringLength*/) const override