From 15e6821147746fcdd1e7d38e830677641669ff5d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 29 Jun 2017 08:35:21 -0700 Subject: [PATCH] Avoid unnecessary reenumeration in the router --- router/alc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/router/alc.c b/router/alc.c index 35912936..b15283fb 100644 --- a/router/alc.c +++ b/router/alc.c @@ -334,6 +334,10 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) ALCdevice *device; ALint idx = 0; + /* Prior to the enumeration extension, apps would hardcode these names as a + * quality hint for the wrapper driver. Ignore them since there's no sane + * way to map them. + */ if(devicename && (devicename[0] == '\0' || strcmp(devicename, "DirectSound3D") == 0 || strcmp(devicename, "DirectSound") == 0 || @@ -341,11 +345,13 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) devicename = NULL; if(devicename) { - (void)alcGetString(NULL, ALC_DEVICE_SPECIFIER); + if(!DevicesList.Names) + (void)alcGetString(NULL, ALC_DEVICE_SPECIFIER); idx = GetDriverIndexForName(&DevicesList, devicename); if(idx < 0) { - (void)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + if(!AllDevicesList.Names) + (void)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); idx = GetDriverIndexForName(&AllDevicesList, devicename); if(idx < 0) { @@ -739,7 +745,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, devicename = NULL; if(devicename) { - (void)alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); + if(!CaptureDevicesList.Names) + (void)alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); idx = GetDriverIndexForName(&CaptureDevicesList, devicename); if(idx < 0) { -- 2.11.4.GIT