Can not get bpm from AudioPlayHead->getCurrentPosition

Hi there,

I did the following(found it in an old post from the forums):

i- in the .h :

AudioPlayHead* playHead;
AudioPlayHead::CurrentPositionInfo currentPositionInfo;
double bpm;

and in in the processBlock method :

playHead = this->getPlayHead();
playHead->getCurrentPosition (currentPositionInfo);
bpm = currentPositionInfo.bpm;
I have a class for midiProcessing, I call it:


In the class I do


it ignores it. I can DBG incoming midimessages so it is called and works so I did

myClass(5.0f) to make sure I get a good value, I still do not get anything DBGed;

what do I do wrong?

Edit: I tried it with JUCE’s pluginhost and Studio one, same result.


Try debugging with break points instead of DBG(). Then you can pause the program at a certain line, check local values (eg. bpm) and step through your code line by line to see if DBG(bpm) is called at all

It’s no surprise in case of the JUCE plugin host. That one doesn’t implement timeline features like beats and automations.
With Studio One I would have expected it, but I haven’t tried myself. It is up to the host to supply those values, not all do, sometimes they only send parts of the information.

What about the other values in AudioPlayHead::CurrentPositionInfo, do they seem correct? That way you can figure out, if just the host is not sending that particular value, or if your setup has an other problem.

1 Like

Hello again,

was actually a problem with DBG not working, once I did as suggested and wtahced the vars I saw the values were actually there.