[PlanetCCRMA] 2 questions - Alsa OSS MIDI Emulation

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Mon Oct 28 17:56:01 2002

> Humm...it seems to me like you and I see this alsa/OSS stuff differently

The expectations are different :-)

I have not used midi extensively so I don't really know a lot about it.
The OSS emulation layer, I guess (and it is just an educated guess), only
works with alsa devices. That is, cards that have midi input/output
capabilities. So, when a program opens an oss midi out port the bytes it
sends will be appearing at whatever output port the card has. Same for
input, the program will be receiving the bytes that the card receives on
its midi input port. That happens, I think, at the device driver (kernel)
level - which is what can actually intercept the writes and read to/from
oss device files in /dev.

It is different if you have a program that uses the alsa sequencer api for
its midi i/o. That goes through a library in user space that can do all
sort of nice things, like implementing a virtual patchbay that can connect
anything to anything. Only when you connect to a device that is part of a
card that has midi i/o functionality are bytes actually sent to or
received from external ports. Otherwise all the exchanges are done (I
think) through the user level library (no, I don't know how :-). I would
be surprised if it would be possible for the two worlds to talk (on one
hand the card device drivers getting things _directly_ from the oss
emulation code, on the other the user space alsa library doing things on
behalf of applications outside of the kernel - most of the time).

But ask on alsa-devel, maybe there is a way to do what you want and I'll 
be proved wrong. 

Oviously once all applications start using the alsa sequencer api all sort 
of things become easy to do. 

Of course the api is more complex than just writing or reading bytes
to/fron a device file in /dev, so could be some resistance on the part of
developers in moving to alsa. Understandable.

BTW, it is still more complicated than that: 
There is a:
  OSS raw api
  OSS sequencer api
  ALSA raw api
  ALSA sequencer api

The raw apis just write and read bytes, unformatted, AFAIK they can't
"share" an interface. The sequencer apis are the ones that enable apps to
communicate with each other (at least in alsa, don't know about oss).

-- Fernando