Prevent multiple WinMM devices from getting the same name, as well

This commit is contained in:
Chris Robinson 2010-06-10 15:54:04 -07:00
parent a1f987c016
commit 17e6840f92

View File

@ -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);
}
}