FeatureRequest: AudioProcessorValueTreeState to accept a CriticalSection for reads & writes of the ValueTree

Hello JUCE team,

Would it be possible (and reasonable) to add an optional CriticalSection for the AudioProcessorValueTreeState class?

I have implemented a StateManager around the ValueTree, which uses it (the VT) alongside the AudioProcessorValueTreeState. But my StateManager can have multiple StateAccessors (some lock-free and others not) for different threads reading-from or writing-to the state. I would like to be able to synchronise the access to the ValueTree through a mutex, instead of always queueing and executing edits on the Message Thread, so APVTS accesses and mine don’t collide.

//cc: @ed95 @timur @jules @t0m

I think it’s a very reasonable request - updating all of the parameter handling classes has been on our todo list for a while, and one of the most important things we want to improve is adding explicit thread safety and handling in a few places.

You don’t need to @-mention anybody - the JUCE team read every forum post.

Thanks @t0m. This sounds good.
Sorry for the @-mention - I’ll try to be more considerate about that.