Sample accurate message for graphical interface

Hi there,

Sorry if this question has been asked before, but I couldn’t find anything relating specifically to this issue.

The graphics of my project seems to be out of sync with my audio due to the buffer size being to large to sync appropriately the graphics and audio. At the moment, an index which is read by the graphical component of my project is incremented at the start of the ProcessBlock(), while a MIDI message is placed in the Midi queue at a specific sample number. Because of this, the index is changing before the specific sample that the Midi is scheduled for, causing the graphical interface is to run too fast.

So, I was wondering if there was a way to internally schedule a variable to change at a specific sample in processBlock, which could then be read by the Graphical component instead of waiting for another call of procoessBlock() before it is changed.

If anybody could help me stop pulling my hair out over this, I would be greatly appreciated!

Thanks!