1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

Fixed an issue with recursive VST3 parameter changed callbacks

This commit is contained in:
Tom Poole 2018-03-16 11:24:06 +00:00
parent 3977403b1b
commit 87dcb5e02b

View file

@ -112,6 +112,8 @@ private:
class JuceVST3Component;
static ThreadLocalValue<bool> inParameterChangedCallback;
//==============================================================================
class JuceVST3EditController : public Vst::EditController,
public Vst::IMidiMapping,
@ -252,6 +254,8 @@ public:
if (auto* param = owner.getParameters()[paramIndex])
{
param->setValue (value);
inParameterChangedCallback = true;
param->sendValueChangedMessageToListeners (value);
}
else
@ -602,6 +606,12 @@ public:
void audioProcessorParameterChanged (AudioProcessor*, int index, float newValue) override
{
if (inParameterChangedCallback.get())
{
inParameterChangedCallback = false;
return;
}
// NB: Cubase has problems if performEdit is called without setParamNormalized
EditController::setParamNormalized (getVSTParamIDForIndex (index), (double) newValue);
performEdit (getVSTParamIDForIndex (index), (double) newValue);
@ -1137,6 +1147,8 @@ public:
: pluginInstance (createPluginFilterOfType (AudioProcessor::wrapperType_VST3)),
host (h)
{
inParameterChangedCallback = false;
#ifdef JucePlugin_PreferredChannelConfigurations
short configs[][2] = { JucePlugin_PreferredChannelConfigurations };
const int numConfigs = sizeof (configs) / sizeof (short[2]);
@ -2031,6 +2043,8 @@ public:
if (auto* param = pluginInstance->getParameters()[index])
{
param->setValue (floatValue);
inParameterChangedCallback = true;
param->sendValueChangedMessageToListeners (floatValue);
}
else if (isPositiveAndBelow (index, pluginInstance->getNumParameters()))