alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "nick smethurst" <nick.smethurst@gmail.com>
To: alsa-devel@alsa-project.org
Subject: alsa-lib functions reporting conflicting information with two sound cards
Date: Thu, 19 Apr 2007 16:30:37 +0200	[thread overview]
Message-ID: <560009e30704190730q1047b43fh37f5df5fef9ec51f@mail.gmail.com> (raw)

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
devices.

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_config_update();

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

    snd_pcm_t * pcm;
    snd_pcm_info_t * pcm_info;
    snd_pcm_info_malloc(&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));
    snd_pcm_close(pcm);
    snd_pcm_info_free(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?

Regards

Nicholas

             reply	other threads:[~2007-04-19 14:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 14:30 nick smethurst [this message]
2007-04-19 15:46 ` alsa-lib functions reporting conflicting information with two sound cards Lee Revell
2007-04-19 18:08   ` Nicholas Smethurst
2007-04-19 18:45     ` Lee Revell
2007-05-11 10:28       ` Getting a full device list (was: alsa-lib functions reporting conflicting information with two sound cards) Nicholas Smethurst
2007-05-11 10:35         ` Jaroslav Kysela
2007-05-11 11:05           ` Getting a full device list Nicholas Smethurst
2007-05-11 11:46             ` Jaroslav Kysela
2007-05-11 15:13             ` Takashi Iwai
2007-05-11 17:01               ` Nicholas Smethurst
2007-05-14  8:36               ` Nicholas Smethurst
2007-05-14  9:18                 ` Takashi Iwai
2007-05-14  9:27                   ` Nicholas Smethurst
2007-05-14  9:57                     ` Takashi Iwai
2007-05-14 10:38                       ` Nicholas Smethurst
2007-05-14 12:55                         ` Takashi Iwai
2007-04-20 10:13     ` alsa-lib functions reporting conflicting information with two sound cards Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560009e30704190730q1047b43fh37f5df5fef9ec51f@mail.gmail.com \
    --to=nick.smethurst@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).