Get the beat bar position in samples from the host

Hi

I’m trying to get the beat bar position from the host in samples from the beginning.
I want the distance in samples between the bar and the beginning,
I’ve found the information in the processContext but I have no idea about what to do next.

projectTimeMusic;
barPositionMusic;
cycleStartMusic;
cycleEndMusic;

Is there a way to use these to accomplish this?
Anyone who can give me a hint?

I’m trying to use the data.processContext->projectTimeSamples to calculate plugin delay/latency from the plugins before in the chain, to see if they are using bigger buffer than the sound buffer is set to.

Thanks in advance