DonSergio

I have code:

// ...
IXACTEngine* m_pXACTEngine
// ... create m_pXACEngine and so on
XACT_RUNTIME_PARAMETERS xactParams;
ZeroMemory(&xactParams, sizeof(xactParams));
/*
fill xactParams exclude
XACT_RUNTIME_PARAMETERS ::globalSettingsBufferSize; // == 0
XACT_RUNTIME_PARAMETERS ::globalSettingsFlags; // == 0
XACT_RUNTIME_PARAMETERS ::globalSettingsAllocAttributes; // == 0
*/
hr = m_pXACTEngine->Initialize(&xactParams);
if (SUCCEEDED(hr))
{
XACTVARIABLEINDEX xactSpeedOfSoundID =
m_pXACTEngine->GetGlobalVariableInde("SpeedOfSound");
// now xactSpeedOfSoundID == XACTVARIABLEINDEX_INVALID
XACTVARIABLEVALUE nSpeedOfSound = 0;
hr = m_pXACTEngine->GetGlobalVariable(xactSpeedOfSoundID, &nSpeedOfSound);
//...

but m_pXACTEngine->GetGlobalVariable crushed with access violation



Re: Game Technologies: Audio / XACT IXACTEngine::GetGlobalVariable crushed application

Robert Heitkamp - Microsoft

Can you provide a call stack for the access violation

You cannot set/query variables unless you have initialized the engine with a global settings filed (*.xgs). One is generated when you build an XACT project. The global settings file includes variables, RPCs, categories, and DSP presets. If you didn't provide a global settings file during engine initialization, you cannot access any of the data types (though it really shouldn't crash).






Re: Game Technologies: Audio / XACT IXACTEngine::GetGlobalVariable crushed application

DonSergio

call stack:

xactengine2_1.dll!0367ad78()
xactengine2_1.dll!0367bd91()
SoundManager.dll!CSoundManager::create(unsigned long dwLookAheadTime=4294967295, const char * pszGlobalSettings=0x0012fd18, unsigned int nDevId=4672226) Line 604 + 0x23 C++
...

Error report: Unhandled exception at 0x0367ad78 in <some application>: 0xC0000005: Access violation reading location 0x00000000.

>You cannot set/query variables
That is right... But I consider that GetGlobalVariable must return error code rather than crash...





Re: Game Technologies: Audio / XACT IXACTEngine::GetGlobalVariable crushed application

Robert Heitkamp - Microsoft

You need to pass in a pointer to the contents of your global settings file (*.xgs) when initializing the engine:

xactParams.pGlobalSettingsBuffer = pMyGlobalSettingsBuffer;
xactParams.globalSettingsBufferSize = myGlobalSettingsBufferSizeInBytes;

A global settings file is generated when you build your project in the xact gui / xactbld.