Getting tempo information before audio playback starts

Hi All-

Is there a way to obtain the session tempo from a host when audio is not playing? I know I can use the AudioPlayHead class to get this information when playback is happening, but I'd like to update some GUI components that display tempo information before/not during playback, i.e. when the user first instantiates the plug-in or changes the session tempo, for example.


I realize this is a pretty specific question, but figured I would ask. Thanks in advance!

There may not actually be a tempo to fetch when the plugin's not actively playing, for many reasons.

E.g. the host may not have any tempo information at all. Or the material may contain a range of different tempos, so depending on where the play-head is, the tempo will be different.

Right, I suppose that makes sense. I was thinking along the lines of that in most (well, all I believe) DAWs, the user can specify where to start playback. So they might have played the session to a point where the tempo is, say, 160, then click somewhere earlier in the session to start the next playback where the tempo would be, say, 120. Obviously the correct session tempo would update to 120 upon playback, but the GUI won't update until that happens, which could cause minor user confusion.

Of course, I realize this is extremely nitpicky and not worth looking into much further. I had just thought it might be cool to have a "playbackStartPosition" or something of the like but that is probably DAW and/or wrapper specific, and there could be situations where no tempo information is available.

Thanks Jules!

In my experience nearly all DAWs are continously passing audio. Now I've never used the tempo info but I suspect you will find that all the information you want is already there when you want it, have you tried? Most of the DAWs that do stop the audio,  at least that I'm aware of, are audio editors, but do correct me if I'm wrong.

If audio wasn't being passed through then presumably you couldn't playing your synths, or pass external audio through your effect chains when you are not playing back, I suspect the tempo info is updated as soon as the playback head is moved or reset as opposed to on playback but I might be wrong.

I've been testing what's being reported to Playhead on most DAWs.

with some exceptions. most DAWs reports all the time. some requires audio to be passed.

processBlock should be enough to update state or am I'm missing something?