[alsa-devel] alsa-lib functions reporting conflicting information with two sound cards

nick smethurst nick.smethurst at gmail.com
Thu Apr 19 16:30:37 CEST 2007

Hey guys

I am rather confused that I am getting crossed information when
calling snd_names_list
and snd_pcm_info in order to gather information about pcm devices.

I have two sound cards in my development pc: RME Digi 96/8 PCI and an
onboard VIA 8237.

I'm trying to develop a piece of code that generates a list of objects
containing pcm device information, including information on virtual

My current idea is to use snd_names_list() to get a full list of
devices, and then get information about them by opening each device
and querying.

The bizzare thing is that snd_names_list() is returning comments that
do not agree with the associated device.

For example, given the following code:

#include <alsa/asoundlib.h>
int main()
    snd_devname_t * list;

    snd_names_list("pcm", &list);
    while (list) {
        if (!strcmp(list->name, "hw:0,0")) {
            printf("hw:0,0 comment: %s\n", list->comment);
        list = list->next;

    snd_pcm_t * pcm;
    snd_pcm_info_t * pcm_info;
    snd_pcm_open(&pcm, "hw:0,0", SND_PCM_STREAM_PLAYBACK, 0);
    snd_pcm_info(pcm, pcm_info);
    printf("id: %s\n", snd_pcm_info_get_id(pcm_info));

    return 0;

The result on my pc is:
    hw:0,0 comment: Physical Device - VIA 8237 (Duplex)
    id: Digi96 IEC958

So I'm apparently doing something very wrong here.

I would like to ask if there is an easier and more reliable way of
getting a list of pcm devices and querying them, and if not, what I am
doing wrong here?



More information about the Alsa-devel mailing list