From 9924cce4663a38f7c149c5e7c67766091170ad21 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 21 Oct 2009 11:53:45 -0700 Subject: Make sure the ALSA device list is reset if no cards are found --- Alc/alsa.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'Alc') diff --git a/Alc/alsa.c b/Alc/alsa.c index f8ad0b78..a4c23df9 100644 --- a/Alc/alsa.c +++ b/Alc/alsa.c @@ -944,16 +944,15 @@ void alc_alsa_probe(int type) psnd_ctl_card_info_malloc(&info); psnd_pcm_info_malloc(&pcminfo); + card = -1; + if((err=psnd_card_next(&card)) < 0) + AL_PRINT("Failed to find a card: %s\n", psnd_strerror(err)); + if(type == DEVICE_PROBE) AppendDeviceList(alsaDevice); else if(type == ALL_DEVICE_PROBE) { stream = SND_PCM_STREAM_PLAYBACK; - card = -1; - if(psnd_card_next(&card) < 0 || card < 0) { - AL_PRINT("no playback cards found...\n"); - goto out; - } for(i = 0;i < numDevNames;++i) free(allDevNameMap[i].name); @@ -1021,11 +1020,6 @@ void alc_alsa_probe(int type) else if(type == CAPTURE_DEVICE_PROBE) { stream = SND_PCM_STREAM_CAPTURE; - card = -1; - if(psnd_card_next(&card) < 0 || card < 0) { - AL_PRINT("no capture cards found...\n"); - goto out; - } for(i = 0;i < numCaptureDevNames;++i) free(allCaptureDevNameMap[i].name); @@ -1089,7 +1083,6 @@ void alc_alsa_probe(int type) numCaptureDevNames = idx; } -out: psnd_pcm_info_free(pcminfo); psnd_ctl_card_info_free(info); -- cgit v1.2.3