Question

Once I have the card number (for example hw:0) how can I get information and descriptions from the ALSA library? I would like ot access the data similar to what I can find in /proc/asound/cards, for example:

 0 [CinemaTM       ]: USB-Audio - Microsoft® LifeCam Cinema(TM)
                      Microsoft Microsoft® LifeCam Cinema(TM) at usb-spear-ehci.0-1.1, high speed

As I have multiple such "cards" in my system, info like "CinemaTM", "USB-Audio" and "usb-ehci.0-1.1" help me to recognize what I need to open for capture.

In a separate question I found out how to iterate over all the cards and capture devices in the system, now I'd like to retrieve information about those - but my first impression with the ALSA API is that it's quite big and cumbersome for a beginner to understand how do to things.

Was it helpful?

Solution

Open the card's control device (which is also named hw:0, but doesn't have subdevices), and call snd_ctl_card_info().

snd_ctl_card_info_get_id(): CinemaTM
snd_ctl_card_info_get_driver(): USB-Audio
snd_ctl_card_info_get_name(): Microsoft® LifeCam Cinema(TM)
snd_ctl_card_info_get_longname(): Microsoft Microsoft® ... at usb-...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top