Count the sound cards
#include <sys/asoundlib.h> int snd_cards ( void );
Use the -l asound option to qcc to link against this library.
The snd_cards() 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.
The number of sound cards.