CurrentPositionInfo confusion


#1

I’ve been fighting with CurrentPositionInfo for hours now. Call me simple minded but I don’t understand how to PROPERLY & COMPLETELY fill out this structure! I could sure use a clear and complete description of how to provide a drum machine with what it needs to work properly. At this point, having done my ppq calculations wrong, my drum machine is stuttering at (repeatably) 20 bars, and 33 bars into the song I’m trying to play! Playing with the ppq’s in the structure affects this.

The scenario:
Musically I know the tempo in bpm and the time signature.
I have a ‘start/stop’ button - when started I want to reset to the ‘beginning of time’ and hear the drums kickoff.
I know the sample rate, and my audio callback tells me how many samples its got.
With that I can calculate where I am in time.
I have set the frame rate to 24fps.

So, with the information above - what EXACTLY do I have to do to PROPERLY and COMPLETELY calculate the ppqPosition and ppqPositionOfLastBarStart? - And, if I’m the host (I am) then is it me (gotta be) who calculates the ppq resolution? and how does that factor into the equation. I have been hunting the web all day and am no closer to understanding what I should do. And yes, I’m in frustrated musician AND frustrated programmer mode who’s had too much coffee today…

Oh, and why the !@#$ does anything CARE what the lastBarStart position is anyway???

Thanks for listening!
Kurt


#2

Better question, how will you know when it is filled out right? Do you have plugins that utilize all the information?


#3

Good question…The GrooveAgent2 plugin is definitely reacting to it and since I’ve seen it work perfectly within cubase its my HOPE that it is responding properly to the time info it’s given. As it stands right now the ppqLastBarStartPosition is affecting the initial bar/beat the drum machine starts off with - both the display and performance are starting in funny places like 5/1 or 3/2 (depending on the numbers I feed it). So the initial bar/beat display are one indicator.

Another is that if I set an ‘initial’ value into ppqLastBarStartPosition and don’t modify it thereafter, it can result in performance ‘stutters’ at predictable bars/beats during playback. I’ve seen some gnarly looking timing code relating to this value and am thinking that ‘decisions’ need to be made during the calculation of this value. Since I’m not really even quite sure what this variable is for, or how it’s used by plugins I’m in the dark here.


#4

It appears that the glitch I’m experiencing is due to a bug in the plugin, and NOT my currentPositionInfo being incorrect. Arghhhh…And I stand corrected - the plugin doesn’t work perfectly in cubase either - I just never noticed it.