From d02f5da414db6befdaff8f5a0580b9af2bdb7b75 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 14 Aug 2022 10:36:02 +0100 Subject: [PATCH 1/4] OpenAL enumeration fix Openal enumeration after default device loading. --- Engine/source/sfx/openal/aldlist.cpp | 169 ++++++++++++++++++++------- Engine/source/sfx/openal/aldlist.h | 10 +- 2 files changed, 133 insertions(+), 46 deletions(-) diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index 73307f50b..27d0f043a 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -1,17 +1,17 @@ /* * Copyright (c) 2006, Creative Labs Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided * that the following conditions are met: - * + * * * Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions * and the following disclaimer in the documentation and/or other materials provided with the distribution. * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR @@ -33,20 +33,20 @@ #include #endif -/* +/* * Init call */ -ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) +ALDeviceList::ALDeviceList(const OPENALFNTABLE& oalft) { - VECTOR_SET_ASSOCIATION( vDeviceInfo ); + VECTOR_SET_ASSOCIATION(vDeviceInfo); - ALDEVICEINFO ALDeviceInfo; - char *devices; - int index; - const char *defaultDeviceName; - const char *actualDeviceName; + ALDEVICEINFO ALDeviceInfo; + char* devices; + int index; + const char* defaultDeviceName; + const char* actualDeviceName; - dMemcpy( &ALFunction, &oalft, sizeof( OPENALFNTABLE ) ); + dMemcpy(&ALFunction, &oalft, sizeof(OPENALFNTABLE)); // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support vDeviceInfo.clear(); @@ -54,70 +54,69 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) defaultDeviceIndex = 0; - // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - const bool enumerationExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"); - const bool enumerateAllExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"); - 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); - } - + if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + { + devices = (char*)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); + defaultDeviceName = (char*)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); index = 0; - // go through device list (each device terminated with a single NULL, list terminated with double NULL) - while (*devices != 0) { - if (String::compare(defaultDeviceName, devices) == 0) { + while (*devices != NULL) + { + if (dStrcmp(defaultDeviceName, devices) == 0) + { defaultDeviceIndex = index; } - ALCdevice *device = ALFunction.alcOpenDevice(devices); - if (device) { - ALCcontext *context = ALFunction.alcCreateContext(device, NULL); - if (context) { + ALCdevice* device = ALFunction.alcOpenDevice(devices); + + if (device) + { + ALCcontext* context = ALFunction.alcCreateContext(device, NULL); + if (context) + { ALFunction.alcMakeContextCurrent(context); - // if new actual device name isn't already in the list, then add it... - actualDeviceName = devices; + + actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER); bool bNewName = true; for (int i = 0; i < GetNumDevices(); i++) { - if (String::compare(GetDeviceName(i), actualDeviceName) == 0) { + if (dStrcmp(GetDeviceName(i), actualDeviceName) == 0) { bNewName = false; } } - if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) { + + if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) + { dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDeviceInfo.bSelected = true; dStrncpy(ALDeviceInfo.strDeviceName, actualDeviceName, sizeof(ALDeviceInfo.strDeviceName)); + ALFunction.alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); ALFunction.alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); ALDeviceInfo.iCapsFlags = 0; - // Check for ALC Extensions if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALCapture; + if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEFX; - // Check for AL Extensions if (ALFunction.alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALOffset; if (ALFunction.alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALLinearDistance; + if (ALFunction.alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALExponentDistance; - + if (ALFunction.alIsExtensionPresent("EAX2.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX2; + if (ALFunction.alIsExtensionPresent("EAX3.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX3; + if (ALFunction.alIsExtensionPresent("EAX4.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX4; + if (ALFunction.alIsExtensionPresent("EAX5.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX5; @@ -128,6 +127,94 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) ALDeviceInfo.uiSourceCount = GetMaxNumSources(); vDeviceInfo.push_back(ALDeviceInfo); + + } + ALFunction.alcMakeContextCurrent(NULL); + ALFunction.alcDestroyContext(context); + } + ALFunction.alcCloseDevice(device); + } + devices += dStrlen(devices) + 1; + index += 1; + } + } + + index = 0; + + if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) + { + devices = (char*)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + defaultDeviceName = (char*)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + index = 0; + while (*devices != NULL) + { + if (dStrcmp(defaultDeviceName, devices) == 0) + { + defaultDeviceIndex = index; + } + ALCdevice* device = ALFunction.alcOpenDevice(devices); + + if (device) + { + ALCcontext* context = ALFunction.alcCreateContext(device, NULL); + if (context) + { + ALFunction.alcMakeContextCurrent(context); + + actualDeviceName = ALFunction.alcGetString(device, ALC_ALL_DEVICES_SPECIFIER); + bool bNewName = true; + for (int i = 0; i < GetNumDevices(); i++) { + if (dStrcmp(GetDeviceName(i), actualDeviceName) == 0) { + bNewName = false; + } + } + + if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) + { + dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); + ALDeviceInfo.bSelected = true; + dStrncpy(ALDeviceInfo.strDeviceName, actualDeviceName, sizeof(ALDeviceInfo.strDeviceName)); + + ALFunction.alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); + ALFunction.alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); + + ALDeviceInfo.iCapsFlags = 0; + + if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALCapture; + + if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEFX; + + if (ALFunction.alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALOffset; + + if (ALFunction.alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALLinearDistance; + + if (ALFunction.alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALExponentDistance; + + if (ALFunction.alIsExtensionPresent("EAX2.0") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEAX2; + + if (ALFunction.alIsExtensionPresent("EAX3.0") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEAX3; + + if (ALFunction.alIsExtensionPresent("EAX4.0") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEAX4; + + if (ALFunction.alIsExtensionPresent("EAX5.0") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEAX5; + + if (ALFunction.alIsExtensionPresent("EAX-RAM") == AL_TRUE) + ALDeviceInfo.iCapsFlags |= SFXALEAXRAM; + + // Get Source Count + ALDeviceInfo.uiSourceCount = GetMaxNumSources(); + + vDeviceInfo.push_back(ALDeviceInfo); + } ALFunction.alcMakeContextCurrent(NULL); ALFunction.alcDestroyContext(context); diff --git a/Engine/source/sfx/openal/aldlist.h b/Engine/source/sfx/openal/aldlist.h index 3b2d7e948..929cb3bf0 100644 --- a/Engine/source/sfx/openal/aldlist.h +++ b/Engine/source/sfx/openal/aldlist.h @@ -31,11 +31,11 @@ typedef struct { - char strDeviceName[256]; - S32 iMajorVersion; - S32 iMinorVersion; - U32 uiSourceCount; - S32 iCapsFlags; + char strDeviceName[256]; + S32 iMajorVersion; + S32 iMinorVersion; + U32 uiSourceCount; + S32 iCapsFlags; bool bSelected; } ALDEVICEINFO, *LPALDEVICEINFO; From 40066157234597dc438987acc6956433a89bfa11 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Tue, 16 Aug 2022 08:33:26 +0100 Subject: [PATCH 2/4] OpenAL Initialization -Device capabilities left until a device is actually selected and is loading -ALDEVICEINFO possibly no longer needed. -aldlist possibly no longer required as well. --- Engine/source/sfx/openal/LoadOAL.h | 13 ++ Engine/source/sfx/openal/aldlist.cpp | 218 ++++----------------- Engine/source/sfx/openal/aldlist.h | 12 +- Engine/source/sfx/openal/sfxALDevice.cpp | 213 +++++++++++++++++++- Engine/source/sfx/openal/sfxALDevice.h | 7 +- Engine/source/sfx/openal/sfxALProvider.cpp | 20 -- Engine/source/sfx/openal/win32/LoadOAL.cpp | 29 +++ 7 files changed, 306 insertions(+), 206 deletions(-) diff --git a/Engine/source/sfx/openal/LoadOAL.h b/Engine/source/sfx/openal/LoadOAL.h index 9b2792657..01455797a 100644 --- a/Engine/source/sfx/openal/LoadOAL.h +++ b/Engine/source/sfx/openal/LoadOAL.h @@ -165,6 +165,13 @@ typedef void (ALAPIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint effectslot, A typedef void (ALAPIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint effectslot, ALenum param, ALfloat *value); typedef void (ALAPIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint effectslot, ALenum param, ALfloat *values); typedef void (ALAPIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3); +// Changes for Filters. +typedef void (ALAPIENTRY* LPALGENFILTERS)(ALsizei n, ALuint* filter); +typedef void (ALAPIENTRY* LPALDELETEFILTERS)(ALsizei n, const ALuint* filters); +typedef void (ALAPIENTRY* LPALFILTERI)(ALuint filter , ALenum param, ALint value); +// Changes for HRTF +typedef const ALCchar* (ALCAPIENTRY* LPALCGETSTRINGISOFT)(ALCdevice* device, ALCenum param, ALint value1); + typedef struct { @@ -261,6 +268,12 @@ typedef struct LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf; LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv; #endif + LPALGENFILTERS alGenFilters; + LPALDELETEFILTERS alDeleteFilters; + LPALFILTERI alFilteri; + + LPALCGETSTRINGISOFT alcGetStringiSOFT; + } OPENALFNTABLE, *LPOPENALFNTABLE; #endif diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index 27d0f043a..3dafd01d9 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -1,17 +1,17 @@ /* * Copyright (c) 2006, Creative Labs Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided * that the following conditions are met: - * + * * * Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions * and the following disclaimer in the documentation and/or other materials provided with the distribution. * * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR @@ -33,20 +33,19 @@ #include #endif -/* +/* * Init call */ -ALDeviceList::ALDeviceList(const OPENALFNTABLE& oalft) +ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) { - VECTOR_SET_ASSOCIATION(vDeviceInfo); + VECTOR_SET_ASSOCIATION( vDeviceInfo ); - ALDEVICEINFO ALDeviceInfo; - char* devices; - int index; - const char* defaultDeviceName; - const char* actualDeviceName; + ALDEVICEINFO ALDeviceInfo; + char *devices; + int index; + const char *defaultDeviceName; - dMemcpy(&ALFunction, &oalft, sizeof(OPENALFNTABLE)); + dMemcpy( &ALFunction, &oalft, sizeof( OPENALFNTABLE ) ); // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support vDeviceInfo.clear(); @@ -54,176 +53,41 @@ ALDeviceList::ALDeviceList(const OPENALFNTABLE& oalft) defaultDeviceIndex = 0; - if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices + if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) { + 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; - while (*devices != NULL) - { - if (dStrcmp(defaultDeviceName, devices) == 0) - { - defaultDeviceIndex = index; - } - ALCdevice* device = ALFunction.alcOpenDevice(devices); - - if (device) - { - ALCcontext* context = ALFunction.alcCreateContext(device, NULL); - if (context) - { - ALFunction.alcMakeContextCurrent(context); - - actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER); - bool bNewName = true; - for (int i = 0; i < GetNumDevices(); i++) { - if (dStrcmp(GetDeviceName(i), actualDeviceName) == 0) { - bNewName = false; - } - } - - if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) - { - dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); - ALDeviceInfo.bSelected = true; - dStrncpy(ALDeviceInfo.strDeviceName, actualDeviceName, sizeof(ALDeviceInfo.strDeviceName)); - - ALFunction.alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); - ALFunction.alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); - - ALDeviceInfo.iCapsFlags = 0; - - if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALCapture; - - if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEFX; - - if (ALFunction.alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALOffset; - - if (ALFunction.alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALLinearDistance; - - if (ALFunction.alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALExponentDistance; - - if (ALFunction.alIsExtensionPresent("EAX2.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX2; - - if (ALFunction.alIsExtensionPresent("EAX3.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX3; - - if (ALFunction.alIsExtensionPresent("EAX4.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX4; - - if (ALFunction.alIsExtensionPresent("EAX5.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX5; - - if (ALFunction.alIsExtensionPresent("EAX-RAM") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAXRAM; - - // Get Source Count - ALDeviceInfo.uiSourceCount = GetMaxNumSources(); - - vDeviceInfo.push_back(ALDeviceInfo); - - } - ALFunction.alcMakeContextCurrent(NULL); - ALFunction.alcDestroyContext(context); - } - ALFunction.alcCloseDevice(device); - } - devices += dStrlen(devices) + 1; - index += 1; - } + devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); } index = 0; - - if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) - { - devices = (char*)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); - defaultDeviceName = (char*)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); - index = 0; - while (*devices != NULL) - { - if (dStrcmp(defaultDeviceName, devices) == 0) - { - defaultDeviceIndex = index; - } - ALCdevice* device = ALFunction.alcOpenDevice(devices); - - if (device) - { - ALCcontext* context = ALFunction.alcCreateContext(device, NULL); - if (context) - { - ALFunction.alcMakeContextCurrent(context); - - actualDeviceName = ALFunction.alcGetString(device, ALC_ALL_DEVICES_SPECIFIER); - bool bNewName = true; - for (int i = 0; i < GetNumDevices(); i++) { - if (dStrcmp(GetDeviceName(i), actualDeviceName) == 0) { - bNewName = false; - } - } - - if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) - { - dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); - ALDeviceInfo.bSelected = true; - dStrncpy(ALDeviceInfo.strDeviceName, actualDeviceName, sizeof(ALDeviceInfo.strDeviceName)); - - ALFunction.alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); - ALFunction.alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); - - ALDeviceInfo.iCapsFlags = 0; - - if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALCapture; - - if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEFX; - - if (ALFunction.alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALOffset; - - if (ALFunction.alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALLinearDistance; - - if (ALFunction.alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALExponentDistance; - - if (ALFunction.alIsExtensionPresent("EAX2.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX2; - - if (ALFunction.alIsExtensionPresent("EAX3.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX3; - - if (ALFunction.alIsExtensionPresent("EAX4.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX4; - - if (ALFunction.alIsExtensionPresent("EAX5.0") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAX5; - - if (ALFunction.alIsExtensionPresent("EAX-RAM") == AL_TRUE) - ALDeviceInfo.iCapsFlags |= SFXALEAXRAM; - - // Get Source Count - ALDeviceInfo.uiSourceCount = GetMaxNumSources(); - - vDeviceInfo.push_back(ALDeviceInfo); - - } - ALFunction.alcMakeContextCurrent(NULL); - ALFunction.alcDestroyContext(context); - } - ALFunction.alcCloseDevice(device); - } - devices += dStrlen(devices) + 1; - index += 1; + // go through device list (each device terminated with a single NULL, list terminated with double NULL) + while (*devices != 0) { + if (String::compare(defaultDeviceName, devices) == 0) { + defaultDeviceIndex = index; } + + bool bNewName = true; + for (int i = 0; i < GetNumDevices(); i++) { + if (String::compare(GetDeviceName(i), devices) == 0) { + bNewName = false; + } + } + + if ((bNewName) && (devices != NULL) && (dStrlen(devices) > 0)) + { + dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); + ALDeviceInfo.bSelected = true; + dStrncpy(ALDeviceInfo.strDeviceName, devices, sizeof(ALDeviceInfo.strDeviceName)); + vDeviceInfo.push_back(ALDeviceInfo); + } + + devices += dStrlen(devices) + 1; + index += 1; } ResetFilters(); diff --git a/Engine/source/sfx/openal/aldlist.h b/Engine/source/sfx/openal/aldlist.h index 929cb3bf0..fe52f68cd 100644 --- a/Engine/source/sfx/openal/aldlist.h +++ b/Engine/source/sfx/openal/aldlist.h @@ -31,12 +31,12 @@ typedef struct { - char strDeviceName[256]; - S32 iMajorVersion; - S32 iMinorVersion; - U32 uiSourceCount; - S32 iCapsFlags; - bool bSelected; + char strDeviceName[256]; + S32 iMajorVersion; + S32 iMinorVersion; + U32 uiSourceCount; + S32 iCapsFlags; + bool bSelected; } ALDEVICEINFO, *LPALDEVICEINFO; class ALDeviceList diff --git a/Engine/source/sfx/openal/sfxALDevice.cpp b/Engine/source/sfx/openal/sfxALDevice.cpp index 9dd308c58..111c92362 100644 --- a/Engine/source/sfx/openal/sfxALDevice.cpp +++ b/Engine/source/sfx/openal/sfxALDevice.cpp @@ -24,6 +24,201 @@ #include "sfx/openal/sfxALBuffer.h" #include "platform/async/asyncUpdate.h" +//---------------------------------------------------------------------------- +// STATIC OPENAL FUNCTIONS +//---------------------------------------------------------------------------- +void SFXALDevice::printALInfo(ALCdevice* device) +{ + ALCint major, minor; + if (device) + { + const ALCchar* devname = NULL; + Con::printBlankLine(); + + if (mOpenAL.alcIsExtensionPresent(device, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE) + { + devname = mOpenAL.alcGetString(device, ALC_ALL_DEVICES_SPECIFIER); + } + else + { + devname = mOpenAL.alcGetString(device, ALC_DEVICE_SPECIFIER); + } + + Con::printf("| Device info for: %s ", devname); + } + + mOpenAL.alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); + mOpenAL.alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor); + Con::printf("| OpenAL Version: %d.%d", major, minor); + + if (device) + { + Con::printf("%s", mOpenAL.alcGetString(device, ALC_EXTENSIONS)); + + U32 err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Retrieving ALC Extensions: %s", mOpenAL.alcGetString(device, err)); + } + +} + +void SFXALDevice::printHRTFInfo(ALCdevice* device) +{ + if (mOpenAL.alcIsExtensionPresent(device, "ALC_SOFT_HRTF") == AL_FALSE) + { + Con::printf("HRTF Extensions not compatible"); + return; + } + + ALCint numHrtfs; + + mOpenAL.alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &numHrtfs); + if (!numHrtfs) + Con::printf("No HRTFs Found"); + else + { + Con::printf("Available HRTFs"); + for (U32 i = 0; i < numHrtfs; ++i) + { + const ALCchar* name = mOpenAL.alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i); + printf(" %s", name); + } + } + + U32 err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Retrieving HRTF info: %s", mOpenAL.alcGetString(device, err)); + +} + +void SFXALDevice::getEFXInfo(ALCdevice *device) +{ + static const ALint filters[] = { + AL_FILTER_LOWPASS, AL_FILTER_HIGHPASS, AL_FILTER_BANDPASS, + AL_FILTER_NULL + }; + + char filterNames[] = "Low-pass,High-pass,Band-pass,"; + static const ALint effects[] = { + AL_EFFECT_EAXREVERB, AL_EFFECT_REVERB, AL_EFFECT_CHORUS, + AL_EFFECT_DISTORTION, AL_EFFECT_ECHO, AL_EFFECT_FLANGER, + AL_EFFECT_FREQUENCY_SHIFTER, AL_EFFECT_VOCAL_MORPHER, + AL_EFFECT_PITCH_SHIFTER, AL_EFFECT_RING_MODULATOR, + AL_EFFECT_AUTOWAH, AL_EFFECT_COMPRESSOR, AL_EFFECT_EQUALIZER, + AL_EFFECT_NULL + }; + static const ALint dedeffects[] = { + AL_EFFECT_DEDICATED_DIALOGUE, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, + AL_EFFECT_NULL + }; + char effectNames[] = "EAX Reverb,Reverb,Chorus,Distortion,Echo,Flanger," + "Frequency Shifter,Vocal Morpher,Pitch Shifter,Ring Modulator,Autowah," + "Compressor,Equalizer,Dedicated Dialog,Dedicated LFE,"; + + ALCint major, minor, sends; + ALuint obj; + + char* current; + U32 i; + + if (mOpenAL.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_FALSE) + { + Con::printf("SFXALDevice - EFX Not available."); + return; + } + + mOpenAL.alcGetIntegerv(device, ALC_EFX_MAJOR_VERSION, 1, &major); + mOpenAL.alcGetIntegerv(device, ALC_EFX_MINOR_VERSION, 1, &minor); + U32 err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Retrieving EFX Version: %s", mOpenAL.alcGetString(device, err)); + else + { + Con::printf("| EFX Version: %d.%d", major, minor); + } + + mOpenAL.alcGetIntegerv(device, ALC_MAX_AUXILIARY_SENDS, 1, &sends); + err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Retrieving Auxiliary Sends: %s", mOpenAL.alcGetString(device, err)); + else + { + Con::printf("| Max Aux Sends: %d", sends); + } + + mOpenAL.alGenFilters(1, &obj); + err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Generating filter: %s", mOpenAL.alcGetString(device, err)); + + current = filterNames; + for (i = 0; filters[i] != AL_FILTER_NULL; i++) + { + char* next = dStrchr(current, ','); + + mOpenAL.alFilteri(obj, AL_FILTER_TYPE, filters[i]); + if (mOpenAL.alGetError() != AL_NO_ERROR) + dMemmove(current, next + 1, strlen(next)); + else + current = next + 1; + } + + Con::printf("| Supported Filters: %s", filterNames); + + mOpenAL.alDeleteFilters(1, &obj); + + mOpenAL.alGenEffects(1, &obj); + err = mOpenAL.alcGetError(device); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Error Generating effects: %s", mOpenAL.alcGetString(device, err)); + + current = effectNames; + for (i = 0; effects[i] != AL_EFFECT_NULL; i++) + { + char* next = dStrchr(current, ','); + mOpenAL.alEffecti(obj, AL_FILTER_TYPE, effects[i]); + if (mOpenAL.alGetError() != AL_NO_ERROR) + dMemmove(current, next + 1, strlen(next)); + else + current = next + 1; + } + + if (mOpenAL.alcIsExtensionPresent(device, "ALC_EXT_DEDICATED")) + { + for (i = 0; dedeffects[i] != AL_EFFECT_NULL; i++) + { + char* next = dStrchr(current, ','); + mOpenAL.alEffecti(obj, AL_FILTER_TYPE, dedeffects[i]); + if (mOpenAL.alGetError() != AL_NO_ERROR) + dMemmove(current, next + 1, strlen(next)); + else + current = next + 1; + } + } + else + { + for (i = 0; dedeffects[i] != AL_EFFECT_NULL; i++) + { + char* next = dStrchr(current, ','); + dMemmove(current, next + 1, strlen(next)); + } + } + + Con::printf("| Supported Effects: %s", effectNames); + + mOpenAL.alDeleteEffects(1, &obj); +} + +S32 SFXALDevice::getMaxSources() +{ + // Clear AL Error Code + mOpenAL.alGetError(); + + ALCint nummono; + mOpenAL.alcGetIntegerv(mDevice, ALC_MONO_SOURCES, 1, &nummono); + + return nummono; +} //----------------------------------------------------------------------------- @@ -54,20 +249,24 @@ SFXALDevice::SFXALDevice( SFXProvider *provider, attribs[1] = 4; mDevice = mOpenAL.alcOpenDevice( name ); - mOpenAL.alcGetError( mDevice ); + U32 err = mOpenAL.alcGetError(mDevice); + if (err != ALC_NO_ERROR) + Con::errorf("SFXALDevice - Device Initialization Error: %s", mOpenAL.alcGetString(mDevice, err)); + if( mDevice ) { mContext = mOpenAL.alcCreateContext( mDevice, attribs ); if( mContext ) mOpenAL.alcMakeContextCurrent( mContext ); + #if defined(AL_ALEXT_PROTOTYPES) mOpenAL.alcGetIntegerv(mDevice, ALC_MAX_AUXILIARY_SENDS, 1, &iSends); #endif U32 err = mOpenAL.alcGetError( mDevice ); if( err != ALC_NO_ERROR ) - Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) ); + Con::errorf( "SFXALDevice - Context Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) ); } AssertFatal( mDevice != NULL && mContext != NULL, "Failed to create OpenAL device and/or context!" ); @@ -89,6 +288,16 @@ SFXALDevice::SFXALDevice( SFXProvider *provider, dMemset(effect, 0, sizeof(effect)); uLoop = 0; #endif + + printALInfo(mDevice); + printHRTFInfo(mDevice); + getEFXInfo(mDevice); + + mMaxBuffers = getMaxSources(); + + // this should be max sources. + Con::printf("| Max Sources: %d", mMaxBuffers); + } //----------------------------------------------------------------------------- diff --git a/Engine/source/sfx/openal/sfxALDevice.h b/Engine/source/sfx/openal/sfxALDevice.h index d6aa7ea82..f4d7374c6 100644 --- a/Engine/source/sfx/openal/sfxALDevice.h +++ b/Engine/source/sfx/openal/sfxALDevice.h @@ -53,7 +53,12 @@ class SFXALDevice : public SFXDevice typedef SFXDevice Parent; friend class SFXALVoice; // mDistanceFactor, mRolloffFactor - SFXALDevice( SFXProvider *provider, + void printALInfo(ALCdevice* device); + void printHRTFInfo(ALCdevice* device); + void getEFXInfo(ALCdevice* device); + S32 getMaxSources(); + + SFXALDevice( SFXProvider *provider, const OPENALFNTABLE &openal, String name, bool useHardware, diff --git a/Engine/source/sfx/openal/sfxALProvider.cpp b/Engine/source/sfx/openal/sfxALProvider.cpp index df4e4f206..5c8f90b48 100644 --- a/Engine/source/sfx/openal/sfxALProvider.cpp +++ b/Engine/source/sfx/openal/sfxALProvider.cpp @@ -100,26 +100,6 @@ void SFXALProvider::init() info->name = String( mALDL->GetDeviceName( i ) ); - S32 major, minor, eax = 0; - - mALDL->GetDeviceVersion( i, &major, &minor ); - - // Apologies for the blatent enum hack -patw - for( S32 j = SFXALEAX2; j < SFXALEAXRAM; j++ ) - eax += (int)mALDL->IsExtensionSupported( i, (SFXALCaps)j ); - - if( eax > 0 ) - { - eax += 2; // EAX support starts at 2.0 - dSprintf( temp, sizeof( temp ), "[EAX %d.0] %s", eax, ( mALDL->IsExtensionSupported( i, SFXALEAXRAM ) ? "EAX-RAM" : "" ) ); - } - else - dStrcpy( temp, "", 256 ); - - info->driver = String::ToString( deviceFormat, major, minor, temp ); - info->hasHardware = eax > 0; - info->maxBuffers = mALDL->GetMaxNumSources( i ); - mDeviceInfo.push_back( info ); } diff --git a/Engine/source/sfx/openal/win32/LoadOAL.cpp b/Engine/source/sfx/openal/win32/LoadOAL.cpp index f591c7477..14ad3f044 100644 --- a/Engine/source/sfx/openal/win32/LoadOAL.cpp +++ b/Engine/source/sfx/openal/win32/LoadOAL.cpp @@ -552,6 +552,35 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotiv' function address\n"); } lpOALFnTable->alSource3i = (LPALSOURCE3I)GetProcAddress(g_hOpenALDLL, "alSource3i"); + + lpOALFnTable->alGenFilters = (LPALGENFILTERS)GetProcAddress(g_hOpenALDLL, "alGenFilters"); + if (lpOALFnTable->alGenFilters == NULL) + { + OutputDebugStringA("Failed to retrieve 'alGenFilters' function address\n"); + return AL_FALSE; + } + + lpOALFnTable->alDeleteFilters = (LPALDELETEFILTERS)GetProcAddress(g_hOpenALDLL, "alDeleteFilters"); + if (lpOALFnTable->alGenFilters == NULL) + { + OutputDebugStringA("Failed to retrieve 'alDeleteFilters' function address\n"); + return AL_FALSE; + } + + lpOALFnTable->alFilteri = (LPALFILTERI)GetProcAddress(g_hOpenALDLL, "alFilteri"); + if (lpOALFnTable->alGenFilters == NULL) + { + OutputDebugStringA("Failed to retrieve 'alFilteri' function address\n"); + return AL_FALSE; + } + + lpOALFnTable->alcGetStringiSOFT = (LPALCGETSTRINGISOFT)GetProcAddress(g_hOpenALDLL, "alcGetStringiSOFT"); + if (lpOALFnTable->alcGetStringiSOFT == NULL) + { + OutputDebugStringA("Failed to retrieve 'alcGetStringiSOFT' function address\n"); + return AL_FALSE; + } + #endif return AL_TRUE; } From 52dc5cf3da1ff46e91564778642fe72f89a8183b Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Tue, 16 Aug 2022 11:02:36 +0100 Subject: [PATCH 3/4] Device Name -OpenAL wraps device name in brackets, if found return only device name. --- Engine/source/sfx/sfxSystem.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index 9c864842f..ffe5c6351 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -1264,7 +1264,16 @@ DefineEngineFunction( sfxGetAvailableDevices, const char*, (),, { const SFXDeviceInfo* info = deviceInfo[d]; const char *providerName = provider->getName().c_str(); - const char *infoName = info->name.c_str(); + char *infoName = (char*)info->name.c_str(); + char* openFind = dStrchr(&infoName[0], '('); + if (openFind) + { + infoName = openFind + 1; + char* closeFind = dStrchr(infoName, ')'); + if (closeFind) + (*closeFind) = '\0'; + } + dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers); ptr += dStrlen(ptr); From 3eca15cb3160c9f63d8911f0707ef7dac69149e4 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Tue, 16 Aug 2022 15:55:56 +0100 Subject: [PATCH 4/4] OpenAL Internal name -Now there is an internal name for openal and a default name for the device to be displayed --- Engine/source/sfx/openal/aldlist.cpp | 27 +++++++++++++++++++--- Engine/source/sfx/openal/aldlist.h | 2 ++ Engine/source/sfx/openal/sfxALDevice.cpp | 2 ++ Engine/source/sfx/openal/sfxALProvider.cpp | 3 ++- Engine/source/sfx/sfxProvider.h | 3 ++- Engine/source/sfx/sfxSystem.cpp | 10 +------- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index 3dafd01d9..c9a422050 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -82,7 +82,19 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) { dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDeviceInfo.bSelected = true; - dStrncpy(ALDeviceInfo.strDeviceName, devices, sizeof(ALDeviceInfo.strDeviceName)); + dStrncpy(ALDeviceInfo.strInternalDeviceName, devices, sizeof(ALDeviceInfo.strInternalDeviceName)); + char* openFind = dStrchr(devices, '('); + if (openFind) + { + devices = openFind + 1; + char* closeFind = dStrchr(devices, ')'); + if (closeFind) + (*closeFind) = '\0'; + + dStrncpy(ALDeviceInfo.strDeviceName, devices, sizeof(ALDeviceInfo.strDeviceName)); + + } + vDeviceInfo.push_back(ALDeviceInfo); } @@ -111,14 +123,23 @@ int ALDeviceList::GetNumDevices() /* * Returns the device name at an index in the complete device list */ -const char *ALDeviceList::GetDeviceName(int index) +const char *ALDeviceList::GetInternalDeviceName(int index) { if (index < GetNumDevices()) - return vDeviceInfo[index].strDeviceName; + return vDeviceInfo[index].strInternalDeviceName; else return NULL; } +const char* ALDeviceList::GetDeviceName(int index) +{ + if (index < GetNumDevices()) + return vDeviceInfo[index].strDeviceName; + else + return NULL; +} + + /* * Returns the major and minor version numbers for a device at a specified index in the complete list */ diff --git a/Engine/source/sfx/openal/aldlist.h b/Engine/source/sfx/openal/aldlist.h index fe52f68cd..7927914cf 100644 --- a/Engine/source/sfx/openal/aldlist.h +++ b/Engine/source/sfx/openal/aldlist.h @@ -32,6 +32,7 @@ typedef struct { char strDeviceName[256]; + char strInternalDeviceName[256]; S32 iMajorVersion; S32 iMinorVersion; U32 uiSourceCount; @@ -52,6 +53,7 @@ public: ~ALDeviceList (); S32 GetNumDevices(); const char *GetDeviceName(S32 index); + const char *GetInternalDeviceName(S32 index); void GetDeviceVersion(S32 index, S32 *major, S32 *minor); U32 GetMaxNumSources(S32 index); bool IsExtensionSupported(S32 index, SFXALCaps caps); diff --git a/Engine/source/sfx/openal/sfxALDevice.cpp b/Engine/source/sfx/openal/sfxALDevice.cpp index 111c92362..cab3ea99f 100644 --- a/Engine/source/sfx/openal/sfxALDevice.cpp +++ b/Engine/source/sfx/openal/sfxALDevice.cpp @@ -248,6 +248,8 @@ SFXALDevice::SFXALDevice( SFXProvider *provider, #endif attribs[1] = 4; + printALInfo(NULL); + mDevice = mOpenAL.alcOpenDevice( name ); U32 err = mOpenAL.alcGetError(mDevice); if (err != ALC_NO_ERROR) diff --git a/Engine/source/sfx/openal/sfxALProvider.cpp b/Engine/source/sfx/openal/sfxALProvider.cpp index 5c8f90b48..4f3e30aff 100644 --- a/Engine/source/sfx/openal/sfxALProvider.cpp +++ b/Engine/source/sfx/openal/sfxALProvider.cpp @@ -98,6 +98,7 @@ void SFXALProvider::init() { ALDeviceInfo* info = new ALDeviceInfo; + info->internalName = String( mALDL->GetInternalDeviceName( i ) ); info->name = String( mALDL->GetDeviceName( i ) ); mDeviceInfo.push_back( info ); @@ -121,7 +122,7 @@ SFXDevice *SFXALProvider::createDevice( const String& deviceName, bool useHardwa // Do we find one to create? if (info) - return new SFXALDevice(this, mOpenAL, info->name, useHardware, maxBuffers); + return new SFXALDevice(this, mOpenAL, info->internalName, useHardware, maxBuffers); return NULL; } diff --git a/Engine/source/sfx/sfxProvider.h b/Engine/source/sfx/sfxProvider.h index 7cf3408db..6382f92c5 100644 --- a/Engine/source/sfx/sfxProvider.h +++ b/Engine/source/sfx/sfxProvider.h @@ -35,6 +35,7 @@ class SFXDevice; struct SFXDeviceInfo { String driver; + String internalName; String name; bool hasHardware; S32 maxBuffers; @@ -121,4 +122,4 @@ class SFXProvider }; -#endif // _SFXPROVIDER_H_ \ No newline at end of file +#endif // _SFXPROVIDER_H_ diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index ffe5c6351..a08c05ab6 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -1265,15 +1265,7 @@ DefineEngineFunction( sfxGetAvailableDevices, const char*, (),, const SFXDeviceInfo* info = deviceInfo[d]; const char *providerName = provider->getName().c_str(); char *infoName = (char*)info->name.c_str(); - char* openFind = dStrchr(&infoName[0], '('); - if (openFind) - { - infoName = openFind + 1; - char* closeFind = dStrchr(infoName, ')'); - if (closeFind) - (*closeFind) = '\0'; - } - + dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers); ptr += dStrlen(ptr);