[alsa-devel] How to get correct midi timings from ALSA using the library only

Clemens Ladisch cladisch at fastmail.net
Tue Jul 24 12:24:15 CEST 2007


Carlo Florendo wrote:
> (1) I've written a command line MIDI sequencer for lightweight systems and 
> am successful in making it work using the ALSA queue API.  However, one 
> drawback of the API is its lack of callback functions.  I wish to be able 
> to track events as they are drained by the queue.
> 
> (2) I know and have successfully worked on a work around whereby the 
> application itself subscribes to the output port so as to see events as 
> they are played.

You could also send special user-defined events just to yourself, but
the principle is the same.

> However, I wish to be able to make the sequencer or player work without the 
> use of the ALSA queue nor the workaround in (2).

Why?

> How could I get the app to <u|nano>sleep() in the most accurate way in 
> userspace without using the ALSA queue nor the extra subscription to an 
> output port?

On newer kernels, you could try POSIX interval timers.

> Or, is there a drain or output routine that supports callbacks?

Why can't you simply call the callback when some event has been
received?


Regards,
Clemens


More information about the Alsa-devel mailing list