I’ve set up a project with a synth and a sample player, and I created a step sequencer class that triggers notes. Currently, I’m running the step sequencer on the game thread and accumulating the delta time to trigger notes on the beat. While this works to a degree I have noticed some inconsistencies when using the sample player to play drums. The timing is not sample accurate for obvious reasons, and I would like to move in that direction.
So, I’m going to move the timing to the audio thread and trigger the notes with a short delay (measured in samples). My question is: how can I guarantee that the step sequencer will fire the timing messages before the synth triggers it’s generate audio loop? The audio callback buffer is currently 1024 samples long, and if the step sequencer queues up a note on the synth after the synth generates its audio the note will be triggered on the next loop (1024 samples late).