AudioPlayHead::CurrentPositionInfo / Transport State when playing or stopped

Hi all,

I’ve come across a bit of a conundrum with AudioPlayHead->getCurrentPosition(). We’re only supposed to call it from the audio callback, which I do. I then save the isPlaying() info to a variable which I read from my UI thread, in order to only repaint certain areas of the GUI when actually playing. Unfortunately, however, under some circumstances it seems that the audio callback is not called after pressing stop in the DAW (understandable, at first glance), which means my variable with the info if we’re still playing is wrong. I thought about resetting my variable to false each time I read it from the editor, but that leads to different problems with hosts that use dynamic processing (i.e. the audio callback is not called if there is silence on the track->we’re still playing but my GUI doesn’t update).

Is there any other possibility in JUCE to get the current transport state? My alternative idea would be to create a timer in the respective wrapper that asynchronously polls the transport state from the host, I haven’t seen anything in that regard in the wrappers so far, but maybe I’m missing something glaringly obvious?

Best regards,

No elegant way if your plug-in being cut off the audio thread callback.

Eg. Logic AU…

1 Like