diff options
author | Chris Robinson <[email protected]> | 2009-08-27 06:09:33 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-08-27 06:09:33 -0700 |
commit | bb121e68a618d1881a6e35c47938ce0650d07afb (patch) | |
tree | 620e024aa067cc96d36a91e2210beffc2115220e /Alc/winmm.c | |
parent | 1ec26fd789ddfcbabbeae003f286cc01062721c0 (diff) |
Rebuild device lists when retrieving them
Diffstat (limited to 'Alc/winmm.c')
-rw-r--r-- | Alc/winmm.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/Alc/winmm.c b/Alc/winmm.c index 1f62f5a1..67865f26 100644 --- a/Alc/winmm.c +++ b/Alc/winmm.c @@ -425,17 +425,37 @@ BackendFuncs WinMMFuncs = { void alcWinMMInit(BackendFuncs *FuncList) { + *FuncList = WinMMFuncs; +} + +void alcWinMMDeinit() +{ ALuint lLoop; - *FuncList = WinMMFuncs; + for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++) + free(CaptureDeviceList[lLoop]); + free(CaptureDeviceList); + CaptureDeviceList = NULL; + + NumCaptureDevices = 0; +} + +void alcWinMMProbe(ALCboolean capture) +{ + ALuint lLoop; + + if(type != CAPTURE_DEVICE_PROBE) + return; + + for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++) + free(CaptureDeviceList[lLoop]); NumCaptureDevices = waveInGetNumDevs(); - CaptureDeviceList = malloc(sizeof(ALCchar*) * NumCaptureDevices); + CaptureDeviceList = realloc(CaptureDeviceList, sizeof(ALCchar*) * NumCaptureDevices); for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++) { WAVEINCAPS WaveInCaps; - CaptureDeviceList[lLoop] = strdup(""); if(waveInGetDevCaps(lLoop, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { char name[128]; @@ -443,17 +463,7 @@ void alcWinMMInit(BackendFuncs *FuncList) AppendCaptureDeviceList(name); CaptureDeviceList[lLoop] = strdup(name); } + else + CaptureDeviceList[lLoop] = strdup(""); } } - -void alcWinMMDeinit() -{ - ALuint lLoop; - - for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++) - free(CaptureDeviceList[lLoop]); - free(CaptureDeviceList); - CaptureDeviceList = NULL; - - NumCaptureDevices = 0; -} |