[alsa-devel] How to cont the sound cards?

Takashi Iwai tiwai at suse.de
Mon Nov 26 11:41:10 CET 2007


At Mon, 26 Nov 2007 12:53:52 +0200,
Cosmin Humeniuc wrote:
> 
> Thank you for the reply, Takashi.
> 
> The problem is, I'm not sure what should I loop through. I saw this
> list on the wiki (
> http://www.alsa-project.org/main/index.php/DeviceNames ) but I don't
> know how it was obtained.

The code would be like:

	int card = -1;
	while (!snd_card_next(&card) && card >= 0) {
		...
	}

Takashi


> 
> Cosmin
> 
> On 11/23/07, Takashi Iwai <tiwai at suse.de> wrote:
> > At Mon, 19 Nov 2007 09:12:51 +0200,
> > Cosmin Humeniuc wrote:
> > >
> > > Hi,
> > >
> > > I am trying to develop an application using the ALSA library. I read
> > > in a book about the snd_cards function, but it doesn't seem to be
> > > defined anywhere. (The book is rather old, though, it talks about the
> > > 0.5.x series).
> > >
> > > The compiler doesn't complain, but the linker gives me an "undefined
> > > reference to `snd_cards'" error. I assume this function is deprecated,
> > > but what can I use instead?
> >
> > Oh that myth.  I myself already forgot about that function :)
> >
> > On ALSA 1.x, there is no corresponding function.  You'll need to
> > loop and check the presence of each card.
> >
> >
> > Takashi
> >
> 


More information about the Alsa-devel mailing list