* Rawmidi vs. /dev/snd/*
@ 2012-04-01 6:25 Paul D. DeRocco
2012-04-02 5:21 ` Gabriel M. Beddingfield
0 siblings, 1 reply; 3+ messages in thread
From: Paul D. DeRocco @ 2012-04-01 6:25 UTC (permalink / raw)
To: Alsa-devel
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.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Rawmidi vs. /dev/snd/*
2012-04-01 6:25 Rawmidi vs. /dev/snd/* Paul D. DeRocco
@ 2012-04-02 5:21 ` Gabriel M. Beddingfield
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel M. Beddingfield @ 2012-04-02 5:21 UTC (permalink / raw)
To: Paul D. DeRocco; +Cc: Alsa-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4F7995F2.9040508@gmail.com>]
* Re: Rawmidi vs. /dev/snd/*
[not found] <4F7995F2.9040508@gmail.com>
@ 2012-04-02 17:02 ` Paul D. DeRocco
0 siblings, 0 replies; 3+ messages in thread
From: Paul D. DeRocco @ 2012-04-02 17:02 UTC (permalink / raw)
To: 'Gabriel M. Beddingfield', Alsa-devel
> From: Gabriel M. Beddingfield [mailto:gabrbedd@gmail.com]
>
> It would be a good idea for you to check out the alsa-lib sources and
> snoop around in the src/rawmidi/ folder.
>
> In reality, only one file descriptor is returned by
> snd_rawmidi_poll_descriptors(). However, the API returns an array so
> that it can expand in the future without having to recompile programs
> linked to the library.
>
> Yes, the ALSA documentation sucks. But I assure you that if
> you try to
> use the raw kernel interface... the documentation is worse. :-)
Since ALSA is big an complicated, and since my embedded system will probably
be based on SALSA, I downloaded that source, which is comparatively simple
(hence the S, I guess). It makes it clear what's going on: the RawMidi
handle already contains a pollfd for its internal use, and
snd_rawmidi_poll_descriptors makes that available to the app.
Thanks for your time.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-02 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-01 6:25 Rawmidi vs. /dev/snd/* Paul D. DeRocco
2012-04-02 5:21 ` Gabriel M. Beddingfield
[not found] <4F7995F2.9040508@gmail.com>
2012-04-02 17:02 ` Paul D. DeRocco
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).