[alsa-devel] Rawmidi vs. /dev/snd/*
Gabriel M. Beddingfield
gabrbedd at gmail.com
Mon Apr 2 07:21:29 CEST 2012
On 04/01/2012 01:25 AM, Paul D. DeRocco wrote:
> In writing an embedded app that will be the only thing talking to MIDI, and
> in which I don't need any timing or routing capability, is there any reason
> to use ALSA Rawmidi, as opposed to merely reading and writing the device via
> the file system? Which is the lower-level, and therefore most efficient,
> interface? I'm leaning toward the latter, because I already know how to use
> poll() to wait for incoming data on multiple input devices, but I don't see
> how to do that via Rawmidi.
>
ALSA Rawmidi is the same as doing read/write operations on the file
system. Rawmidi is a very thin, low-level interface to
/dev/snd/midiCxDx. There is no performance advantage of using one
approach over the other because they are the same thing.
You're probably better off using the API because it's likely to help you
avoid mistakes and it gives you easier access to the kernel ioctl() calls.
You can use snd_rawmidi_poll_descriptors() to access the raw file
descriptors for the midi device so that you can add to your other
polling descriptors.
-gabriel
More information about the Alsa-devel
mailing list