Recalling properties using setStateInformation

What’s the correct way to reload non audio properties during plugin init? Currently, getStateInformation and setStateInformation will only take care of the audio parameters. What do I do if I have an audio file that should be loaded when the plugin starts?
During a session I can handle this using APVTS.state. It works well even when changing presets. But during the StateInformation functions I believe that APVTS.state is being dumped into the GUI value tree or something similar, and all of APVTS.state’s properties are lost.

1 Like

The APVTS.state is still there, and there is an easy way to access it (btw. regardless if you use the APVTS or you don’t).
The magicState has a method to access the tree and properties:

magicState.getProperty ("analyser:input");

This will create a ValueTree with type “analyser” and returns a property “input” as reference that you can set. You can nest the ValueTrees as deep as you want, the last portion is the property, the ones before are the ValueTree names of the parents.

The nice thing about it is you can use the same property in the GUI, they will appear e.g. in toggles, in CSS classes that can be switched using those properties or in Labels.

An example is here:

There is a callback you can override that will run after setStateInformation where you can attach listeners to those properties.

Let me know if that works for your use case.