I’m working on a sequencer inside my plugin today, and the clock/sync problem stops me from moving forward. Like all other sequencers, I need to get accurate timing of the quantization time(1/4 note, 1/16 1/32…etc)
Two approaches I’ve tried:
getting AudioPlayHead in audio thread, i.e. processNextBlock(), and get the ppq info.
Fail reason: the host call this to fill buffer every 256 samples(in my case, logic with default 256 samples buffer), so there are always a few ticks gone with this latency
use sample to count time, also in processNextBlock(), of course.
Fail reason: it’s not an integer after converting the quantization to samples, say, 45.12345 samples is a 1/16 note, but sample counting is just incrementing 1 continuously, no fractions, so I have to truncate the float to int(45.12345 to 45). Then the sync with the host will drift after some playing or recording.
First time to make a sequencer, I believe there’s a generic solution since many plugins I’ve seen have a sequencer and sync very well. Wondering how they make that.