[alsa-devel] Device enumeration

Robert Billing bob at tnglwood.demon.co.uk
Mon Jun 10 11:05:13 CEST 2013


I am currently developing a package to play theatrical sound effects, 
which has two play channels that I want to be able to attach to two 
different ALSA devices. To allow the users, who are theatre directors 
and are *not* technical to do this I am trying to provide a drop-down 
list of play devices. I can get the raw devices by parsing either the 
output from aplay -L, or from /proc/asound. The problem comes with 
devices defined in .asoundrc. I have this in .asoundrc on the 
development system:

pcm.speakers {
     type pulse
     device alsa_output.pci-0000_02_06.0.analog-stereo
}

ctl.speakers {
     type pulse
     device alsa_output.pci-0000_02_06.0.analog-stereo
}

pcm.cans {
     type pulse
     device alsa_output.pci-0000_00_1f.5.analog-stereo
}

ctl.cans {
     type pulse
     device alsa_output.pci-0000_00_1f.5.analog-stereo
}

This works and it is possible to play to the devices "cans" or 
"speakers" to get output on headphones and speakers respectively, but 
these names don't appear in the output from aplay.

What I need is some clean way of getting a list of the aliases. This 
package will have to be capable of being installed on any Linux system 
without needing to edit configuration files manually. However if some 
tool or some part of the installation process has edited a configuration 
file I want the aliases to appear in my list of devices.

What is the right way to do this?

-- 
Robert Billing,

Phone/fax +44 (0) 1344-772849
bob at tnglwood.demon.co.uk

Tanglewood,
64, Pinehill Road,
Crowthorne,
Berks, RG45 7JR



More information about the Alsa-devel mailing list