📄 xact.h
字号:
__inline HRESULT __stdcall IXACTEngine_GetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue)
{
return pEngine->GetGlobalVariable(nIndex, nValue);
}
#else // __cplusplus
__inline ULONG __stdcall IXACTEngine_AddRef(IXACTEngine* pEngine)
{
return pEngine->lpVtbl->AddRef(pEngine);
}
__inline ULONG __stdcall IXACTEngine_Release(IXACTEngine* pEngine)
{
return pEngine->lpVtbl->Release(pEngine);
}
#ifndef _XBOX
__inline HRESULT __stdcall IXACTEngine_GetRendererCount(IXACTEngine* pEngine, XACTINDEX* pnRendererCount)
{
return pEngine->lpVtbl->GetRendererCount(pEngine, pnRendererCount);
}
__inline HRESULT __stdcall IXACTEngine_GetRendererDetails(IXACTEngine* pEngine, XACTINDEX nRendererIndex, LPXACT_RENDERER_DETAILS pRendererDetails)
{
return pEngine->lpVtbl->GetRendererDetails(pEngine, nRendererIndex, pRendererDetails);
}
#endif
__inline HRESULT __stdcall IXACTEngine_Initialize(IXACTEngine* pEngine, const XACT_RUNTIME_PARAMETERS* pParams)
{
return pEngine->lpVtbl->Initialize(pEngine, pParams);
}
__inline HRESULT __stdcall IXACTEngine_ShutDown(IXACTEngine* pEngine)
{
return pEngine->lpVtbl->ShutDown(pEngine);
}
__inline HRESULT __stdcall IXACTEngine_DoWork(IXACTEngine* pEngine)
{
return pEngine->lpVtbl->DoWork(pEngine);
}
__inline HRESULT __stdcall IXACTEngine_CreateSoundBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank)
{
return pEngine->lpVtbl->CreateSoundBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank);
}
__inline HRESULT __stdcall IXACTEngine_CreateInMemoryWaveBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank)
{
return pEngine->lpVtbl->CreateInMemoryWaveBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank);
}
__inline HRESULT __stdcall IXACTEngine_CreateStreamingWaveBank(IXACTEngine* pEngine, const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank)
{
return pEngine->lpVtbl->CreateStreamingWaveBank(pEngine, pParms, ppWaveBank);
}
__inline HRESULT __stdcall IXACTEngine_RegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
{
return pEngine->lpVtbl->RegisterNotification(pEngine, pNotificationDesc);
}
__inline HRESULT __stdcall IXACTEngine_UnRegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
{
return pEngine->lpVtbl->UnRegisterNotification(pEngine, pNotificationDesc);
}
__inline XACTCATEGORY __stdcall IXACTEngine_GetCategory(IXACTEngine* pEngine, PCSTR szFriendlyName)
{
return pEngine->lpVtbl->GetCategory(pEngine, szFriendlyName);
}
__inline HRESULT __stdcall IXACTEngine_Stop(IXACTEngine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags)
{
return pEngine->lpVtbl->Stop(pEngine, nCategory, dwFlags);
}
__inline HRESULT __stdcall IXACTEngine_SetVolume(IXACTEngine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume)
{
return pEngine->lpVtbl->SetVolume(pEngine, nCategory, nVolume);
}
__inline HRESULT __stdcall IXACTEngine_Pause(IXACTEngine* pEngine, XACTCATEGORY nCategory, BOOL fPause)
{
return pEngine->lpVtbl->Pause(pEngine, nCategory, fPause);
}
__inline XACTVARIABLEINDEX __stdcall IXACTEngine_GetGlobalVariableIndex(IXACTEngine* pEngine, PCSTR szFriendlyName)
{
return pEngine->lpVtbl->GetGlobalVariableIndex(pEngine, szFriendlyName);
}
__inline HRESULT __stdcall IXACTEngine_SetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue)
{
return pEngine->lpVtbl->SetGlobalVariable(pEngine, nIndex, nValue);
}
__inline HRESULT __stdcall IXACTEngine_GetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue)
{
return pEngine->lpVtbl->GetGlobalVariable(pEngine, nIndex, nValue);
}
#endif // __cplusplus
//------------------------------------------------------------------------------
// XACT API's (these are deprecated and will be removed in a future release)
//------------------------------------------------------------------------------
#ifdef _XBOX
static const DWORD XACT_FLAG_API_CREATE_MANAGEDATA = 0x00000001;
static const DWORD XACT_FLAG_API_STOP_IMMEDIATE = 0x00000002;
STDAPI XACTInitialize(const XACT_RUNTIME_PARAMETERS* pParams);
STDAPI XACTShutDown(void);
STDAPI XACTDoWork(void);
STDAPI XACTCreateSoundBank(const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank);
STDAPI XACTCreateInMemoryWaveBank(const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank);
STDAPI XACTCreateStreamingWaveBank(const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank);
STDAPI XACTRegisterNotification(const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc);
STDAPI XACTUnRegisterNotification(const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc);
STDAPI_(XACTCATEGORY) XACTGetCategory(PCSTR szFriendlyName);
STDAPI XACTStop(XACTCATEGORY nCategory, DWORD dwFlags);
STDAPI XACTSetVolume(XACTCATEGORY nCategory, XACTVOLUME nVolume);
STDAPI XACTPause(XACTCATEGORY nCategory, BOOL fPause);
STDAPI_(XACTVARIABLEINDEX) XACTGetGlobalVariableIndex(PCSTR szFriendlyName);
STDAPI XACTSetGlobalVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue);
STDAPI XACTGetGlobalVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* pnValue);
#endif // #ifdef _XBOX
//------------------------------------------------------------------------------
// Create Engine
//------------------------------------------------------------------------------
// Flags used only in XACTCreateEngine below. These flags are valid but ignored
// when building for Xbox 360; to enable auditioning on that platform you must
// link explicitly to an auditioning version of the XACT static library.
static const DWORD XACT_FLAG_API_AUDITION_MODE = 0x00000001;
static const DWORD XACT_FLAG_API_DEBUG_MODE = 0x00000002;
STDAPI XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine);
#ifndef _XBOX
#if defined (UNICODE)
# define XACT_DEBUGENGINE_REGISTRY_KEY L"Software\\Microsoft\\XACT"
# define XACT_DEBUGENGINE_REGISTRY_VALUE L"DebugEngine"
#else
# define XACT_DEBUGENGINE_REGISTRY_KEY "Software\\Microsoft\\XACT"
# define XACT_DEBUGENGINE_REGISTRY_VALUE "DebugEngine"
#endif
#ifdef __cplusplus
__inline HRESULT __stdcall XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine)
{
HRESULT hr;
HKEY key;
DWORD data;
DWORD type = REG_DWORD;
DWORD dataSize = sizeof(DWORD);
BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE;
BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE;
// If neither the debug nor audition flags are set, see if the debug registry key is set
if(!debug && !audition &&
(RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS))
{
if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS)
{
if(data)
{
debug = TRUE;
}
}
RegCloseKey(key);
}
// Priority order: Audition, Debug, Retail
hr = CoCreateInstance(audition ? __uuidof(XACTAuditionEngine)
: (debug ? __uuidof(XACTDebugEngine) : __uuidof(XACTEngine)),
NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACTEngine), (void**)ppEngine);
// If debug engine does not exist fallback to retail version
if(FAILED(hr) && debug && !audition)
{
hr = CoCreateInstance(__uuidof(XACTEngine), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACTEngine), (void**)ppEngine);
}
return hr;
}
#else
__inline HRESULT __stdcall XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine)
{
HRESULT hr;
HKEY key;
DWORD data;
DWORD type = REG_DWORD;
DWORD dataSize = sizeof(DWORD);
BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE;
BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE;
// If neither the debug nor audition flags are set, see if the debug registry key is set
if(!debug && !audition &&
(RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS))
{
if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS)
{
if(data)
{
debug = TRUE;
}
}
RegCloseKey(key);
}
// Priority order: Audition, Debug, Retail
hr = CoCreateInstance(audition ? &CLSID_XACTAuditionEngine
: (debug ? &CLSID_XACTDebugEngine : &CLSID_XACTEngine),
NULL, CLSCTX_INPROC_SERVER, &IID_IXACTEngine, (void**)ppEngine);
// If debug engine does not exist fallback to retail version
if(FAILED(hr) && debug && !audition)
{
hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACTEngine, (void**)ppEngine);
}
return hr;
}
#endif // #ifdef __cplusplus
#endif // #ifndef _XBOX
//------------------------------------------------------------------------------
// XACT specific error codes
//------------------------------------------------------------------------------
#define FACILITY_XACTENGINE 0xAC7
#define XACTENGINEERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XACTENGINE, n)
#define XACTENGINE_E_OUTOFMEMORY E_OUTOFMEMORY // Out of memory
#define XACTENGINE_E_INVALIDARG E_INVALIDARG // Invalid arg
#define XACTENGINE_E_NOTIMPL E_NOTIMPL // Not implemented
#define XACTENGINE_E_FAIL E_FAIL // Unknown error
#define XACTENGINE_E_ALREADYINITIALIZED XACTENGINEERROR(0x001) // The engine is already initialized
#define XACTENGINE_E_NOTINITIALIZED XACTENGINEERROR(0x002) // The engine has not been initialized
#define XACTENGINE_E_EXPIRED XACTENGINEERROR(0x003) // The engine has expired (demo or pre-release version)
#define XACTENGINE_E_NONOTIFICATIONCALLBACK XACTENGINEERROR(0x004) // No notification callback
#define XACTENGINE_E_NOTIFICATIONREGISTERED XACTENGINEERROR(0x005) // Notification already registered
#define XACTENGINE_E_INVALIDUSAGE XACTENGINEERROR(0x006) // Invalid usage
#define XACTENGINE_E_INVALIDDATA XACTENGINEERROR(0x007) // Invalid data
#define XACTENGINE_E_INSTANCELIMITFAILTOPLAY XACTENGINEERROR(0x008) // Fail to play due to instance limit
#define XACTENGINE_E_NOGLOBALSETTINGS XACTENGINEERROR(0x009) // Global Settings not loaded
#define XACTENGINE_E_INVALIDVARIABLEINDEX XACTENGINEERROR(0x00a) // Invalid variable index
#define XACTENGINE_E_INVALIDCATEGORY XACTENGINEERROR(0x00b) // Invalid category
#define XACTENGINE_E_INVALIDCUEINDEX XACTENGINEERROR(0x00c) // Invalid cue index
#define XACTENGINE_E_INVALIDWAVEINDEX XACTENGINEERROR(0x00d) // Invalid wave index
#define XACTENGINE_E_INVALIDTRACKINDEX XACTENGINEERROR(0x00e) // Invalid track index
#define XACTENGINE_E_INVALIDSOUNDOFFSETORINDEX XACTENGINEERROR(0x00f) // Invalid sound offset or index
#define XACTENGINE_E_READFILE XACTENGINEERROR(0x010) // Error reading a file
#define XACTENGINE_E_UNKNOWNEVENT XACTENGINEERROR(0x011) // Unknown event type
#define XACTENGINE_E_INCALLBACK XACTENGINEERROR(0x012) // Invalid call of method of function from callback
#define XACTENGINE_E_NOWAVEBANK XACTENGINEERROR(0x013) // No wavebank exists for desired operation
#define XACTENGINE_E_SELECTVARIATION XACTENGINEERROR(0x014) // Unable to select a variation
#define XACTENGINE_E_MULTIPLEAUDITIONENGINES XACTENGINEERROR(0x015) // There can be only one audition engine
#define XACTENGINE_E_WAVEBANKNOTPREPARED XACTENGINEERROR(0x016) // The wavebank is not prepared
#define XACTENGINE_E_NORENDERER XACTENGINEERROR(0x017) // No audio device found on.
#define XACTENGINE_E_INVALIDENTRYCOUNT XACTENGINEERROR(0x018) // Invalid entry count for channel maps
#define XACTENGINE_E_SEEKTIMEBEYONDCUEEND XACTENGINEERROR(0x019) // Time offset for seeking is beyond the cue end.
#define XACTENGINE_E_AUDITION_WRITEFILE XACTENGINEERROR(0x101) // Error writing a file during auditioning
#define XACTENGINE_E_AUDITION_NOSOUNDBANK XACTENGINEERROR(0x102) // Missing a soundbank
#define XACTENGINE_E_AUDITION_INVALIDRPCINDEX XACTENGINEERROR(0x103) // Missing an RPC curve
#define XACTENGINE_E_AUDITION_MISSINGDATA XACTENGINEERROR(0x104) // Missing data for an audition command
#define XACTENGINE_E_AUDITION_UNKNOWNCOMMAND XACTENGINEERROR(0x105) // Unknown command
#define XACTENGINE_E_AUDITION_INVALIDDSPINDEX XACTENGINEERROR(0x106) // Missing a DSP parameter
#define XACTENGINE_E_AUDITION_MISSINGWAVE XACTENGINEERROR(0x107) // Wave does not exist in auditioned wavebank
#define XACTENGINE_E_AUDITION_CREATEDIRECTORYFAILED XACTENGINEERROR(0x108) // Failed to create a directory for streaming wavebank data
#define XACTENGINE_E_AUDITION_INVALIDSESSION XACTENGINEERROR(0x109) // Invalid audition session
#endif // #ifndef GUID_DEFS_ONLY
#endif // #ifndef _XACT_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -