Parameters listeners on setStateInformation

Hi all, I’m quite new to JUCE so please forgive me if my question is to simple.
I’m trying to build an audio VST plugin.

I have all my parameters in an AudioProcessorValueTreeState variable.

When a parameter changes (with a slider and slider attachment) I have a listener with:
valueTreePropertyChanged that triggers other functionality…

When reloading the pugin and I recall the state with setStateInformation all parameters get their correct value (and the sliders are moved accordingly) however the listener is not triggered.

How can I fix this? is there a better way of handling this?

Its sounds like you’re inheriting from the ValueTree::Listener class. Have you tried inheriting from:

AudioProcessorValueTreeState::Listener

And listening for parameterChanged() instead?

https://docs.juce.com/master/structAudioProcessorValueTreeState_1_1Listener.html

1 Like

And don’t forget to call AudioProcessorValueTreeState::addParameterListener() for parameters that require a callback.

1 Like

I´ll give it a try. I thought that using valueTreePropertyChanged from ValueTree::Listener would save me from adding a per-parameter addListener but doesn’t seem to work on start-up. Cheers, thank you.