I was thinking about updating the parameter value myself from processParameterChanges()
but I decided against that as I was seing the host directly updating the parameter itself.
That’s what I’m also seing with your patch. Shortly after ProgramChangeParameter::setNormalized()
is called from processParameterChanged()
I see a second call to ProgramChangeParameter::setNormalized()
that originates directly from Bitwig. This is the stacktrace:
> myPlugin.vst3!juce::JuceVST3EditController::ProgramChangeParameter::setNormalized(double v) Line 597
> myPlugin.vst3!Steinberg::Vst::EditController::setParamNormalized(unsigned long tag, double value) Line 186
> BitwigPluginHost64.exe!000000014003eed7() Unknown
> BitwigPluginHost64.exe!0000000140048cdb() Unknown
It seems to me like it’s coming from the GUI thread.
In your patch, at line 599 you catch that the ProgramChangeParameter already is at the correct value so setCurrentProgram()
is not called a second time. So in the end it works but admittedly is seems a little unsafe with multiple threads potentially accessing the same stuff concurrently.
Edit: You can install and use the demo version of Bitwig to investigate this for yourself. Maybe this is a special behaviour of Bitwig, idk.