yes, it’s a normalised/unnormalised issue :
you can call AudioParameterBool::setValue()
with a normalised value (anything between 0 and 1), and the method AudioParameterBool::getValue()
returns that normalised value.
But AudioProcessorValueTreeState
set/recall the unnormalised value (0 OR 1), and doesn’t update the parameter value if the unnormalised value is the same.
So the issue is happening in such cases :
boolParam->setValue (0.6f); // value is at 0.6f
state = getValueTreeState();
boolParam->setValue (0.9f); // value is at 0.9f
setValueTreeState (state); // the value isn't changed back to 0.6f because the unnormalised value is already 1
As the state restoration test of PluginVal is based on the sum of the normalised values it may fails if there is a ‘discrete’ parameter.
So either we should save/recall the normalised value and cannot use AudioProcessorValueTreeState::replaceState()
as it is for now, either the PluginVal test should be relaxed a bit taking into account the discrete properties of the parameters.