>What is a difference between an ASCII identifier "plughw:0,0"
>and "hw:0,0"? And what the output of 'aplay -L' means?

a "hw" device is totally constrained by the hardware characteristics
of the underlying audio interface. if the device has 26 channels, then
it must be used with 26 channels; if it only supports interleaved
access, it must be used with interleaved access; if it doesn't support
16 bit output, you can't use it with 16 bit output.

a "plug" device is unconstrained by all this. you can ask for any
configuration you want, and ALSA will provide it for you.

a "plughw" device is a slightly specialized version of a "plug"
device, differing only in that the underlying PCM device being
accessed is of type "hw". it has the same freedom as a "plug" device
in all other ways.

as a programmer, you do not need to worry about any of this. honest.

>I just want to know a number of installed sound cards
>and number of subdevices for every card and I'd like
>to have a possibility to open the right card and a subdevice
>according user's choice. I think that ALSA-0.5 interface was
>much better in these things...

well, most of us disagree with you, and some of us, rather vigorously.

in ALSA 0.9, you do not attempt to "scan all cards and pick
one". this is something that cannot be done reliably or usefully in
many situations.

you allow the user to specify the *name* of a PCM device they wish to
use. these names correspond to entries in their ~/.asoundrc file, and
may contain configurations that your program can't even imagine. 

case in point: my machine has (sometimes): 2 Hammerfall cards, 1
Trident 4D-NX card, 1 Tropez+. The tropez audio playback is currently
broken, so i never use it for that (but it has a decent wavetable
synth and 2 MIDI ports); the hammerfall outputs are semi-permanently
wired to my mixer and the the inputs of everything are up on a patch
bay. occasionally, i run both hammerfalls as a single PCM device at
96kHz, more often as two separate devices.

you will not be able to write a user friendly configuration program
for my system. you can't do it in general, because the ALSA "plug"
layer offers a totally flexible layer that allows an audio interface
to appear to have any characteristics that you want.

instead, just let your program take it from a user that when they tell
it to use the ALSA PCM device "foo" that they know what they're
doing. if the user does not specify a name, use "default" and it will
work 99.8% of the time. the current setup of the "default" device is a
"plughw" device using the first audio interface. it will work with any
sample rate, any sample format, any type of access (interleaved,
noninterleaved, read/write or mmap).

--p






_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to