aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r--Alc/alsa.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index 880211b9..e95d1ef5 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -1031,35 +1031,39 @@ void alc_alsa_deinit(void)
}
}
-void alc_alsa_probe(int type)
+void alc_alsa_probe(enum DevProbe type)
{
ALuint i;
if(!alsa_load())
return;
- if(type == DEVICE_PROBE)
- AppendDeviceList(alsaDevice);
- else if(type == ALL_DEVICE_PROBE)
+ switch(type)
{
- for(i = 0;i < numDevNames;++i)
- free(allDevNameMap[i].name);
+ case DEVICE_PROBE:
+ AppendDeviceList(alsaDevice);
+ break;
- free(allDevNameMap);
- allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames);
+ case ALL_DEVICE_PROBE:
+ for(i = 0;i < numDevNames;++i)
+ free(allDevNameMap[i].name);
- for(i = 0;i < numDevNames;++i)
- AppendAllDeviceList(allDevNameMap[i].name);
- }
- else if(type == CAPTURE_DEVICE_PROBE)
- {
- for(i = 0;i < numCaptureDevNames;++i)
- free(allCaptureDevNameMap[i].name);
+ free(allDevNameMap);
+ allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames);
- free(allCaptureDevNameMap);
- allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames);
+ for(i = 0;i < numDevNames;++i)
+ AppendAllDeviceList(allDevNameMap[i].name);
+ break;
+
+ case CAPTURE_DEVICE_PROBE:
+ for(i = 0;i < numCaptureDevNames;++i)
+ free(allCaptureDevNameMap[i].name);
- for(i = 0;i < numCaptureDevNames;++i)
- AppendCaptureDeviceList(allCaptureDevNameMap[i].name);
+ free(allCaptureDevNameMap);
+ allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames);
+
+ for(i = 0;i < numCaptureDevNames;++i)
+ AppendCaptureDeviceList(allCaptureDevNameMap[i].name);
+ break;
}
}