diff options
author | Chris Robinson <[email protected]> | 2011-06-14 04:02:58 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-06-14 04:02:58 -0700 |
commit | 53c5275aa4ea9c42d850cf3f2d9fe589a7c84924 (patch) | |
tree | 2de994091bfee13326534878ad4f770a1e36fe56 /Alc/alsa.c | |
parent | c93d7a1721dc8233d0a256c022ab55223c582062 (diff) |
Use a proper enum for the probe type
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r-- | Alc/alsa.c | 42 |
1 files changed, 23 insertions, 19 deletions
@@ -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; } } |