Wouldn’t it make sense to use approximatelyEqual (param.getValue(), newValue)
instead of the normal comparison in setValueAndNotifyIfChanged() ?
I have a plugin where unexpected changes are triggered (somehow the issue only appeared in FL studio with vt3 for now) and using approximatelyEqual() fixes it.
you might be experiencing a feedback loop.
This is when the plugin notifies the DAW of a parameter change, and the DAW notifies the plugin back.
You wouldn’t think this was a problem, but with floating-point math it’s very easy for tiny tiny differences to creep in and cause the DAW to set the parameter slightly different each time around the feedback loop.
However the root cause of the problem is often not the rounding errors, it’s that you are notifying the DAW unnecessarily when you are not meant to. i.e. if the DAW notifies a parameter change, your plugin should NOT be notifying it back.
Another technique I’ve used is to retain the last parameter value that the DAW sent, and compare any future notification with that cached value. Ignore notifications that don’t change it.
It is critical that you don’t convert or alter this value at all, i.e you can’t convert it from normalized to real or vice versa, because it’s that type of operation that introduces the quantization or rounding errors.