Logic Pro processBlock getPlayhead and getNumSamples inconsistent


I’m making a VST3/AU plugin and it’s behaviour is a little inconsistent.

On each process block I get the playhead and get the PPQ position. I then get the number of samples from the AudioBuffer and use that to calculate the end of the block I’m processing.

I use these 2 numbers to scan over a midi object I have to decide which notes to play at a given time. This is very consistent in Reaper, that is the end position of a block is always the PPQ position number of the next block accurate to at leas 16 decimals. (What is shown in VS Debug Locals window) That is not the case with Logic pro, where it is only the same to about 4 decimals. That means that I will eventually miss on and off events every now and then.

Of course I could store the last end block value and use that as my new start block instead of the PPQ or keep track of what part of my midi I have already played, etc. But that would require me to rewrite my parser just for Logic Pro.

Has anybody experienced this, and have come up with some solution

1 Like

I think you should rewrite it, but not because of the inaccuracy you’ve found in Logic:

In the beginning of each block, you can’t assume that the current block would start from the same position the previous block ended, because the user might manually skip to a whole different place in the timeline. Many hosts feature all kinds of timeline manipulation features like Cubase Arranger track.

Instead, you should work on your sequencer so it handles the blocks in pieces of ‘unrelated’ timeline, and if you find that the block skipped too much forward for any reason, handle the notes off for the currently played notes correctly.

1 Like