Using AudioProcessorValueTreeState with AudioProcessorParameter objects


Hi all,

I’m working on a plug-in which by design requires Value Tree State parameters and a few AudioProcessorParameter parameters. I’m having trouble with the saving and loading in the getStateInformation and setStateInformation functions due to the two. I’ve looked through the docs and was hoping someone here could set me straight. Any help is appreciated. Thanks!


There is a common ancestor of AudioParameter(Float|Int|…) and AudioProcessorValueTreeState::Parameter, which is AudioProcessorParameterWithID

However, the AudioProcessorValueTreeState::Parameter class is not publicly exposed, so the two methods are mutually exclusive.
But to be fair, I didn’t find a use case I couldn’t resolve with the AudioProcessorValueTreeState and the Attachment classes…
Can you elaborate, why you need to mix with the AudioProcessorParameter classes? Maybe we can find a solution for that.


If you’re using the AudioProcessorValueTreeState::state::createXml() method of saving the state of your value tree you could always append extra XML tags for your AudioProcessorParameter type parameters. Maybe something like:

<PARAM id="CustomParam" value="..."/>

So you can restore the AudioProcessorValueTreeState's state with ValueTreeParams then use the remaining tags when restoring your other parameters.


Thanks for the input guys.

@TonyAtHarrison, this was what I was looking for - I didn’t understand how the xml tagging worked, thank you.

@daniel, so I’ve overrode a fair amount o the juce VideoComponent so that I could lay draggable components on top of it. These components acted like two sliders basically - they had X and Y axis values in between 0 and 1, being the width and height of the loaded video. My first build had them updating sliders with a callback, this way I could use the audioprocessorvaluetreestate slider attachment for automation. But I ran into trouble automating on touch specifically - problem being that they would only write info into the slider when they were being dragged, otherwise their x and y values would be written into from the two sliders, but touch automation couldn’t register the draggable objects as being touched and released properly. Long story, but that’s why I fixed it by just using AudioParameters updated when the draggable objects are moved.