diff --git a/distrho/src/DistrhoPluginVST.hpp b/distrho/src/DistrhoPluginVST.hpp index 7d08adc8..cfdcf111 100644 --- a/distrho/src/DistrhoPluginVST.hpp +++ b/distrho/src/DistrhoPluginVST.hpp @@ -67,24 +67,24 @@ START_NAMESPACE_DISTRHO // -------------------------------------------------------------------------------------------------------------------- enum Vst3InternalParameters { -#if DPF_VST3_USES_SEPARATE_CONTROLLER + #if DPF_VST3_USES_SEPARATE_CONTROLLER kVst3InternalParameterBufferSize, kVst3InternalParameterSampleRate, -#endif -#if DISTRHO_PLUGIN_WANT_LATENCY + #endif + #if DISTRHO_PLUGIN_WANT_LATENCY kVst3InternalParameterLatency, -#endif -#if DISTRHO_PLUGIN_WANT_PROGRAMS + #endif + #if DISTRHO_PLUGIN_WANT_PROGRAMS kVst3InternalParameterProgram, -#endif + #endif kVst3InternalParameterBaseCount, -#if DISTRHO_PLUGIN_WANT_MIDI_INPUT + #if DISTRHO_PLUGIN_WANT_MIDI_INPUT kVst3InternalParameterMidiCC_start = kVst3InternalParameterBaseCount, kVst3InternalParameterMidiCC_end = kVst3InternalParameterMidiCC_start + 130*16, kVst3InternalParameterCount = kVst3InternalParameterMidiCC_end -#else + #else kVst3InternalParameterCount = kVst3InternalParameterBaseCount -#endif + #endif }; #if DPF_VST3_USES_SEPARATE_CONTROLLER || DISTRHO_PLUGIN_WANT_LATENCY || DISTRHO_PLUGIN_WANT_PROGRAMS || DISTRHO_PLUGIN_WANT_MIDI_INPUT diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index 6244b7c0..86f2fce9 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -1095,7 +1095,7 @@ public: if (fPlugin.isParameterOutputOrTrigger(i)) continue; fParameterValueChangesForUI[kVst3InternalParameterBaseCount + i] = false; - sendParameterSetToUI(kVst3InternalParameterBaseCount + i, + sendParameterSetToUI(kVst3InternalParameterCount + i, fCachedParameterValues[kVst3InternalParameterBaseCount + i]); } } @@ -1933,7 +1933,7 @@ public: return 0.0; #endif - #if DPF_VST3_USES_SEPARATE_CONTROLLER || DISTRHO_PLUGIN_WANT_LATENCY || DISTRHO_PLUGIN_WANT_PROGRAMS + #if DPF_VST3_HAS_INTERNAL_PARAMETERS && !DPF_VST3_PURE_MIDI_INTERNAL_PARAMETERS switch (rindex) { #if DPF_VST3_USES_SEPARATE_CONTROLLER @@ -1948,7 +1948,7 @@ public: #endif return plainParameterToNormalized(rindex, fCachedParameterValues[rindex]); } - #endif + #endif const uint32_t index = static_cast(rindex - kVst3InternalParameterCount); DISTRHO_SAFE_ASSERT_UINT2_RETURN(index < fParameterCount, index, fParameterCount, 0.0); @@ -2002,7 +2002,7 @@ public: { if (fPlugin.isParameterOutputOrTrigger(i)) continue; - fCachedParameterValues[kVst3InternalParameterCount + i] = fPlugin.getParameterValue(i); + fCachedParameterValues[kVst3InternalParameterBaseCount + i] = fPlugin.getParameterValue(i); } #if DISTRHO_PLUGIN_HAS_UI @@ -2019,6 +2019,8 @@ public: } #endif + DISTRHO_SAFE_ASSERT_UINT2_RETURN(rindex >= kVst3InternalParameterCount, rindex, kVst3InternalParameterCount, V3_INVALID_ARG); + #if DPF_VST3_USES_SEPARATE_CONTROLLER const uint32_t index = static_cast(rindex - kVst3InternalParameterCount); DISTRHO_SAFE_ASSERT_UINT2_RETURN(index < fParameterCount, index, fParameterCount, V3_INVALID_ARG); @@ -2026,11 +2028,6 @@ public: setNormalizedPluginParameterValue(index, normalized); #endif return V3_OK; - - #if !DPF_VST3_HAS_INTERNAL_PARAMETERS - // unused - (void)rindex; - #endif } v3_result setComponentHandler(v3_component_handler** const handler) noexcept @@ -2139,7 +2136,7 @@ public: for (uint32_t i=0; i(rindex) - kVst3InternalParameterBaseCount; + DISTRHO_SAFE_ASSERT_UINT2_RETURN(rindex >= kVst3InternalParameterCount, rindex, kVst3InternalParameterCount, V3_INVALID_ARG); + const uint32_t index = static_cast(rindex - kVst3InternalParameterCount); + fUI.parameterChanged(index, value); return V3_OK; }