[LAD] How to get correct midi timings from ALSA using the library only

From: Carlo Florendo <subscribermail@email-addr-hidden>
Date: Tue Jul 24 2007 - 12:01:19 EEST

Hi,

(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.

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).

Here's the pseudo-code of the relevant MIDI player routine:

for (i = 0; i < number_of_events; i++)
{
     usleep(event[i].delta_time_in_microseconds);
     output_and_drain_event(event[i]);
}

This routine gives a non-bearable latency on 2.4 kernels but not so much on
2.6 kernels.

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? Or, is there a drain or output routine that supports
callbacks? If so, I will be grateful if you could point them out. I seem
not to find any output callback routine under the docs.

Thank you very much.

Best Regards,

Carlo

-- 
Carlo Florendo
Softare Engineer/Network Co-Administrator
Astra Philippines Inc.
UP-Ayala Technopark, Diliman 1101, Quezon City
Philippines
http://www.astra.ph
--
The Astra Group of Companies
5-3-11 Sekido, Tama City
Tokyo 206-0011, Japan
http://www.astra.co.jp
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
Received on Tue Jul 24 12:15:04 2007

This archive was generated by hypermail 2.1.8 : Tue Jul 24 2007 - 12:15:04 EEST