When I open a previously created project into a DAW(Logic Pro X) that uses my plug-in; It is not until the GUI becomes active/visible do the audio parameters recall their state. The automation for the plug-in also doesn’t work until GUI becomes active/visible. When the DAW project is loaded, all the audio parameters are always set to their default values that were given in the AudioParameterFloat() constructor, no matter what. It’s appears as though the DAW doesn’t call setStateInformation() until the GUI becomes active/visible.
Best to verify or rule out by using breakpoints or DBG statements. If using DBG statements, put some in other places, to make sure you are looking at the right console
What could be the case is, that your plugin was never seen as changed, hence not restored. Normally it would be set dirty (= needs saving) by calling AudioProcessorParameter::setValueNotifyingHost() or AudioProcessor::updateHostDisplay(). If you just called parameter->setValue(), the value never reached the host.
That it works with the GUI makes me guess, that you use some provided structure, that triggered that for you, e.g. using AudioProcessorValueTreeState with attachments would do that without having to write any code. Also maybe beginGesture() or other similar things.
Thanks for the help.
I found the problem; I was doing some of the DSP calculations from the sliderValueChanged() listener; I had placed them there for efficiency purposes.
I am running into the exact same problem. My plugin recalled the parameters only after the user clicks the plugin in Logic. I am unclear on what your solution was. This problem only happens in Logic it seems.
Are you running a timer to continuously set the GUI?
Maybe the constructor is setting parameters to unwanted values.
I solved the problem by reading my parameters from my value tree in processBlock() as opposed to just in prepareToPlay().