CurrentPositionInfo::ppqPosition used for AudioUnit getBeatAndTempo


#1

Hi Jules et all.  ppqPosition is documented as being based on pulses per quarter but for Audio Units  (juce_AudioUnitPluginFormat.mm getBeatAndTempo) the value is used for populating outCurrentBeat which is documented by Apple as being "The current beat, where 0 is the first beat. Tempo is defined as the number of whole-number (integer) beat values (as indicated by the outCurrentBeat field) per minute."

Attempting to provide a ppq based position doesn't appear to work very well.  If I change the value to represent beats things work as expected.  (simple testing with iDrum plugin operating as slave to host).

Can someone confirm if this is indeed a mismatch?  And if so, I haven't looked much at the VST side of things, but if it's expecting ppq's, then I'd gather there'd be an issue if you are running audio units and vsts at the same time and wanting to deliver the proper values to each plugin type.


#2

Hi there,

I just checked this and could not find any mismatch between AudioUnit and VST.

In both cases, if you call playhead->getCurrentPosition (info) in the audio thread, then info.ppqPosition will contain the position in quarter notes. So for example, the beginning of the first bar will be 0.0, and the beginning of the fourth bar will be 12.0.

It depends on the host how precise those numbers will actually be. The hosts I checked seem to provide reasonable precision values.

Does that help?


#3

I think the only actual problem is that the current naming and documentation is confusing. ppqPosition, ppqPositionOfLastBarStart, ppqLoopStart and ppqLoopEnd have "ppq" in their name, and the documentation says:  "... in pulses-per-quarter-note". It should actually say "... in units of quarter notes".

I'll get that fixed.


#4

Hi Timur, thanks for clearing this up and for confirming that VST is expecting beats/quarters as well.  Your suggested doc change sounds like the right thing to do in this case.  Thanks for looking into it!


#5

The documentation still says “in pulses-per-quarter-note”. Was a bit confused by that until I found this thread. Any chance of the docs being updated?


#6

Seconded here…took me a little bit to figure out it was in fact units of quarter notes


#7

The docs are still incorrect and frankly misleading. If I hadn’t found this thread i’d still be looking for a bug in my code.

Great SDK overall though, so keep it up!


#8

still remaining


#9

I’ve pushed a change - will appear soon…