setParameterNotifyingHost() seems to have a bug

Hi Jules,

I am working on an Audio Plugin for Pro Tools 12 and have encountered some weird error that resets parameter values to 1.
I suspected setParameter() or setParameterNotifyingHost(), and it turns out that setParameterNotifyingHost() seems to have a bug in it.

void AudioProcessor::setParameterNotifyingHost (const int parameterIndex, const float newValue)

    setParameter (parameterIndex, newValue);
    sendParamChangeMessageToListeners (parameterIndex, newValue); // may be a problem !!

If you have a look at the code above, we are supposed or encouraged to scale an input parameter in setParameter() to be in the range of 0 and 1.
But, how about the line below? sendParamChangeMessageToListeners() is sending an unscaled newValue to the host. This upset Pro Tools.

Or, are we supposed to scale the value before we pass onto setParameterNotifyingHost() ?
Our codebase became very big and we are not able to modify all occurrences of setParameterNotifyingHost() at this stage.
It may be a workaound to change "float newValue" parameter to a pointer so that we can update it in setParameter().

We'll need to modify the juce_AudioProcessor.cpp for now.


Looking into subsequent function calls further, there is another setParameter() call in SetParameterNormalizedValue(). So newValue shouldn't be scaled when it is passed to sendParamChangeMessageToListeners().

But, why is it causing an issue in Pro Tools with parameter values? If I comment out the call to sendParamChangeMessageToListeners() in setParameterNotifyingHost(), everything seems to work fine. Although it will probably be not a good idea to skip that line.

Is there any fix or workaround for that?