diff options
author | Chris Robinson <[email protected]> | 2017-06-29 15:59:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-06-29 15:59:16 -0700 |
commit | d874b6bb275a42f841b146ee686e08bca36c6aa6 (patch) | |
tree | 8043b7a97a5dc19fdbef6df8759abb5f6365d846 /router | |
parent | 00694826ef5b2f410cdd9d8a2274b34ea86bffdf (diff) |
Don't assume the first driver has the default device
Diffstat (limited to 'router')
-rw-r--r-- | router/alc.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/router/alc.c b/router/alc.c index 1ea9df17..8f095fec 100644 --- a/router/alc.c +++ b/router/alc.c @@ -363,6 +363,19 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) } almtx_unlock(&EnumerationLock); } + else + { + int i; + for(i = 0;i < DriverListSize;i++) + { + if(DriverList[i].ALCVer >= MAKE_ALC_VER(1, 1) || + DriverList[i].alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + { + idx = i; + break; + } + } + } device = DriverList[idx].alcOpenDevice(devicename); if(device) @@ -683,10 +696,29 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum para return CaptureDevicesList.Names; case ALC_DEFAULT_DEVICE_SPECIFIER: + for(i = 0;i < DriverListSize;i++) + { + if(DriverList[i].ALCVer >= MAKE_ALC_VER(1, 1) || + DriverList[i].alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + return DriverList[i].alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + } + return ""; + case ALC_DEFAULT_ALL_DEVICES_SPECIFIER: + for(i = 0;i < DriverListSize;i++) + { + if(DriverList[i].alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) + return DriverList[i].alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + } + return ""; + case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER: - if(DriverListSize > 0) - return DriverList[0].alcGetString(NULL, param); + for(i = 0;i < DriverListSize;i++) + { + if(DriverList[i].ALCVer >= MAKE_ALC_VER(1, 1) || + DriverList[i].alcIsExtensionPresent(NULL, "ALC_EXT_CAPTURE")) + return DriverList[i].alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); + } return ""; default: @@ -772,6 +804,19 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, } almtx_unlock(&EnumerationLock); } + else + { + int i; + for(i = 0;i < DriverListSize;i++) + { + if(DriverList[i].ALCVer >= MAKE_ALC_VER(1, 1) || + DriverList[i].alcIsExtensionPresent(NULL, "ALC_EXT_CAPTURE")) + { + idx = i; + break; + } + } + } device = DriverList[idx].alcCaptureOpenDevice(devicename, frequency, format, buffersize); if(device) |