aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-21 11:53:45 -0700
committerChris Robinson <[email protected]>2009-10-21 11:53:45 -0700
commit9924cce4663a38f7c149c5e7c67766091170ad21 (patch)
treeea81174ae8c1b26d85aec70cb2b6a96815ea7656 /Alc/alsa.c
parentd3ecbd75affa0c42290c24a1cd82019e89ea3461 (diff)
Make sure the ALSA device list is reset if no cards are found
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r--Alc/alsa.c15
1 files changed, 4 insertions, 11 deletions
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);