I’ve never had issues with that - in my mind things needed in ‘prepareToPlay’ are the same as processBlock. If I need to ‘prepare’ things that are read from the UI state I would need some mechanism to sync that anyway.
So for example, say my UI state loaded a user sample that needs to be resampled to the current sample rate in ‘prepareToPlay’.
I usually design my program so that in prepare it just saves the current samplerate in an atomic, and then later on a Timer it sends some threaded worker to do the resampling… and then push it back to the audio thread using a queue of sorts.
getStateInformation is more challenging because on AU and AAX and it can be called from non-UI threads. With AAX I’ve found that you can actually just wait for a result from the message thread.
In Logic however that sometimes causes a deadlock, because Logic calls it while holding on to the UI thread. So for AU I’ve found that if the call to getState comes in a side thread, you have to have a cached version of your state ready to go.
(All of the above applies even if you’re not using APVTS BTW, it’s just a general design problem).
