I’m having an issue which seems random and not reproducible. I think I have the general direction but I’d like to know if this makes any sense at all or am I barking at the wrong tree here.
tl;dr: is it safe to use
apvts.state properties in real time like an AudioProcessorParameter sub tree?
my plugin has a welcome page and a dsp page, and I want to keep the selected page in the plugin state so I call
apvts.state.setProperty(“selectedPage”,”dsp”,nullptr) or a
pvts.state.setProperty(“selectedPage”,”main”,nullptr) whenever a page button is clicked.
To make the plugin respond to the click as well as showing the correct page when a preset is loaded, I have a
Value object in the main component which itself is a
ValueTree::Listener, listening to
apvts.state. So whenever
valueTreeRedirected is triggered I set
value.referTo(apvts.state.GetPropertyAsValue(“selectedPage”). The main component is also a
Value::Listener so whenever “selectedPage” is changed during a session or loading a preset, the page is switched to the value stored in “selectedPage”. Wonderfull.
Every once in a while I get a
EXC_BAD_ACCESS crash either in
ValueTree::SetProperty regarding “selectedPage” property, or it might appear in
AudioProcessorValueTreeState:: flushParameterValuesToValueTree(), referring me to some audio parameter I recently touched.
So obviously this is a threading violation. Should I take from this that I am not supposed to change
apvts.state properties directly?