Browse Source

VST3 Client: Ensure that all programs can be selected via parameter in hosts

Hosts such as REAPER normalise the program parameter value by dividing
the program value by the step count, rather than going via the
parameter's toNormalized function. To be compatible, we should use the
same scaling technique. At time of writing, the coversion process is
detailed under the heading "Conversion of normalized values" on this
page:

https://developer.steinberg.help/display/VST/Parameters+and+Automation
v6.1.6
reuk 3 years ago
parent
commit
4c2dba0822
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp

+ 15
- 13
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -824,20 +824,17 @@ public:
bool setNormalized (Vst::ParamValue v) override
{
auto programValue = roundToInt (toPlain (v));
const auto programValue = getProgramValueFromNormalised (v);
if (isPositiveAndBelow (programValue, owner.getNumPrograms()))
{
if (programValue != owner.getCurrentProgram())
owner.setCurrentProgram (programValue);
if (programValue != owner.getCurrentProgram())
owner.setCurrentProgram (programValue);
if (valueNormalized != v)
{
valueNormalized = v;
changed();
if (valueNormalized != v)
{
valueNormalized = v;
changed();
return true;
}
return true;
}
return false;
@@ -870,8 +867,13 @@ public:
return String (CharPointer_UTF16 (reinterpret_cast<const CharPointer_UTF16::CharType*> (text)));
}
Vst::ParamValue toPlain (Vst::ParamValue v) const override { return v * (info.stepCount + 1); }
Vst::ParamValue toNormalized (Vst::ParamValue v) const override { return v / (info.stepCount + 1); }
Steinberg::int32 getProgramValueFromNormalised (Vst::ParamValue v) const
{
return jmin (info.stepCount, (Steinberg::int32) (v * (info.stepCount + 1)));
}
Vst::ParamValue toPlain (Vst::ParamValue v) const override { return getProgramValueFromNormalised (v); }
Vst::ParamValue toNormalized (Vst::ParamValue v) const override { return v / info.stepCount; }
private:
AudioProcessor& owner;


Loading…
Cancel
Save