I’m having an issue restoring my Toggle Buttons (TextButtons).
In getStateInformation()
I am getting the APVTS tree and the sliders restore fine to their previous value.
But my Toggle(TExt) buttons don’t. They seem to all restore to true.
I did a debug DGB string in getStateInformation()
and the values all report correctly.
apvts.replaceState(tree);
mRedToggleButton_value = apvts.getRawParameterValue("redToggleButtonParameterID")->load();
mGreenToggleButton_value = apvts.getRawParameterValue("greenToggleButtonParameterID")->load();
mBlueToggleButton_value = apvts.getRawParameterValue("blueToggleButtonParameterID")->load();
outputstr += (mRedToggleButton_value ? " Red=True" : " Red=False");
outputstr += (mBlueToggleButton_value ? " Blue=True" : " Blue=False");
outputstr += (mGreenToggleButton_value ? " Green=True" : " Green=False");
DBG(outputstr); //correct values shown
i.e. Blue is true
, the others are false
reported in the code above DBG string.
But then I query the values later and they are all true
!
Is there a quirk with restoring toggle states of TextButtons in JUCE that I should know about?
(I notice that if I turn a knob on my plugin UI and close the DAW, it says “Save Yes/No” but if I turn a button on or off, and close the DAW, it doesn’t offer a “Save”.)
Extra info… My constructor in PlginProcessor.cpp snippet:
mRedToggleButton_value(false), mGreenToggleButton_value(false), mBlueToggleButton_value(false)
PluginEditor.cpp constructor snippet:
mRedToggleButton_buttonAttachment(audioProcessor.apvts, "redToggleButtonParameterID", mRedToggleButton), //same for blue and green