diff options
author | Chris Robinson <[email protected]> | 2010-06-10 15:54:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-06-10 15:54:04 -0700 |
commit | 17e6840f928355611526dd5a20a77cc037b0c434 (patch) | |
tree | f6bdbd64d35df66ce42e3b52119f58fadfe5672e /Alc/winmm.c | |
parent | a1f987c016d61563c9f105646dc1fe2b8275894d (diff) |
Prevent multiple WinMM devices from getting the same name, as well
Diffstat (limited to 'Alc/winmm.c')
-rw-r--r-- | Alc/winmm.c | 18 |
1 files changed, 17 insertions, 1 deletions
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); } } |