I would probably lock on to the audio clock, in jack or
otherwise, since
this is were it all ends up ultimately.
When the jack_process() gets called, count down the time to wait untill
time is zero or less, in which case you do your midi thing and pick the
next event.
that depends. is this a MIDI-only looper, or a MIDI-driven audio
looper?
usleep (2) is the canonical high resolution sleep function on POSIX
(although nanosleep(2) is a close cousin). the resolution is limited
by the system timer interrupt frequency, which is typically either
100Hz (2.4 and older kernels) or 1kHz (2.6 kernels)
--p