From 4b4b1714234859df464fb4e25abc5b43eeea90e5 Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 11 Jul 2017 11:43:08 +0100 Subject: [PATCH] VST3: Fixed an issue where the program number was calculated incorrectly when the host requests a program change --- modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 3376249168..2d865b8e74 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -1917,7 +1917,7 @@ public: else if (vstParamID == JuceVST3EditController::paramPreset) { auto numPrograms = pluginInstance->getNumPrograms(); - auto programValue = roundToInt (value * numPrograms); + auto programValue = roundToInt (value * (jmax (0, numPrograms - 1))); if (numPrograms > 1 && isPositiveAndBelow (programValue, numPrograms) && programValue != pluginInstance->getCurrentProgram())