Re: [linux-audio-dev] [ot] rawmidi && alsa

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] [ot] rawmidi && alsa
From: Jaroslav Kysela (perex_AT_suse.cz)
Date: Tue Apr 24 2001 - 10:00:43 EEST


On Tue, 24 Apr 2001, Abramo Bagnara wrote:

> Paul Davis wrote:
> >
> > >> there is absolutely nothing that i know of above read/write/open/close
> > >> in the ALSA raw MIDI API that is of use to any application I have ever
> > >> seen.
> > >
> > >No drop, no drain, no status, no avail_min, no buffer_size?
> >
> > I've never seen a program that does raw MIDI I/O that would use any of
> > these. the (my) model of a raw MIDI device doesn't include any of
> > these concepts. when i write data to a raw MIDI device, i expect:
> >
> > * it either gets put on the wire immediately, OR
> > * my thread blocks until it can be put on the wire
>
> As far as I know, this is not true for current ALSA implementation. It
> seems you want an O_SYNC behaviour.

Yes, it could be implemented (and we'll implement it), but I don't
recommend to use it. The much better behaviour is to control the output
buffer (to see, how many bytes were not transmitted) rather than block a
process. Many hardware is really broken for the MIDI transmits (imagine
SoundBlaster with 2 bytes in Tx FIFO etc...). With O_SYNC you can't use
the full bandwidth of the MIDI connection when the system is busy.

If you want to be more in sync with hardware, it's nothing simplier than
to reduce the Tx ring buffer size to 16 or something around. Then, write()
calls are blocked when the ring buffer size is full.

> > if i read from it, then
> >
> > * i get data immediately, OR
> > * i block until data is received from the wire
> >
> > (ignoring O_NONBLOCK, etc.). the concept of "drain", "drop" etc. don't
> > have any place in the way i think about "raw MIDI". whats the status
> > of a UART delivery bytes to a wire ? there isn't one, other than a
> > permanent error. i am not sure how these crept into the alsa API. they
> > certainly belong in the sequencer API, but raw MIDI ? i don't think so.

I'm sorry, but this layer is required in my eyes and it's always better,
if ring buffer could be gained for some really fast hardware (I don't
think that we'll have only serial MIDI connections with the end devices).
Imagine USB or FireWire or some other hardware transport layers.

                                                Jaroslav

-----
Jaroslav Kysela <perex_AT_suse.cz>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed May 23 2001 - 19:12:21 EEST