I'm not going to comment your whole message, only this little bit:
On Friday 15 February 2013 13:33:48 M Donalies wrote:
2) Jack let's me know what time it is through a
callback.
It does. As a frame position within the audio stream. It depends on the sample
rate of the audio stream, you know: 44.1/48 kHz. Your callback will be
invoked by Jack not 48000 times in one second, but once each jack period,
which depends on an user setting. The period size is usually quite small,
because Jack users want "low latency" even when watching YouTube videos.
As a musician, you are used to time units like bars and beats, which only make
sense in relation to tempo. Songs may occasionally change the tempo and
rhythm: prepare yourself to make calculations in frames for each MIDI event,
and don't deliver the events until the right callback with the right frame
count has arrived.
You need to be careful to avoid invoking directly or indirectly any GUI widget
methods from your callback, because it is executed in a real-time thread. You
shouldn't call any blocking API functions, like allocating memory. You may
enjoy some other nice restrictions that I am too relaxed to think about it at
this moment.
The real fun starts if you want to provide your users with the ability to set
a playback tempo scale, with controls allowing to play slower or faster while
the playback is already running (this was a common functionality among MIDI-
only sequencers, do you remember Cakewalk?), or syncing time and tempo to an
external master.
You may want to pay this price for the advantage of playing audio and MIDI at
once, with MIDI events placed at frame-accurate instants including the events
delivered to MIDI soft synths. If you don't care, and your MIDI events are
usually sent to MIDI hardware devices, you may want to think twice about it.
Regards,
Pedro