Count the sound cards and list their card numbers in an array
#include <sys/asoundlib.h> int snd_cards_list( int *cards, int card_array_size, int *cards_over );
- An array in which snd_cards_list() stores the card numbers.
- The number of card numbers that the array cards can hold.
- The number of cards that wouldn't fit in the cards array.
Use the -l asound option to qcc to link against this library.
The snd_cards_list() function returns the instantaneous number of sound cards that have running drivers. There's no guarantee that the sound cards have contiguous card numbers, and cards may be unmounted at any time.
You should use this function instead of snd_cards() because snd_cards_list() can fill in an array of card numbers. This overcomes the difficulties involved in hunting a (possibly) non-contiguous list of card numbers for active cards.
The number of sound cards.