VST timing question

I need to define the length of a certain process in some units that are synced to the host. I though quarter notes in a simple fractional notation like 2.5 will mean two and a half quarter note (2 quarters and one eighth).

I was wondering how do i calculate the length of a single quarter note in a processBlock() call, i get the ppqPosition in a double type that is not really 960 * amunt of quarter notes. It’s a bit more complicated then that. Could someone share the math to get the amount of passed quarter notes ?

Also how does that all fit into the beats, bars, numerator, denominator musical notation stuff ?

What i need is to know how long to keep the process running, i thought i could be more precise and to keep track of ppqPosition, but i don’t know how to calculate what position will an event be based on the length in quarter notes. I can see the code that’s in the audio plugin example that show bars/beats/ticks, but i got confused because it looks like there is 120tick per quarter note when i debug in Reaper (maybe those ticks that the audio plugin calculates are not ppq ?)

currentPosition = AudioPlayHead::getPositionInfo();

This is a bump with a question the manual says:

So witch is it, the number of quarter notes since the edit start or pulses-per-quarter note, these are two different units and the same number ?

Sorry - the units are ppqs, not quarter-notes. I’ll correct that.

That explains ppq as a unit. Can someone help me out with the double conversion. It should be 960 PPQN (point per quarter note), but the ppqPosition is a double like 0.123, 0.255, 0.66, 0.9, 1.0. How do i get 960 and further values from that double value (fmod()? how? )

After a lot of time spent in a piano roll of Reaper i think i finally understood (what i thought was a quarter note was actually a 16th note).

To get the amount of 16th notes from the start of edit (assuming 960ppq resolution):

const int note16	= (int) ( (ppq * 960.0) / (int) 240);

Where 240 is 1/4 of a quarter note (960), so the amount of 8ths would be 480 etc.