From 2bfa2ea16a7f22694b630a0d007e8438c2b07064 Mon Sep 17 00:00:00 2001 From: Patrick Desaulniers Date: Sun, 25 Feb 2018 00:09:33 -0500 Subject: [PATCH] Set VST parameter hints where useful --- distrho/src/DistrhoPluginVST.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp index 42b7f58e..8d69502c 100644 --- a/distrho/src/DistrhoPluginVST.cpp +++ b/distrho/src/DistrhoPluginVST.cpp @@ -1058,7 +1058,36 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t return 1; } return 0; + case effGetParameterProperties: + if(ptr != nullptr && index < static_cast(plugin.getParameterCount())) + { + const uint32_t hints = plugin.getParameterHints(index); + + if((hints & kParameterIsOutput) != 0) + return 1; + if(VstParameterProperties* const properties = (VstParameterProperties*)ptr) + { + if((hints & kParameterIsInteger) != 0) + { + properties->flags = kVstParameterUsesIntStep | kVstParameterUsesIntegerMinMax; + const ParameterRanges& ranges(plugin.getParameterRanges(index)); + + properties->stepInteger = 1; + properties->largeStepInteger = 1; + properties->minInteger = static_cast(ranges.min); + properties->maxInteger = static_cast(ranges.max); + } + else if((hints & kParameterIsBoolean) != 0) + { + properties->flags = kVstParameterIsSwitch; + } + + return 1; + } + } + return 0; + case effGetPlugCategory: #if DISTRHO_PLUGIN_IS_SYNTH return kPlugCategSynth;