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