mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
OpenAL Internal name
-Now there is an internal name for openal and a default name for the device to be displayed
This commit is contained in:
parent
52dc5cf3da
commit
3eca15cb31
6 changed files with 33 additions and 14 deletions
|
|
@ -82,7 +82,19 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft )
|
||||||
{
|
{
|
||||||
dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
|
dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
|
||||||
ALDeviceInfo.bSelected = true;
|
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);
|
vDeviceInfo.push_back(ALDeviceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,14 +123,23 @@ int ALDeviceList::GetNumDevices()
|
||||||
/*
|
/*
|
||||||
* Returns the device name at an index in the complete device list
|
* 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())
|
if (index < GetNumDevices())
|
||||||
return vDeviceInfo[index].strDeviceName;
|
return vDeviceInfo[index].strInternalDeviceName;
|
||||||
else
|
else
|
||||||
return NULL;
|
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
|
* Returns the major and minor version numbers for a device at a specified index in the complete list
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char strDeviceName[256];
|
char strDeviceName[256];
|
||||||
|
char strInternalDeviceName[256];
|
||||||
S32 iMajorVersion;
|
S32 iMajorVersion;
|
||||||
S32 iMinorVersion;
|
S32 iMinorVersion;
|
||||||
U32 uiSourceCount;
|
U32 uiSourceCount;
|
||||||
|
|
@ -52,6 +53,7 @@ public:
|
||||||
~ALDeviceList ();
|
~ALDeviceList ();
|
||||||
S32 GetNumDevices();
|
S32 GetNumDevices();
|
||||||
const char *GetDeviceName(S32 index);
|
const char *GetDeviceName(S32 index);
|
||||||
|
const char *GetInternalDeviceName(S32 index);
|
||||||
void GetDeviceVersion(S32 index, S32 *major, S32 *minor);
|
void GetDeviceVersion(S32 index, S32 *major, S32 *minor);
|
||||||
U32 GetMaxNumSources(S32 index);
|
U32 GetMaxNumSources(S32 index);
|
||||||
bool IsExtensionSupported(S32 index, SFXALCaps caps);
|
bool IsExtensionSupported(S32 index, SFXALCaps caps);
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,8 @@ SFXALDevice::SFXALDevice( SFXProvider *provider,
|
||||||
#endif
|
#endif
|
||||||
attribs[1] = 4;
|
attribs[1] = 4;
|
||||||
|
|
||||||
|
printALInfo(NULL);
|
||||||
|
|
||||||
mDevice = mOpenAL.alcOpenDevice( name );
|
mDevice = mOpenAL.alcOpenDevice( name );
|
||||||
U32 err = mOpenAL.alcGetError(mDevice);
|
U32 err = mOpenAL.alcGetError(mDevice);
|
||||||
if (err != ALC_NO_ERROR)
|
if (err != ALC_NO_ERROR)
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ void SFXALProvider::init()
|
||||||
{
|
{
|
||||||
ALDeviceInfo* info = new ALDeviceInfo;
|
ALDeviceInfo* info = new ALDeviceInfo;
|
||||||
|
|
||||||
|
info->internalName = String( mALDL->GetInternalDeviceName( i ) );
|
||||||
info->name = String( mALDL->GetDeviceName( i ) );
|
info->name = String( mALDL->GetDeviceName( i ) );
|
||||||
|
|
||||||
mDeviceInfo.push_back( info );
|
mDeviceInfo.push_back( info );
|
||||||
|
|
@ -121,7 +122,7 @@ SFXDevice *SFXALProvider::createDevice( const String& deviceName, bool useHardwa
|
||||||
|
|
||||||
// Do we find one to create?
|
// Do we find one to create?
|
||||||
if (info)
|
if (info)
|
||||||
return new SFXALDevice(this, mOpenAL, info->name, useHardware, maxBuffers);
|
return new SFXALDevice(this, mOpenAL, info->internalName, useHardware, maxBuffers);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class SFXDevice;
|
||||||
struct SFXDeviceInfo
|
struct SFXDeviceInfo
|
||||||
{
|
{
|
||||||
String driver;
|
String driver;
|
||||||
|
String internalName;
|
||||||
String name;
|
String name;
|
||||||
bool hasHardware;
|
bool hasHardware;
|
||||||
S32 maxBuffers;
|
S32 maxBuffers;
|
||||||
|
|
@ -121,4 +122,4 @@ class SFXProvider
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _SFXPROVIDER_H_
|
#endif // _SFXPROVIDER_H_
|
||||||
|
|
|
||||||
|
|
@ -1265,15 +1265,7 @@ DefineEngineFunction( sfxGetAvailableDevices, const char*, (),,
|
||||||
const SFXDeviceInfo* info = deviceInfo[d];
|
const SFXDeviceInfo* info = deviceInfo[d];
|
||||||
const char *providerName = provider->getName().c_str();
|
const char *providerName = provider->getName().c_str();
|
||||||
char *infoName = (char*)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);
|
dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers);
|
||||||
|
|
||||||
ptr += dStrlen(ptr);
|
ptr += dStrlen(ptr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue