On Monday 24 December 2012 05:52:41 Pedro Lopez-Cabanillas wrote:
I think that you are not getting more help here
because a terminology
confusion. This is only a guess, but I think that by "jack connections" you
mean the lines that can be created in the "ALSA" tab of qjackctl. In that
case, you are using the wrong name because those lines have nothing to do
with jack. They are ALSA sequencer connections that can be made using
other programs as well, like "aconnect". There is an ALSA API to create
connections; look for "subscription" here:
http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html
If you want to use jack midi instead, please clarify (and don't expect
answers or interest from me.)
Well, that explains why there's a separate ALSA tab in QJackCtl. And, yes, I'm
using the ALSA tab to make my connections. So, at this point, it seems I don't
really need jack.
Just a side question: if I had an application that uses audio and midi (like
Sonar), who keeps them in sync? Is this ALSA or Jack?
The first
thing I don't understand is in scheduleEvents() why passing
absolute times to the queue doesn't work.
Probably because when you execute snd_seq_start_queue(), the queue's clock
starts rolling, and the queue won't play events having timestamps in the
past, only in the future. If your MIDI events have very low timestamps,
you can try adding the current queue's time at scheduleEvents(). But in
this case, using relative times is much easier.
And once I have absolute times,
how do I do the play/pause in the transport loop in main().
You already know the queue control functions: snd_seq_start_queue(),
snd_seq_stop_queue() and snd_seq_continue_queue().
So the queue has its own clock? Can I create the queue, push events to it,
then start it? And if I then stop the queue and later continue, will it
process the rest of the events from where it left off when it was stopped?
Assuming that you want to use the ALSA Sequencer, and
not jack midi, I can
provide some working examples.
As per your request, a simple metronome program in C
http://lalists.stanford.edu/lau/2009/08/att-0005/ametro.c
You can check as well the examples in my drumstick library (Qt4, C++)
http://drumstick.sourceforge.net/docs/metronome.cpp-example.html
Perfect. And you pre-answered my next question. Is there a C++ wrapper for
ALSA? And uses Qt too! Nice. Thanks.
--
7:8