From 17e6840f928355611526dd5a20a77cc037b0c434 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 10 Jun 2010 15:54:04 -0700 Subject: Prevent multiple WinMM devices from getting the same name, as well --- Alc/winmm.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Alc/winmm.c b/Alc/winmm.c index 747a250b..750cce40 100644 --- a/Alc/winmm.c +++ b/Alc/winmm.c @@ -70,7 +70,23 @@ static void ProbeDevices(void) if(waveInGetDevCaps(i, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { char name[1024]; - snprintf(name, sizeof(name), "%s via WaveIn", WaveInCaps.szPname); + ALuint count, j; + + count = 0; + do { + if(count == 0) + snprintf(name, sizeof(name), "%s via WaveIn", WaveInCaps.szPname); + else + snprintf(name, sizeof(name), "%s #%d via WaveIn", WaveInCaps.szPname, count+1); + count++; + + for(j = 0;j < i;j++) + { + if(strcmp(name, CaptureDeviceList[j]) == 0) + break; + } + } while(j != i); + CaptureDeviceList[i] = strdup(name); } } -- cgit v1.2.3