APVTS: Exclude a parameter to be saved in presets

I’ve got my own preset system which saves parameter values using AudioProcessorValueTreeState::copyState() and AudioProcessorValueTreeState::replaceState(). This works fine but I added a bypass parameter now and I’ve overriden AudioProcessor::getBypassParameter() to tell the host which parameter it is.

The problem is that I don’t want to save the bypass parameter within presets but I can’t figure out how to access the AudioProcessorValueTreeState::state in an intuitive way. Each parameter seems to be stored as a child with the name “PARAM”, and within that there are two properties “id” and “value”. Since each child uses the same name I’d need to compare each “id” to the “id” of my bypass parameter, which needs iterating over the whole tree…

Unless I missed something here, I’d suggest giving the children (parameters) a useful name that I can refer to. Or am I thinking about the whole thing the wrong way?

Thanks!

getChildWithProperty()?
https://docs.juce.com/master/classValueTree.html#aa17ae8b3ef8149fe5b9cc8b37d4ebd7d

1 Like

Thak you so much! I missed that function and that thing gave me headaches - all good now :slight_smile:

1 Like