[alsa-devel] Get sound card available channels

Dan Hordern dh.mailing.lists at gmail.com
Thu Sep 25 02:39:59 CEST 2014


Hi,

We have a need for our process to poll/monitor the sound cards. This
process needs to provide a unique id for the sound card (e.g. some concat
of name+hardware address) which we can get using snd_ctl_t handle.

However, we also need to provide the number or rx/tx channels each sound
card provides. Doing this using the pcm hw_params after snd_pcm_open won't
work as the device may be in use.

Is there a way for this process to get the number of rx/tx channels without
needing to 'open' the device, e.g. using the snd_ctl_t handle?

One observation I have made is that there is a proc file ( cat
/proc/asound/card1/stream0) that seems to only be populated by the USB
soundcards I have and not the Intel builtin. This has all the information I
require but if it isn't a standard file we can't rely on it.

Thanks


More information about the Alsa-devel mailing list