Can I call getPlayHead() outside processBlock()?

In a plugin, is it possible to call getPlayHead() only inside the processBlock() call, or can it provide a valid position also when called from other threads? More specifically, I would like to fetch the DAW playhead each time another audio IO device callback occurs.

I'm pretty sure someone else just asked the same thing last week, but can't find the post..

Anyway, the answer is NO!!! Definitely not. Outside of the processBlock there's no guarantee that the host even has a context in which a time would make sense, and the behaviour you get by calling the function is undefined. Some hosts may return something sensible, others will probably crash.

Thanks for the answer Jules. It totally makes sense.

Could you clarify this in the API documentation though? It currently says that "You can call this from your processBlock() method", so it was a bit unclear to me if this was the only acceptable context.

Sure, I'll make the docs a bit more emphatic!