[linux-audio-dev] PCM Device Enumeration

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] PCM Device Enumeration
From: Fred Gleason (fredg_AT_wava.com)
Date: Fri May 10 2002 - 16:02:59 EEST


Anyone out there know a good technique for getting an enumeration of all
available PCM devices? (This is using ALSA-0.9.0). Currently, I'm doing
something like:

for(i=0;i<MAX_CARDS;i++) {
        for(j=0;j<MAX_DEVS;j++) {
                sprintf(device,"plughw:%d,%d",i,j);
                if(snd_pcm_open(&handle,device,SND_PCM_PLAYBACK,0)==0) {
                        printf("%s exists\n",device);
                        snd_pcm_close(handle);
                }
        }
}

This works, but alsa-lib sprews messages out on stderr for every call to
snd_pcm_open that fails. UGLY! There's got to be a better way. Or is there
a way to tell alsa-lib to suppress error messages to stderr?

Any ideas?

Cheers!

|-------------------------------------------------------------------------|
|Frederick F. Gleason, Jr.|WAVA Radio - 105 FM |Voice: 1-(703)-807-2266 |
| Director of Engineering |1901 N. Moore Street| FAX: 1-(703)-807-2245 |
| |Arlington, VA 22209 | Web: http://www.wava.com|
|-------------------------------------------------------------------------|
| A general leading the State Department resembles a dragon commanding |
| ducks. |
| -- The New York Times, 1/20/1981 |
|-------------------------------------------------------------------------|


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri May 10 2002 - 16:34:57 EEST