mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Merge pull request #601 from Ragora/bugfix-audio-devices
* BugFix: Fix AL device listing
This commit is contained in:
commit
dc9899907b
1 changed files with 16 additions and 5 deletions
|
|
@ -55,9 +55,20 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft )
|
||||||
defaultDeviceIndex = 0;
|
defaultDeviceIndex = 0;
|
||||||
|
|
||||||
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices
|
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices
|
||||||
if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
|
const bool enumerationExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT");
|
||||||
devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
const bool enumerateAllExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT");
|
||||||
defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
if (enumerateAllExtensionPresent || enumerationExtensionPresent) {
|
||||||
|
if (enumerateAllExtensionPresent)
|
||||||
|
{
|
||||||
|
devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
|
defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||||
|
defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||||
while (*devices != 0) {
|
while (*devices != 0) {
|
||||||
|
|
@ -70,7 +81,7 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft )
|
||||||
if (context) {
|
if (context) {
|
||||||
ALFunction.alcMakeContextCurrent(context);
|
ALFunction.alcMakeContextCurrent(context);
|
||||||
// if new actual device name isn't already in the list, then add it...
|
// if new actual device name isn't already in the list, then add it...
|
||||||
actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER);
|
actualDeviceName = devices;
|
||||||
bool bNewName = true;
|
bool bNewName = true;
|
||||||
for (int i = 0; i < GetNumDevices(); i++) {
|
for (int i = 0; i < GetNumDevices(); i++) {
|
||||||
if (String::compare(GetDeviceName(i), actualDeviceName) == 0) {
|
if (String::compare(GetDeviceName(i), actualDeviceName) == 0) {
|
||||||
|
|
@ -313,4 +324,4 @@ unsigned int ALDeviceList::GetMaxNumSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
return iSourceCount;
|
return iSourceCount;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue