I seem to remember there was a method in JUCE that returns if AudioProcessor::processBlock is being called. Am I remembering well? Alternatively, is there a safe way to know that from a separate thread even in the event of some crazy hosts skipping prepareToPlay()?
That would break the contract, so this host would be considered broken.
It is not specified, that each time before resuming playback it would be called. But it has to be called at least once before playing.
processBlock can be called in realtime or as fast as possible when bouncing a track.
You can save the wall clock in processBlock into an atomic, so you can guess from that.
But take care that you choose a wall clock (aka system time) that is realtime safe. Some of them are blocking and might do a priorty inversion.
I’ve just realized an atomic in the processBlock is indeed enough to indicate when it starts running
I still have to find a way though to know when it stops running.
Can I assume releaseResources() will be called if the plugin stops calling processBlock (e.g. if it is suspended or bypassed but the user still has access to its UI)?
Unfortunately no. There are no guarantees, some hosts will only call releaseResources() immediately before destroying your plugin.