Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1551 lines
75 KiB

  1. /**************************************************************************
  2. *
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. *
  5. * Module Name:
  6. *
  7. * xact3.h
  8. *
  9. * Abstract:
  10. *
  11. * XACT public interfaces, functions and data types
  12. *
  13. **************************************************************************/
  14. #pragma once
  15. #ifndef _XACT3_H_
  16. #define _XACT3_H_
  17. //------------------------------------------------------------------------------
  18. // XACT class and interface IDs (Version 3.7)
  19. //------------------------------------------------------------------------------
  20. #ifndef _XBOX // XACT COM support only exists on Windows
  21. #include <comdecl.h> // For DEFINE_CLSID, DEFINE_IID and DECLARE_INTERFACE
  22. DEFINE_CLSID(XACTEngine, bcc782bc, 6492, 4c22, 8c, 35, f5, d7, 2f, e7, 3c, 6e);
  23. DEFINE_CLSID(XACTAuditionEngine, 9ecdd80d, 0e81, 40d8, 89, 03, 2b, f7, b1, 31, ac, 43);
  24. DEFINE_CLSID(XACTDebugEngine, 02860630, bf3b, 42a8, b1, 4e, 91, ed, a2, f5, 1e, a5);
  25. DEFINE_IID(IXACT3Engine, b1ee676a, d9cd, 4d2a, 89, a8, fa, 53, eb, 9e, 48, 0b);
  26. #endif
  27. // Ignore the rest of this header if only the GUID definitions were requested:
  28. #ifndef GUID_DEFS_ONLY
  29. //------------------------------------------------------------------------------
  30. // Includes
  31. //------------------------------------------------------------------------------
  32. #ifndef _XBOX
  33. #include <windows.h>
  34. #include <objbase.h>
  35. #include <float.h>
  36. #endif
  37. #include <limits.h>
  38. #include <xact3wb.h>
  39. #include <xaudio2.h>
  40. //------------------------------------------------------------------------------
  41. // Forward Declarations
  42. //------------------------------------------------------------------------------
  43. typedef struct IXACT3SoundBank IXACT3SoundBank;
  44. typedef struct IXACT3WaveBank IXACT3WaveBank;
  45. typedef struct IXACT3Cue IXACT3Cue;
  46. typedef struct IXACT3Wave IXACT3Wave;
  47. typedef struct IXACT3Engine IXACT3Engine;
  48. typedef struct XACT_NOTIFICATION XACT_NOTIFICATION;
  49. //------------------------------------------------------------------------------
  50. // Typedefs
  51. //------------------------------------------------------------------------------
  52. typedef WORD XACTINDEX; // All normal indices
  53. typedef BYTE XACTNOTIFICATIONTYPE; // Notification type
  54. typedef FLOAT XACTVARIABLEVALUE; // Variable value
  55. typedef WORD XACTVARIABLEINDEX; // Variable index
  56. typedef WORD XACTCATEGORY; // Sound category
  57. typedef BYTE XACTCHANNEL; // Audio channel
  58. typedef FLOAT XACTVOLUME; // Volume value
  59. typedef LONG XACTTIME; // Time (in ms)
  60. typedef SHORT XACTPITCH; // Pitch value
  61. typedef BYTE XACTLOOPCOUNT; // For all loops / recurrences
  62. typedef BYTE XACTVARIATIONWEIGHT; // Variation weight
  63. typedef BYTE XACTPRIORITY; // Sound priority
  64. typedef BYTE XACTINSTANCELIMIT; // Instance limitations
  65. //------------------------------------------------------------------------------
  66. // Standard win32 multimedia definitions
  67. //------------------------------------------------------------------------------
  68. #ifndef WAVE_FORMAT_IEEE_FLOAT
  69. #define WAVE_FORMAT_IEEE_FLOAT 0x0003
  70. #endif
  71. #ifndef WAVE_FORMAT_EXTENSIBLE
  72. #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
  73. #endif
  74. #ifndef _WAVEFORMATEX_
  75. #define _WAVEFORMATEX_
  76. #pragma pack(push, 1)
  77. typedef struct tWAVEFORMATEX
  78. {
  79. WORD wFormatTag; // format type
  80. WORD nChannels; // number of channels (i.e. mono, stereo...)
  81. DWORD nSamplesPerSec; // sample rate
  82. DWORD nAvgBytesPerSec; // for buffer estimation
  83. WORD nBlockAlign; // block size of data
  84. WORD wBitsPerSample; // Number of bits per sample of mono data
  85. WORD cbSize; // The count in bytes of the size of extra information (after cbSize)
  86. } WAVEFORMATEX, *PWAVEFORMATEX;
  87. typedef WAVEFORMATEX NEAR *NPWAVEFORMATEX;
  88. typedef WAVEFORMATEX FAR *LPWAVEFORMATEX;
  89. #pragma pack(pop)
  90. #endif
  91. #ifndef _WAVEFORMATEXTENSIBLE_
  92. #define _WAVEFORMATEXTENSIBLE_
  93. #pragma pack(push, 1)
  94. typedef struct
  95. {
  96. WAVEFORMATEX Format; // WAVEFORMATEX data
  97. union
  98. {
  99. WORD wValidBitsPerSample; // Bits of precision
  100. WORD wSamplesPerBlock; // Samples per block of audio data, valid if wBitsPerSample==0
  101. WORD wReserved; // Unused -- If neither applies, set to zero.
  102. } Samples;
  103. DWORD dwChannelMask; // Speaker usage bitmask
  104. GUID SubFormat; // Sub-format identifier
  105. } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
  106. #pragma pack(pop)
  107. #endif
  108. //------------------------------------------------------------------------------
  109. // Constants
  110. //------------------------------------------------------------------------------
  111. static const XACTTIME XACTTIME_MIN = LONG_MIN;
  112. static const XACTTIME XACTTIME_MAX = LONG_MAX; // 24 days 20:31:23.647
  113. static const XACTTIME XACTTIME_INFINITE = LONG_MAX;
  114. static const XACTINSTANCELIMIT XACTINSTANCELIMIT_INFINITE = 0xff;
  115. static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MIN = 0x00; // == 1 instance total (0 additional instances)
  116. static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MAX = 0xfe; // == 255 instances total (254 additional instances)
  117. static const XACTINDEX XACTINDEX_MIN = 0x0;
  118. static const XACTINDEX XACTINDEX_MAX = 0xfffe;
  119. static const XACTINDEX XACTINDEX_INVALID = 0xffff;
  120. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MIN = 0x00;
  121. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MAX = 0xff;
  122. static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MIN = -FLT_MAX;
  123. static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MAX = FLT_MAX;
  124. static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MIN = 0x0000;
  125. static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MAX = 0xfffe;
  126. static const XACTVARIABLEINDEX XACTVARIABLEINDEX_INVALID = 0xffff;
  127. static const XACTCATEGORY XACTCATEGORY_MIN = 0x0;
  128. static const XACTCATEGORY XACTCATEGORY_MAX = 0xfffe;
  129. static const XACTCATEGORY XACTCATEGORY_INVALID = 0xffff;
  130. static const XACTCHANNEL XACTCHANNEL_MIN = 0;
  131. static const XACTCHANNEL XACTCHANNEL_MAX = 0xFF;
  132. static const XACTPITCH XACTPITCH_MIN = -1200; // pitch change allowable per individual content field
  133. static const XACTPITCH XACTPITCH_MAX = 1200;
  134. static const XACTPITCH XACTPITCH_MIN_TOTAL = -2400; // total allowable pitch change, use with IXACTWave.SetPitch()
  135. static const XACTPITCH XACTPITCH_MAX_TOTAL = 2400;
  136. static const XACTVOLUME XACTVOLUME_MIN = 0.0f;
  137. static const XACTVOLUME XACTVOLUME_MAX = 16777216.0f; // Maximum acceptable volume level (2^24) - matches XAudio2 max volume
  138. static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MIN = -FLT_MAX;
  139. static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MAX = FLT_MAX;
  140. static const XACTLOOPCOUNT XACTLOOPCOUNT_MIN = 0x0;
  141. static const XACTLOOPCOUNT XACTLOOPCOUNT_MAX = 0xfe;
  142. static const XACTLOOPCOUNT XACTLOOPCOUNT_INFINITE = 0xff;
  143. static const DWORD XACTWAVEALIGNMENT_MIN = 2048;
  144. #ifdef _XBOX
  145. static const BYTE XACTMAXOUTPUTVOICECOUNT = 3;
  146. #endif // _XBOX
  147. // -----------------------------------------------------------------------------
  148. // Cue friendly name length
  149. // -----------------------------------------------------------------------------
  150. #define XACT_CUE_NAME_LENGTH 0xFF
  151. // -----------------------------------------------------------------------------
  152. // Current Content Tool Version
  153. // -----------------------------------------------------------------------------
  154. #define XACT_CONTENT_VERSION 46
  155. // -----------------------------------------------------------------------------
  156. // XACT Stop Flags
  157. // -----------------------------------------------------------------------------
  158. static const DWORD XACT_FLAG_STOP_RELEASE = 0x00000000; // Stop with release envelope (or as authored), for looping waves this acts as break loop.
  159. static const DWORD XACT_FLAG_STOP_IMMEDIATE = 0x00000001; // Stop immediately
  160. // -----------------------------------------------------------------------------
  161. // XACT Manage Data Flag - XACT will manage the lifetime of this data
  162. // -----------------------------------------------------------------------------
  163. static const DWORD XACT_FLAG_MANAGEDATA = 0x00000001;
  164. // -----------------------------------------------------------------------------
  165. // XACT Content Preparation Flags
  166. // -----------------------------------------------------------------------------
  167. static const DWORD XACT_FLAG_BACKGROUND_MUSIC = 0x00000002; // Marks the waves as background music.
  168. static const DWORD XACT_FLAG_UNITS_MS = 0x00000004; // Indicates that the units passed in are in milliseconds.
  169. static const DWORD XACT_FLAG_UNITS_SAMPLES = 0x00000008; // Indicates that the units passed in are in samples.
  170. // -----------------------------------------------------------------------------
  171. // XACT State flags
  172. // -----------------------------------------------------------------------------
  173. static const DWORD XACT_STATE_CREATED = 0x00000001; // Created, but nothing else
  174. static const DWORD XACT_STATE_PREPARING = 0x00000002; // In the middle of preparing
  175. static const DWORD XACT_STATE_PREPARED = 0x00000004; // Prepared, but not yet played
  176. static const DWORD XACT_STATE_PLAYING = 0x00000008; // Playing (though could be paused)
  177. static const DWORD XACT_STATE_STOPPING = 0x00000010; // Stopping
  178. static const DWORD XACT_STATE_STOPPED = 0x00000020; // Stopped
  179. static const DWORD XACT_STATE_PAUSED = 0x00000040; // Paused (Can be combined with some of the other state flags above)
  180. static const DWORD XACT_STATE_INUSE = 0x00000080; // Object is in use (used by wavebanks and soundbanks).
  181. static const DWORD XACT_STATE_PREPAREFAILED = 0x80000000; // Object preparation failed.
  182. //------------------------------------------------------------------------------
  183. // XACT Parameters
  184. //------------------------------------------------------------------------------
  185. #define XACT_FLAG_GLOBAL_SETTINGS_MANAGEDATA XACT_FLAG_MANAGEDATA
  186. // -----------------------------------------------------------------------------
  187. // File IO Callbacks
  188. // -----------------------------------------------------------------------------
  189. typedef BOOL (__stdcall * XACT_READFILE_CALLBACK)(__in HANDLE hFile, __out_bcount(nNumberOfBytesToRead) LPVOID lpBuffer, DWORD nNumberOfBytesToRead, __out LPDWORD lpNumberOfBytesRead, __inout LPOVERLAPPED lpOverlapped);
  190. typedef BOOL (__stdcall * XACT_GETOVERLAPPEDRESULT_CALLBACK)(__in HANDLE hFile, __inout LPOVERLAPPED lpOverlapped, __out LPDWORD lpNumberOfBytesTransferred, BOOL bWait);
  191. typedef struct XACT_FILEIO_CALLBACKS
  192. {
  193. XACT_READFILE_CALLBACK readFileCallback;
  194. XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback;
  195. } XACT_FILEIO_CALLBACKS, *PXACT_FILEIO_CALLBACKS;
  196. typedef const XACT_FILEIO_CALLBACKS *PCXACT_FILEIO_CALLBACKS;
  197. // -----------------------------------------------------------------------------
  198. // Notification Callback
  199. // -----------------------------------------------------------------------------
  200. typedef void (__stdcall * XACT_NOTIFICATION_CALLBACK)(__in const XACT_NOTIFICATION* pNotification);
  201. #define XACT_RENDERER_ID_LENGTH 0xff // Maximum number of characters allowed in the renderer ID
  202. #define XACT_RENDERER_NAME_LENGTH 0xff // Maximum number of characters allowed in the renderer display name.
  203. // -----------------------------------------------------------------------------
  204. // Renderer Details
  205. // -----------------------------------------------------------------------------
  206. typedef struct XACT_RENDERER_DETAILS
  207. {
  208. WCHAR rendererID[XACT_RENDERER_ID_LENGTH]; // The string ID for the rendering device.
  209. WCHAR displayName[XACT_RENDERER_NAME_LENGTH]; // A friendly name suitable for display to a human.
  210. BOOL defaultDevice; // Set to TRUE if this device is the primary audio device on the system.
  211. } XACT_RENDERER_DETAILS, *LPXACT_RENDERER_DETAILS;
  212. // -----------------------------------------------------------------------------
  213. // Engine Look-Ahead Time
  214. // -----------------------------------------------------------------------------
  215. #define XACT_ENGINE_LOOKAHEAD_DEFAULT 250 // Default look-ahead time of 250ms can be used during XACT engine initialization.
  216. // -----------------------------------------------------------------------------
  217. // Runtime (engine) parameters
  218. // -----------------------------------------------------------------------------
  219. typedef struct XACT_RUNTIME_PARAMETERS
  220. {
  221. DWORD lookAheadTime; // Time in ms
  222. void* pGlobalSettingsBuffer; // Buffer containing the global settings file
  223. DWORD globalSettingsBufferSize; // Size of global settings buffer
  224. DWORD globalSettingsFlags; // Flags for global settings
  225. DWORD globalSettingsAllocAttributes; // Global settings buffer allocation attributes (see XMemAlloc)
  226. XACT_FILEIO_CALLBACKS fileIOCallbacks; // File I/O callbacks
  227. XACT_NOTIFICATION_CALLBACK fnNotificationCallback; // Callback that receives notifications.
  228. PWSTR pRendererID; // Ptr to the ID for the audio renderer the engine should connect to.
  229. IXAudio2* pXAudio2; // XAudio2 object to be used by the engine (NULL if one needs to be created)
  230. IXAudio2MasteringVoice* pMasteringVoice; // Mastering voice to be used by the engine, if pXAudio2 is not NULL.
  231. } XACT_RUNTIME_PARAMETERS, *LPXACT_RUNTIME_PARAMETERS;
  232. typedef const XACT_RUNTIME_PARAMETERS *LPCXACT_RUNTIME_PARAMETERS;
  233. //------------------------------------------------------------------------------
  234. // Streaming Parameters
  235. //------------------------------------------------------------------------------
  236. typedef struct XACT_STREAMING_PARAMETERS
  237. {
  238. HANDLE file; // File handle associated with wavebank data
  239. DWORD offset; // Offset within file of wavebank header (must be sector aligned)
  240. DWORD flags; // Flags (none currently)
  241. WORD packetSize; // Stream packet size (in sectors) to use for each stream (min = 2)
  242. // number of sectors (DVD = 2048 bytes: 2 = 4096, 3 = 6144, 4 = 8192 etc.)
  243. // optimal DVD size is a multiple of 16 (DVD block = 16 DVD sectors)
  244. } XACT_WAVEBANK_STREAMING_PARAMETERS, *LPXACT_WAVEBANK_STREAMING_PARAMETERS, XACT_STREAMING_PARAMETERS, *LPXACT_STREAMING_PARAMETERS;
  245. typedef const XACT_STREAMING_PARAMETERS *LPCXACT_STREAMING_PARAMETERS;
  246. typedef const XACT_WAVEBANK_STREAMING_PARAMETERS *LPCXACT_WAVEBANK_STREAMING_PARAMETERS;
  247. // Structure used to report cue properties back to the client.
  248. typedef struct XACT_CUE_PROPERTIES
  249. {
  250. CHAR friendlyName[XACT_CUE_NAME_LENGTH]; // Empty if the soundbank doesn't contain any friendly names
  251. BOOL interactive; // TRUE if an IA cue; FALSE otherwise
  252. XACTINDEX iaVariableIndex; // Only valid for IA cues; XACTINDEX_INVALID otherwise
  253. XACTINDEX numVariations; // Number of variations in the cue
  254. XACTINSTANCELIMIT maxInstances; // Number of maximum instances for this cue
  255. XACTINSTANCELIMIT currentInstances; // Current active instances of this cue
  256. } XACT_CUE_PROPERTIES, *LPXACT_CUE_PROPERTIES;
  257. // Strucutre used to return the track properties.
  258. typedef struct XACT_TRACK_PROPERTIES
  259. {
  260. XACTTIME duration; // Duration of the track in ms
  261. XACTINDEX numVariations; // Number of wave variations in the track
  262. XACTCHANNEL numChannels; // Number of channels for the active wave variation on this track
  263. XACTINDEX waveVariation; // Index of the active wave variation
  264. XACTLOOPCOUNT loopCount; // Current loop count on this track
  265. } XACT_TRACK_PROPERTIES, *LPXACT_TRACK_PROPERTIES;
  266. // Structure used to return the properties of a variation.
  267. typedef struct XACT_VARIATION_PROPERTIES
  268. {
  269. XACTINDEX index; // Index of the variation in the cue's variation list
  270. XACTVARIATIONWEIGHT weight; // Weight for the active variation. Valid only for complex cues
  271. XACTVARIABLEVALUE iaVariableMin; // Valid only for IA cues
  272. XACTVARIABLEVALUE iaVariableMax; // Valid only for IA cues
  273. BOOL linger; // Valid only for IA cues
  274. } XACT_VARIATION_PROPERTIES, *LPXACT_VARIATION_PROPERTIES;
  275. // Structure used to return the properties of the sound referenced by a variation.
  276. typedef struct XACT_SOUND_PROPERTIES
  277. {
  278. XACTCATEGORY category; // Category this sound belongs to
  279. BYTE priority; // Priority of this variation
  280. XACTPITCH pitch; // Current pitch set on the active variation
  281. XACTVOLUME volume; // Current volume set on the active variation
  282. XACTINDEX numTracks; // Number of tracks in the active variation
  283. XACT_TRACK_PROPERTIES arrTrackProperties[1]; // Array of active track properties (has numTracks number of elements)
  284. } XACT_SOUND_PROPERTIES, *LPXACT_SOUND_PROPERTIES;
  285. // Structure used to return the properties of the active variation and the sound referenced.
  286. typedef struct XACT_SOUND_VARIATION_PROPERTIES
  287. {
  288. XACT_VARIATION_PROPERTIES variationProperties;// Properties for this variation
  289. XACT_SOUND_PROPERTIES soundProperties; // Proeprties for the sound referenced by this variation
  290. } XACT_SOUND_VARIATION_PROPERTIES, *LPXACT_SOUND_VARIATION_PROPERTIES;
  291. // Structure used to return the properties of an active cue instance.
  292. typedef struct XACT_CUE_INSTANCE_PROPERTIES
  293. {
  294. DWORD allocAttributes; // Buffer allocation attributes (see XMemAlloc)
  295. XACT_CUE_PROPERTIES cueProperties; // Properties of the cue that are shared by all instances.
  296. XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties; // Properties if the currently active variation.
  297. } XACT_CUE_INSTANCE_PROPERTIES, *LPXACT_CUE_INSTANCE_PROPERTIES;
  298. // Structure used to return the common wave properties.
  299. typedef struct XACT_WAVE_PROPERTIES
  300. {
  301. char friendlyName[WAVEBANK_ENTRYNAME_LENGTH]; // Friendly name for the wave; empty if the wavebank doesn't contain friendly names.
  302. WAVEBANKMINIWAVEFORMAT format; // Format for the wave.
  303. DWORD durationInSamples; // Duration of the wave in units of one sample
  304. WAVEBANKSAMPLEREGION loopRegion; // Loop region defined in samples.
  305. BOOL streaming; // Set to TRUE if the wave is streaming; FALSE otherwise.
  306. } XACT_WAVE_PROPERTIES, *LPXACT_WAVE_PROPERTIES;
  307. typedef const XACT_WAVE_PROPERTIES* LPCXACT_WAVE_PROPERTIES;
  308. // Structure used to return the properties specific to a wave instance.
  309. typedef struct XACT_WAVE_INSTANCE_PROPERTIES
  310. {
  311. XACT_WAVE_PROPERTIES properties; // Static properties common to all the wave instances.
  312. BOOL backgroundMusic; // Set to TRUE if the wave is tagged as background music; FALSE otherwise.
  313. } XACT_WAVE_INSTANCE_PROPERTIES, *LPXACT_WAVE_INSTANCE_PROPERTIES;
  314. typedef const XACT_WAVE_INSTANCE_PROPERTIES* LPCXACT_WAVE_INSTANCE_PROPERTIES;
  315. //------------------------------------------------------------------------------
  316. // Channel Mapping / Speaker Panning
  317. //------------------------------------------------------------------------------
  318. typedef struct XACTCHANNELMAPENTRY
  319. {
  320. XACTCHANNEL InputChannel;
  321. XACTCHANNEL OutputChannel;
  322. XACTVOLUME Volume;
  323. } XACTCHANNELMAPENTRY, *LPXACTCHANNELMAPENTRY;
  324. typedef const XACTCHANNELMAPENTRY *LPCXACTCHANNELMAPENTRY;
  325. typedef struct XACTCHANNELMAP
  326. {
  327. XACTCHANNEL EntryCount;
  328. XACTCHANNELMAPENTRY* paEntries;
  329. } XACTCHANNELMAP, *LPXACTCHANNELMAP;
  330. typedef const XACTCHANNELMAP *LPCXACTCHANNELMAP;
  331. typedef struct XACTCHANNELVOLUMEENTRY
  332. {
  333. XACTCHANNEL EntryIndex;
  334. XACTVOLUME Volume;
  335. } XACTCHANNELVOLUMEENTRY, *LPXACTCHANNELVOLUMEENTRY;
  336. typedef const XACTCHANNELVOLUMEENTRY *LPCXACTCHANNELVOLUMEENTRY;
  337. typedef struct XACTCHANNELVOLUME
  338. {
  339. XACTCHANNEL EntryCount;
  340. XACTCHANNELVOLUMEENTRY* paEntries;
  341. } XACTCHANNELVOLUME, *LPXACTCHANNELVOLUME;
  342. typedef const XACTCHANNELVOLUME *LPCXACTCHANNELVOLUME;
  343. //------------------------------------------------------------------------------
  344. // Notifications
  345. //------------------------------------------------------------------------------
  346. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPREPARED = 1; // None, SoundBank, SoundBank & cue index, cue instance
  347. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPLAY = 2; // None, SoundBank, SoundBank & cue index, cue instance
  348. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUESTOP = 3; // None, SoundBank, SoundBank & cue index, cue instance
  349. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; // None, SoundBank, SoundBank & cue index, cue instance
  350. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MARKER = 5; // None, SoundBank, SoundBank & cue index, cue instance
  351. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; // None, SoundBank
  352. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; // None, WaveBank
  353. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED = 8; // None, SoundBank, SoundBank & cue index, cue instance
  354. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GLOBALVARIABLECHANGED = 9; // None
  355. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUICONNECTED = 10; // None
  356. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUIDISCONNECTED = 11; // None
  357. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPREPARED = 12; // None, WaveBank & wave index, wave instance.
  358. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPLAY = 13; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance
  359. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVESTOP = 14; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance
  360. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVELOOPED = 15; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance
  361. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; // None, WaveBank & wave index, wave instance.
  362. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKPREPARED = 17; // None, WaveBank
  363. static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT = 18; // None, WaveBank
  364. static const BYTE XACT_FLAG_NOTIFICATION_PERSIST = 0x01;
  365. // Pack the notification structures
  366. #pragma pack(push, 1)
  367. // Notification description used for registering, un-registering and flushing notifications
  368. typedef struct XACT_NOTIFICATION_DESCRIPTION
  369. {
  370. XACTNOTIFICATIONTYPE type; // Notification type
  371. BYTE flags; // Flags
  372. IXACT3SoundBank* pSoundBank; // SoundBank instance
  373. IXACT3WaveBank* pWaveBank; // WaveBank instance
  374. IXACT3Cue* pCue; // Cue instance
  375. IXACT3Wave* pWave; // Wave instance
  376. XACTINDEX cueIndex; // Cue index
  377. XACTINDEX waveIndex; // Wave index
  378. PVOID pvContext; // User context (optional)
  379. } XACT_NOTIFICATION_DESCRIPTION, *LPXACT_NOTIFICATION_DESCRIPTION;
  380. typedef const XACT_NOTIFICATION_DESCRIPTION *LPCXACT_NOTIFICATION_DESCRIPTION;
  381. // Notification structure for all XACTNOTIFICATIONTYPE_CUE* notifications
  382. typedef struct XACT_NOTIFICATION_CUE
  383. {
  384. XACTINDEX cueIndex; // Cue index
  385. IXACT3SoundBank* pSoundBank; // SoundBank instance
  386. IXACT3Cue* pCue; // Cue instance
  387. } XACT_NOTIFICATION_CUE, *LPXACT_NOTIFICATION_CUE;
  388. typedef const XACT_NOTIFICATION_CUE *LPCXACT_NOTIFICATION_CUE;
  389. // Notification structure for all XACTNOTIFICATIONTYPE_MARKER* notifications
  390. typedef struct XACT_NOTIFICATION_MARKER
  391. {
  392. XACTINDEX cueIndex; // Cue index
  393. IXACT3SoundBank* pSoundBank; // SoundBank instance
  394. IXACT3Cue* pCue; // Cue instance
  395. DWORD marker; // Marker value
  396. } XACT_NOTIFICATION_MARKER, *LPXACT_NOTIFICATION_MARKER;
  397. typedef const XACT_NOTIFICATION_MARKER *LPCXACT_NOTIFICATION_MARKER;
  398. // Notification structure for all XACTNOTIFICATIONTYPE_SOUNDBANK* notifications
  399. typedef struct XACT_NOTIFICATION_SOUNDBANK
  400. {
  401. IXACT3SoundBank* pSoundBank; // SoundBank instance
  402. } XACT_NOTIFICATION_SOUNDBANK, *LPXACT_NOTIFICATION_SOUNDBANK;
  403. typedef const XACT_NOTIFICATION_SOUNDBANK *LPCXACT_NOTIFICATION_SOUNDBANK;
  404. // Notification structure for all XACTNOTIFICATIONTYPE_WAVEBANK* notifications
  405. typedef struct XACT_NOTIFICATION_WAVEBANK
  406. {
  407. IXACT3WaveBank* pWaveBank; // WaveBank instance
  408. } XACT_NOTIFICATION_WAVEBANK, *LPXACT_NOTIFICATION_WAVEBANK;
  409. typedef const XACT_NOTIFICATION_WAVEBANK *LPCXACT_NOTIFICATION_WAVEBANK;
  410. // Notification structure for all XACTNOTIFICATIONTYPE_*VARIABLE* notifications
  411. typedef struct XACT_NOTIFICATION_VARIABLE
  412. {
  413. XACTINDEX cueIndex; // Cue index
  414. IXACT3SoundBank* pSoundBank; // SoundBank instance
  415. IXACT3Cue* pCue; // Cue instance
  416. XACTVARIABLEINDEX variableIndex; // Variable index
  417. XACTVARIABLEVALUE variableValue; // Variable value
  418. BOOL local; // TRUE if a local variable
  419. } XACT_NOTIFICATION_VARIABLE, *LPXACT_NOTIFICATION_VARIABLE;
  420. typedef const XACT_NOTIFICATION_VARIABLE *LPCXACT_NOTIFICATION_VARIABLE;
  421. // Notification structure for all XACTNOTIFICATIONTYPE_GUI* notifications
  422. typedef struct XACT_NOTIFICATION_GUI
  423. {
  424. DWORD reserved; // Reserved
  425. } XACT_NOTIFICATION_GUI, *LPXACT_NOTIFICATION_GUI;
  426. typedef const XACT_NOTIFICATION_GUI *LPCXACT_NOTIFICATION_GUI;
  427. // Notification structure for all XACTNOTIFICATIONTYPE_WAVE* notifications
  428. typedef struct XACT_NOTIFICATION_WAVE
  429. {
  430. IXACT3WaveBank* pWaveBank; // WaveBank
  431. XACTINDEX waveIndex; // Wave index
  432. XACTINDEX cueIndex; // Cue index
  433. IXACT3SoundBank* pSoundBank; // SoundBank instance
  434. IXACT3Cue* pCue; // Cue instance
  435. IXACT3Wave* pWave; // Wave instance
  436. } XACT_NOTIFICATION_WAVE, *LPXACT_NOTIFICATION_WAVE;
  437. typedef const XACT_NOTIFICATION_WAVE *LPCXACT_NOTIFICATION_WAVE;
  438. // General notification structure
  439. typedef struct XACT_NOTIFICATION
  440. {
  441. XACTNOTIFICATIONTYPE type; // Notification type
  442. LONG timeStamp; // Timestamp of notification (milliseconds)
  443. PVOID pvContext; // User context (optional)
  444. union
  445. {
  446. XACT_NOTIFICATION_CUE cue; // XACTNOTIFICATIONTYPE_CUE*
  447. XACT_NOTIFICATION_MARKER marker; // XACTNOTIFICATIONTYPE_MARKER*
  448. XACT_NOTIFICATION_SOUNDBANK soundBank; // XACTNOTIFICATIONTYPE_SOUNDBANK*
  449. XACT_NOTIFICATION_WAVEBANK waveBank; // XACTNOTIFICATIONTYPE_WAVEBANK*
  450. XACT_NOTIFICATION_VARIABLE variable; // XACTNOTIFICATIONTYPE_VARIABLE*
  451. XACT_NOTIFICATION_GUI gui; // XACTNOTIFICATIONTYPE_GUI*
  452. XACT_NOTIFICATION_WAVE wave; // XACTNOTIFICATIONTYPE_WAVE*
  453. };
  454. } XACT_NOTIFICATION, *LPXACT_NOTIFICATION;
  455. typedef const XACT_NOTIFICATION *LPCXACT_NOTIFICATION;
  456. #pragma pack(pop)
  457. //------------------------------------------------------------------------------
  458. // IXACT3SoundBank
  459. //------------------------------------------------------------------------------
  460. #define XACT_FLAG_SOUNDBANK_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE
  461. #define XACT_SOUNDBANKSTATE_INUSE XACT_STATE_INUSE
  462. STDAPI_(XACTINDEX) IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName);
  463. STDAPI IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues);
  464. STDAPI IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties);
  465. STDAPI IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue);
  466. STDAPI IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue);
  467. STDAPI IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags);
  468. STDAPI IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank);
  469. STDAPI IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState);
  470. #undef INTERFACE
  471. #define INTERFACE IXACT3SoundBank
  472. DECLARE_INTERFACE(IXACT3SoundBank)
  473. {
  474. STDMETHOD_(XACTINDEX, GetCueIndex)(THIS_ __in PCSTR szFriendlyName) PURE;
  475. STDMETHOD(GetNumCues)(THIS_ __out XACTINDEX* pnNumCues) PURE;
  476. STDMETHOD(GetCueProperties)(THIS_ XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties) PURE;
  477. STDMETHOD(Prepare)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue) PURE;
  478. STDMETHOD(Play)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue) PURE;
  479. STDMETHOD(Stop)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags) PURE;
  480. STDMETHOD(Destroy)(THIS) PURE;
  481. STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE;
  482. };
  483. #ifdef __cplusplus
  484. __inline HRESULT __stdcall IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank)
  485. {
  486. return pSoundBank->Destroy();
  487. }
  488. __inline XACTINDEX __stdcall IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName)
  489. {
  490. return pSoundBank->GetCueIndex(szFriendlyName);
  491. }
  492. __inline HRESULT __stdcall IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues)
  493. {
  494. return pSoundBank->GetNumCues(pnNumCues);
  495. }
  496. __inline HRESULT __stdcall IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties)
  497. {
  498. return pSoundBank->GetCueProperties(nCueIndex, pProperties);
  499. }
  500. __inline HRESULT __stdcall IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue)
  501. {
  502. return pSoundBank->Prepare(nCueIndex, dwFlags, timeOffset, ppCue);
  503. }
  504. __inline HRESULT __stdcall IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue)
  505. {
  506. return pSoundBank->Play(nCueIndex, dwFlags, timeOffset, ppCue);
  507. }
  508. __inline HRESULT __stdcall IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags)
  509. {
  510. return pSoundBank->Stop(nCueIndex, dwFlags);
  511. }
  512. __inline HRESULT __stdcall IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState)
  513. {
  514. return pSoundBank->GetState(pdwState);
  515. }
  516. #else // __cplusplus
  517. __inline HRESULT __stdcall IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank)
  518. {
  519. return pSoundBank->lpVtbl->Destroy(pSoundBank);
  520. }
  521. __inline XACTINDEX __stdcall IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName)
  522. {
  523. return pSoundBank->lpVtbl->GetCueIndex(pSoundBank, szFriendlyName);
  524. }
  525. __inline HRESULT __stdcall IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues)
  526. {
  527. return pSoundBank->lpVtbl->GetNumCues(pSoundBank, pnNumCues);
  528. }
  529. __inline HRESULT __stdcall IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties)
  530. {
  531. return pSoundBank->lpVtbl->GetCueProperties(pSoundBank, nCueIndex, pProperties);
  532. }
  533. __inline HRESULT __stdcall IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue)
  534. {
  535. return pSoundBank->lpVtbl->Prepare(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue);
  536. }
  537. __inline HRESULT __stdcall IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue)
  538. {
  539. return pSoundBank->lpVtbl->Play(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue);
  540. }
  541. __inline HRESULT __stdcall IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags)
  542. {
  543. return pSoundBank->lpVtbl->Stop(pSoundBank, nCueIndex, dwFlags);
  544. }
  545. __inline HRESULT __stdcall IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState)
  546. {
  547. return pSoundBank->lpVtbl->GetState(pSoundBank, pdwState);
  548. }
  549. #endif // __cplusplus
  550. //------------------------------------------------------------------------------
  551. // IXACT3WaveBank
  552. //------------------------------------------------------------------------------
  553. #define XACT_WAVEBANKSTATE_INUSE XACT_STATE_INUSE // Currently in-use
  554. #define XACT_WAVEBANKSTATE_PREPARED XACT_STATE_PREPARED // Prepared
  555. #define XACT_WAVEBANKSTATE_PREPAREFAILED XACT_STATE_PREPAREFAILED // Prepare failed.
  556. STDAPI IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank);
  557. STDAPI IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState);
  558. STDAPI IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves);
  559. STDAPI_(XACTINDEX) IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName);
  560. STDAPI IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties);
  561. STDAPI IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave);
  562. STDAPI IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave);
  563. STDAPI IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags);
  564. #undef INTERFACE
  565. #define INTERFACE IXACT3WaveBank
  566. DECLARE_INTERFACE(IXACT3WaveBank)
  567. {
  568. STDMETHOD(Destroy)(THIS) PURE;
  569. STDMETHOD(GetNumWaves)(THIS_ __out XACTINDEX* pnNumWaves) PURE;
  570. STDMETHOD_(XACTINDEX, GetWaveIndex)(THIS_ __in PCSTR szFriendlyName) PURE;
  571. STDMETHOD(GetWaveProperties)(THIS_ XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties) PURE;
  572. STDMETHOD(Prepare)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE;
  573. STDMETHOD(Play)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE;
  574. STDMETHOD(Stop)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags) PURE;
  575. STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE;
  576. };
  577. #ifdef __cplusplus
  578. __inline HRESULT __stdcall IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank)
  579. {
  580. return pWaveBank->Destroy();
  581. }
  582. __inline HRESULT __stdcall IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves)
  583. {
  584. return pWaveBank->GetNumWaves(pnNumWaves);
  585. }
  586. __inline XACTINDEX __stdcall IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName)
  587. {
  588. return pWaveBank->GetWaveIndex(szFriendlyName);
  589. }
  590. __inline HRESULT __stdcall IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties)
  591. {
  592. return pWaveBank->GetWaveProperties(nWaveIndex, pWaveProperties);
  593. }
  594. __inline HRESULT __stdcall IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  595. {
  596. return pWaveBank->Prepare(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave);
  597. }
  598. __inline HRESULT __stdcall IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  599. {
  600. return pWaveBank->Play(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave);
  601. }
  602. __inline HRESULT __stdcall IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags)
  603. {
  604. return pWaveBank->Stop(nWaveIndex, dwFlags);
  605. }
  606. __inline HRESULT __stdcall IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState)
  607. {
  608. return pWaveBank->GetState(pdwState);
  609. }
  610. #else // __cplusplus
  611. __inline HRESULT __stdcall IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank)
  612. {
  613. return pWaveBank->lpVtbl->Destroy(pWaveBank);
  614. }
  615. __inline HRESULT __stdcall IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves)
  616. {
  617. return pWaveBank->lpVtbl->GetNumWaves(pWaveBank, pnNumWaves);
  618. }
  619. __inline XACTINDEX __stdcall IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName)
  620. {
  621. return pWaveBank->lpVtbl->GetWaveIndex(pWaveBank, szFriendlyName);
  622. }
  623. __inline HRESULT __stdcall IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties)
  624. {
  625. return pWaveBank->lpVtbl->GetWaveProperties(pWaveBank, nWaveIndex, pWaveProperties);
  626. }
  627. __inline HRESULT __stdcall IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  628. {
  629. return pWaveBank->lpVtbl->Prepare(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave);
  630. }
  631. __inline HRESULT __stdcall IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  632. {
  633. return pWaveBank->lpVtbl->Play(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave);
  634. }
  635. __inline HRESULT __stdcall IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags)
  636. {
  637. return pWaveBank->lpVtbl->Stop(pWaveBank, nWaveIndex, dwFlags);
  638. }
  639. __inline HRESULT __stdcall IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState)
  640. {
  641. return pWaveBank->lpVtbl->GetState(pWaveBank, pdwState);
  642. }
  643. #endif // __cplusplus
  644. //------------------------------------------------------------------------------
  645. // IXACT3Wave
  646. //------------------------------------------------------------------------------
  647. STDAPI IXACT3Wave_Destroy(__in IXACT3Wave* pWave);
  648. STDAPI IXACT3Wave_Play(__in IXACT3Wave* pWave);
  649. STDAPI IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags);
  650. STDAPI IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause);
  651. STDAPI IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState);
  652. STDAPI IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch);
  653. STDAPI IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume);
  654. STDAPI IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients);
  655. STDAPI IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties);
  656. #undef INTERFACE
  657. #define INTERFACE IXACT3Wave
  658. DECLARE_INTERFACE(IXACT3Wave)
  659. {
  660. STDMETHOD(Destroy)(THIS) PURE;
  661. STDMETHOD(Play)(THIS) PURE;
  662. STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE;
  663. STDMETHOD(Pause)(THIS_ BOOL fPause) PURE;
  664. STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE;
  665. STDMETHOD(SetPitch)(THIS_ XACTPITCH pitch) PURE;
  666. STDMETHOD(SetVolume)(THIS_ XACTVOLUME volume) PURE;
  667. STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) PURE;
  668. STDMETHOD(GetProperties)(THIS_ __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) PURE;
  669. };
  670. #ifdef __cplusplus
  671. __inline HRESULT __stdcall IXACT3Wave_Destroy(__in IXACT3Wave* pWave)
  672. {
  673. return pWave->Destroy();
  674. }
  675. __inline HRESULT __stdcall IXACT3Wave_Play(__in IXACT3Wave* pWave)
  676. {
  677. return pWave->Play();
  678. }
  679. __inline HRESULT __stdcall IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags)
  680. {
  681. return pWave->Stop(dwFlags);
  682. }
  683. __inline HRESULT __stdcall IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause)
  684. {
  685. return pWave->Pause(fPause);
  686. }
  687. __inline HRESULT __stdcall IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState)
  688. {
  689. return pWave->GetState(pdwState);
  690. }
  691. __inline HRESULT __stdcall IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch)
  692. {
  693. return pWave->SetPitch(pitch);
  694. }
  695. __inline HRESULT __stdcall IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume)
  696. {
  697. return pWave->SetVolume(volume);
  698. }
  699. __inline HRESULT __stdcall IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients)
  700. {
  701. return pWave->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients);
  702. }
  703. __inline HRESULT __stdcall IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties)
  704. {
  705. return pWave->GetProperties(pProperties);
  706. }
  707. #else // __cplusplus
  708. __inline HRESULT __stdcall IXACT3Wave_Destroy(__in IXACT3Wave* pWave)
  709. {
  710. return pWave->lpVtbl->Destroy(pWave);
  711. }
  712. __inline HRESULT __stdcall IXACT3Wave_Play(__in IXACT3Wave* pWave)
  713. {
  714. return pWave->lpVtbl->Play(pWave);
  715. }
  716. __inline HRESULT __stdcall IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags)
  717. {
  718. return pWave->lpVtbl->Stop(pWave, dwFlags);
  719. }
  720. __inline HRESULT __stdcall IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause)
  721. {
  722. return pWave->lpVtbl->Pause(pWave, fPause);
  723. }
  724. __inline HRESULT __stdcall IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState)
  725. {
  726. return pWave->lpVtbl->GetState(pWave, pdwState);
  727. }
  728. __inline HRESULT __stdcall IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch)
  729. {
  730. return pWave->lpVtbl->SetPitch(pWave, pitch);
  731. }
  732. __inline HRESULT __stdcall IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume)
  733. {
  734. return pWave->lpVtbl->SetVolume(pWave, volume);
  735. }
  736. __inline HRESULT __stdcall IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients)
  737. {
  738. return pWave->lpVtbl->SetMatrixCoefficients(pWave, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients);
  739. }
  740. __inline HRESULT __stdcall IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties)
  741. {
  742. return pWave->lpVtbl->GetProperties(pWave, pProperties);
  743. }
  744. #endif // __cplusplus
  745. //------------------------------------------------------------------------------
  746. // IXACT3Cue
  747. //------------------------------------------------------------------------------
  748. // Cue Flags
  749. #define XACT_FLAG_CUE_STOP_RELEASE XACT_FLAG_STOP_RELEASE
  750. #define XACT_FLAG_CUE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE
  751. // Mutually exclusive states
  752. #define XACT_CUESTATE_CREATED XACT_STATE_CREATED // Created, but nothing else
  753. #define XACT_CUESTATE_PREPARING XACT_STATE_PREPARING // In the middle of preparing
  754. #define XACT_CUESTATE_PREPARED XACT_STATE_PREPARED // Prepared, but not yet played
  755. #define XACT_CUESTATE_PLAYING XACT_STATE_PLAYING // Playing (though could be paused)
  756. #define XACT_CUESTATE_STOPPING XACT_STATE_STOPPING // Stopping
  757. #define XACT_CUESTATE_STOPPED XACT_STATE_STOPPED // Stopped
  758. #define XACT_CUESTATE_PAUSED XACT_STATE_PAUSED // Paused (can be combined with other states)
  759. STDAPI IXACT3Cue_Destroy(__in IXACT3Cue* pCue);
  760. STDAPI IXACT3Cue_Play(__in IXACT3Cue* pCue);
  761. STDAPI IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags);
  762. STDAPI IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState);
  763. STDAPI IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue*, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients);
  764. STDAPI_(XACTVARIABLEINDEX) IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName);
  765. STDAPI IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue);
  766. STDAPI IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue);
  767. STDAPI IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause);
  768. STDAPI IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties);
  769. STDAPI IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList);
  770. STDAPI IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix);
  771. #undef INTERFACE
  772. #define INTERFACE IXACT3Cue
  773. DECLARE_INTERFACE(IXACT3Cue)
  774. {
  775. STDMETHOD(Play)(THIS) PURE;
  776. STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE;
  777. STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE;
  778. STDMETHOD(Destroy)(THIS) PURE;
  779. STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) PURE;
  780. STDMETHOD_(XACTVARIABLEINDEX, GetVariableIndex)(THIS_ __in PCSTR szFriendlyName) PURE;
  781. STDMETHOD(SetVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE;
  782. STDMETHOD(GetVariable)(THIS_ XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) PURE;
  783. STDMETHOD(Pause)(THIS_ BOOL fPause) PURE;
  784. STDMETHOD(GetProperties)(THIS_ __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) PURE;
  785. STDMETHOD(SetOutputVoices)(THIS_ __in_opt const XAUDIO2_VOICE_SENDS* pSendList) PURE;
  786. STDMETHOD(SetOutputVoiceMatrix)(THIS_ __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix) PURE;
  787. };
  788. #ifdef __cplusplus
  789. __inline HRESULT __stdcall IXACT3Cue_Play(__in IXACT3Cue* pCue)
  790. {
  791. return pCue->Play();
  792. }
  793. __inline HRESULT __stdcall IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags)
  794. {
  795. return pCue->Stop(dwFlags);
  796. }
  797. __inline HRESULT __stdcall IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState)
  798. {
  799. return pCue->GetState(pdwState);
  800. }
  801. __inline HRESULT __stdcall IXACT3Cue_Destroy(__in IXACT3Cue* pCue)
  802. {
  803. return pCue->Destroy();
  804. }
  805. __inline HRESULT __stdcall IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients)
  806. {
  807. return pCue->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients);
  808. }
  809. __inline XACTVARIABLEINDEX __stdcall IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName)
  810. {
  811. return pCue->GetVariableIndex(szFriendlyName);
  812. }
  813. __inline HRESULT __stdcall IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue)
  814. {
  815. return pCue->SetVariable(nIndex, nValue);
  816. }
  817. __inline HRESULT __stdcall IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue)
  818. {
  819. return pCue->GetVariable(nIndex, pnValue);
  820. }
  821. __inline HRESULT __stdcall IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause)
  822. {
  823. return pCue->Pause(fPause);
  824. }
  825. __inline HRESULT __stdcall IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties)
  826. {
  827. return pCue->GetProperties(ppProperties);
  828. }
  829. __inline HRESULT __stdcall IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList)
  830. {
  831. return pCue->SetOutputVoices(pSendList);
  832. }
  833. __inline HRESULT __stdcall IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix)
  834. {
  835. return pCue->SetOutputVoiceMatrix(pDestinationVoice, SourceChannels, DestinationChannels, pLevelMatrix);
  836. }
  837. #else // __cplusplus
  838. __inline HRESULT __stdcall IXACT3Cue_Play(__in IXACT3Cue* pCue)
  839. {
  840. return pCue->lpVtbl->Play(pCue);
  841. }
  842. __inline HRESULT __stdcall IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags)
  843. {
  844. return pCue->lpVtbl->Stop(pCue, dwFlags);
  845. }
  846. __inline HRESULT __stdcall IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState)
  847. {
  848. return pCue->lpVtbl->GetState(pCue, pdwState);
  849. }
  850. __inline HRESULT __stdcall IXACT3Cue_Destroy(__in IXACT3Cue* pCue)
  851. {
  852. return pCue->lpVtbl->Destroy(pCue);
  853. }
  854. __inline HRESULT __stdcall IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients)
  855. {
  856. return pCue->lpVtbl->SetMatrixCoefficients(pCue, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients);
  857. }
  858. __inline XACTVARIABLEINDEX __stdcall IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName)
  859. {
  860. return pCue->lpVtbl->GetVariableIndex(pCue, szFriendlyName);
  861. }
  862. __inline HRESULT __stdcall IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue)
  863. {
  864. return pCue->lpVtbl->SetVariable(pCue, nIndex, nValue);
  865. }
  866. __inline HRESULT __stdcall IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue)
  867. {
  868. return pCue->lpVtbl->GetVariable(pCue, nIndex, pnValue);
  869. }
  870. __inline HRESULT __stdcall IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause)
  871. {
  872. return pCue->lpVtbl->Pause(pCue, fPause);
  873. }
  874. __inline HRESULT __stdcall IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties)
  875. {
  876. return pCue->lpVtbl->GetProperties(pCue, ppProperties);
  877. }
  878. __inline HRESULT __stdcall IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList)
  879. {
  880. return pCue->lpVtbl->SetOutputVoices(pSendList);
  881. }
  882. __inline HRESULT __stdcall IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix)
  883. {
  884. return pCue->lpVtbl->SetOutputVoiceMatrix(pDestinationVoice, SourceChannels, DestinationChannels, pLevelMatrix);
  885. }
  886. #endif // __cplusplus
  887. //------------------------------------------------------------------------------
  888. // IXACT3Engine
  889. //------------------------------------------------------------------------------
  890. // Engine flags
  891. #define XACT_FLAG_ENGINE_CREATE_MANAGEDATA XACT_FLAG_MANAGEDATA
  892. #define XACT_FLAG_ENGINE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE
  893. STDAPI_(ULONG) IXACT3Engine_AddRef(__in IXACT3Engine* pEngine);
  894. STDAPI_(ULONG) IXACT3Engine_Release(__in IXACT3Engine* pEngine);
  895. STDAPI IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount);
  896. STDAPI IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails);
  897. STDAPI IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat);
  898. STDAPI IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams);
  899. STDAPI IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine);
  900. STDAPI IXACT3Engine_DoWork(__in IXACT3Engine* pEngine);
  901. STDAPI IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank);
  902. STDAPI IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank);
  903. STDAPI IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank);
  904. STDAPI IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave);
  905. STDAPI IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave);
  906. STDAPI IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave);
  907. STDAPI IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc);
  908. STDAPI IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc);
  909. STDAPI_(XACTCATEGORY) IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName);
  910. STDAPI IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags);
  911. STDAPI IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume);
  912. STDAPI IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause);
  913. STDAPI_(XACTVARIABLEINDEX) IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName);
  914. STDAPI IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue);
  915. STDAPI IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue);
  916. #undef INTERFACE
  917. #define INTERFACE IXACT3Engine
  918. #ifdef _XBOX
  919. DECLARE_INTERFACE(IXACT3Engine)
  920. {
  921. #else
  922. DECLARE_INTERFACE_(IXACT3Engine, IUnknown)
  923. {
  924. STDMETHOD(QueryInterface)(THIS_ __in REFIID riid, __deref_out void** ppvObj) PURE;
  925. #endif
  926. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  927. STDMETHOD_(ULONG, Release)(THIS) PURE;
  928. STDMETHOD(GetRendererCount)(THIS_ __out XACTINDEX* pnRendererCount) PURE;
  929. STDMETHOD(GetRendererDetails)(THIS_ XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails) PURE;
  930. STDMETHOD(GetFinalMixFormat)(THIS_ __out WAVEFORMATEXTENSIBLE* pFinalMixFormat) PURE;
  931. STDMETHOD(Initialize)(THIS_ __in const XACT_RUNTIME_PARAMETERS* pParams) PURE;
  932. STDMETHOD(ShutDown)(THIS) PURE;
  933. STDMETHOD(DoWork)(THIS) PURE;
  934. STDMETHOD(CreateSoundBank)(THIS_ __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank) PURE;
  935. STDMETHOD(CreateInMemoryWaveBank)(THIS_ __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank) PURE;
  936. STDMETHOD(CreateStreamingWaveBank)(THIS_ __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank) PURE;
  937. STDMETHOD(PrepareWave)(THIS_ DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE;
  938. STDMETHOD(PrepareInMemoryWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE;
  939. STDMETHOD(PrepareStreamingWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE;
  940. STDMETHOD(RegisterNotification)(THIS_ __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE;
  941. STDMETHOD(UnRegisterNotification)(THIS_ __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE;
  942. STDMETHOD_(XACTCATEGORY, GetCategory)(THIS_ __in PCSTR szFriendlyName) PURE;
  943. STDMETHOD(Stop)(THIS_ XACTCATEGORY nCategory, DWORD dwFlags) PURE;
  944. STDMETHOD(SetVolume)(THIS_ XACTCATEGORY nCategory, XACTVOLUME nVolume) PURE;
  945. STDMETHOD(Pause)(THIS_ XACTCATEGORY nCategory, BOOL fPause) PURE;
  946. STDMETHOD_(XACTVARIABLEINDEX, GetGlobalVariableIndex)(THIS_ __in PCSTR szFriendlyName) PURE;
  947. STDMETHOD(SetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE;
  948. STDMETHOD(GetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) PURE;
  949. };
  950. #ifdef __cplusplus
  951. __inline ULONG __stdcall IXACT3Engine_AddRef(__in IXACT3Engine* pEngine)
  952. {
  953. return pEngine->AddRef();
  954. }
  955. __inline ULONG __stdcall IXACT3Engine_Release(__in IXACT3Engine* pEngine)
  956. {
  957. return pEngine->Release();
  958. }
  959. __inline HRESULT __stdcall IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount)
  960. {
  961. return pEngine->GetRendererCount(pnRendererCount);
  962. }
  963. __inline HRESULT __stdcall IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails)
  964. {
  965. return pEngine->GetRendererDetails(nRendererIndex, pRendererDetails);
  966. }
  967. __inline HRESULT __stdcall IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat)
  968. {
  969. return pEngine->GetFinalMixFormat(pFinalMixFormat);
  970. }
  971. __inline HRESULT __stdcall IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams)
  972. {
  973. return pEngine->Initialize(pParams);
  974. }
  975. __inline HRESULT __stdcall IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine)
  976. {
  977. return pEngine->ShutDown();
  978. }
  979. __inline HRESULT __stdcall IXACT3Engine_DoWork(__in IXACT3Engine* pEngine)
  980. {
  981. return pEngine->DoWork();
  982. }
  983. __inline HRESULT __stdcall IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank)
  984. {
  985. return pEngine->CreateSoundBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank);
  986. }
  987. __inline HRESULT __stdcall IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank)
  988. {
  989. return pEngine->CreateInMemoryWaveBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank);
  990. }
  991. __inline HRESULT __stdcall IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank)
  992. {
  993. return pEngine->CreateStreamingWaveBank(pParms, ppWaveBank);
  994. }
  995. __inline HRESULT __stdcall IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  996. {
  997. return pEngine->PrepareWave(dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave);
  998. }
  999. __inline HRESULT __stdcall IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  1000. {
  1001. return pEngine->PrepareInMemoryWave(dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave);
  1002. }
  1003. __inline HRESULT __stdcall IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  1004. {
  1005. return pEngine->PrepareStreamingWave(dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave);
  1006. }
  1007. __inline HRESULT __stdcall IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
  1008. {
  1009. return pEngine->RegisterNotification(pNotificationDesc);
  1010. }
  1011. __inline HRESULT __stdcall IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
  1012. {
  1013. return pEngine->UnRegisterNotification(pNotificationDesc);
  1014. }
  1015. __inline XACTCATEGORY __stdcall IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName)
  1016. {
  1017. return pEngine->GetCategory(szFriendlyName);
  1018. }
  1019. __inline HRESULT __stdcall IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags)
  1020. {
  1021. return pEngine->Stop(nCategory, dwFlags);
  1022. }
  1023. __inline HRESULT __stdcall IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume)
  1024. {
  1025. return pEngine->SetVolume(nCategory, nVolume);
  1026. }
  1027. __inline HRESULT __stdcall IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause)
  1028. {
  1029. return pEngine->Pause(nCategory, fPause);
  1030. }
  1031. __inline XACTVARIABLEINDEX __stdcall IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName)
  1032. {
  1033. return pEngine->GetGlobalVariableIndex(szFriendlyName);
  1034. }
  1035. __inline HRESULT __stdcall IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue)
  1036. {
  1037. return pEngine->SetGlobalVariable(nIndex, nValue);
  1038. }
  1039. __inline HRESULT __stdcall IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue)
  1040. {
  1041. return pEngine->GetGlobalVariable(nIndex, nValue);
  1042. }
  1043. #else // __cplusplus
  1044. __inline ULONG __stdcall IXACT3Engine_AddRef(__in IXACT3Engine* pEngine)
  1045. {
  1046. return pEngine->lpVtbl->AddRef(pEngine);
  1047. }
  1048. __inline ULONG __stdcall IXACT3Engine_Release(__in IXACT3Engine* pEngine)
  1049. {
  1050. return pEngine->lpVtbl->Release(pEngine);
  1051. }
  1052. __inline HRESULT __stdcall IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount)
  1053. {
  1054. return pEngine->lpVtbl->GetRendererCount(pEngine, pnRendererCount);
  1055. }
  1056. __inline HRESULT __stdcall IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails)
  1057. {
  1058. return pEngine->lpVtbl->GetRendererDetails(pEngine, nRendererIndex, pRendererDetails);
  1059. }
  1060. __inline HRESULT __stdcall IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat)
  1061. {
  1062. return pEngine->lpVtbl->GetFinalMixFormat(pEngine, pFinalMixFormat);
  1063. }
  1064. __inline HRESULT __stdcall IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams)
  1065. {
  1066. return pEngine->lpVtbl->Initialize(pEngine, pParams);
  1067. }
  1068. __inline HRESULT __stdcall IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine)
  1069. {
  1070. return pEngine->lpVtbl->ShutDown(pEngine);
  1071. }
  1072. __inline HRESULT __stdcall IXACT3Engine_DoWork(__in IXACT3Engine* pEngine)
  1073. {
  1074. return pEngine->lpVtbl->DoWork(pEngine);
  1075. }
  1076. __inline HRESULT __stdcall IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank)
  1077. {
  1078. return pEngine->lpVtbl->CreateSoundBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank);
  1079. }
  1080. __inline HRESULT __stdcall IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank)
  1081. {
  1082. return pEngine->lpVtbl->CreateInMemoryWaveBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank);
  1083. }
  1084. __inline HRESULT __stdcall IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank)
  1085. {
  1086. return pEngine->lpVtbl->CreateStreamingWaveBank(pEngine, pParms, ppWaveBank);
  1087. }
  1088. __inline HRESULT __stdcall IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  1089. {
  1090. return pEngine->lpVtbl->PrepareWave(pEngine, dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave);
  1091. }
  1092. __inline HRESULT __stdcall IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  1093. {
  1094. return pEngine->lpVtbl->PrepareInMemoryWave(pEngine, dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave);
  1095. }
  1096. __inline HRESULT __stdcall IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave)
  1097. {
  1098. return pEngine->lpVtbl->PrepareStreamingWave(pEngine, dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave);
  1099. }
  1100. __inline HRESULT __stdcall IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
  1101. {
  1102. return pEngine->lpVtbl->RegisterNotification(pEngine, pNotificationDesc);
  1103. }
  1104. __inline HRESULT __stdcall IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc)
  1105. {
  1106. return pEngine->lpVtbl->UnRegisterNotification(pEngine, pNotificationDesc);
  1107. }
  1108. __inline XACTCATEGORY __stdcall IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName)
  1109. {
  1110. return pEngine->lpVtbl->GetCategory(pEngine, szFriendlyName);
  1111. }
  1112. __inline HRESULT __stdcall IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags)
  1113. {
  1114. return pEngine->lpVtbl->Stop(pEngine, nCategory, dwFlags);
  1115. }
  1116. __inline HRESULT __stdcall IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume)
  1117. {
  1118. return pEngine->lpVtbl->SetVolume(pEngine, nCategory, nVolume);
  1119. }
  1120. __inline HRESULT __stdcall IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause)
  1121. {
  1122. return pEngine->lpVtbl->Pause(pEngine, nCategory, fPause);
  1123. }
  1124. __inline XACTVARIABLEINDEX __stdcall IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName)
  1125. {
  1126. return pEngine->lpVtbl->GetGlobalVariableIndex(pEngine, szFriendlyName);
  1127. }
  1128. __inline HRESULT __stdcall IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue)
  1129. {
  1130. return pEngine->lpVtbl->SetGlobalVariable(pEngine, nIndex, nValue);
  1131. }
  1132. __inline HRESULT __stdcall IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue)
  1133. {
  1134. return pEngine->lpVtbl->GetGlobalVariable(pEngine, nIndex, nValue);
  1135. }
  1136. #endif // __cplusplus
  1137. //------------------------------------------------------------------------------
  1138. // Create Engine
  1139. //------------------------------------------------------------------------------
  1140. // Flags used only in XACT3CreateEngine below. These flags are valid but ignored
  1141. // when building for Xbox 360; to enable auditioning on that platform you must
  1142. // link explicitly to an auditioning version of the XACT static library.
  1143. static const DWORD XACT_FLAG_API_AUDITION_MODE = 0x00000001;
  1144. static const DWORD XACT_FLAG_API_DEBUG_MODE = 0x00000002;
  1145. #ifdef _XBOX
  1146. STDAPI XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine);
  1147. #else // #ifdef _XBOX
  1148. #define XACT_DEBUGENGINE_REGISTRY_KEY TEXT("Software\\Microsoft\\XACT")
  1149. #define XACT_DEBUGENGINE_REGISTRY_VALUE TEXT("DebugEngine")
  1150. #ifdef __cplusplus
  1151. __inline HRESULT __stdcall XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine)
  1152. {
  1153. HRESULT hr;
  1154. HKEY key;
  1155. DWORD data;
  1156. DWORD type = REG_DWORD;
  1157. DWORD dataSize = sizeof(DWORD);
  1158. BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE;
  1159. BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE;
  1160. // If neither the debug nor audition flags are set, see if the debug registry key is set
  1161. if(!debug && !audition &&
  1162. (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS))
  1163. {
  1164. if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS)
  1165. {
  1166. if(data)
  1167. {
  1168. debug = TRUE;
  1169. }
  1170. }
  1171. RegCloseKey(key);
  1172. }
  1173. // Priority order: Audition, Debug, Retail
  1174. hr = CoCreateInstance(audition ? __uuidof(XACTAuditionEngine)
  1175. : (debug ? __uuidof(XACTDebugEngine) : __uuidof(XACTEngine)),
  1176. NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACT3Engine), (void**)ppEngine);
  1177. // If debug engine does not exist fallback to retail version
  1178. if(FAILED(hr) && debug && !audition)
  1179. {
  1180. hr = CoCreateInstance(__uuidof(XACTEngine), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACT3Engine), (void**)ppEngine);
  1181. }
  1182. return hr;
  1183. }
  1184. #else // #ifdef __cplusplus
  1185. __inline HRESULT __stdcall XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine)
  1186. {
  1187. HRESULT hr;
  1188. HKEY key;
  1189. DWORD data;
  1190. DWORD type = REG_DWORD;
  1191. DWORD dataSize = sizeof(DWORD);
  1192. BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE;
  1193. BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE;
  1194. // If neither the debug nor audition flags are set, see if the debug registry key is set
  1195. if(!debug && !audition &&
  1196. (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS))
  1197. {
  1198. if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS)
  1199. {
  1200. if(data)
  1201. {
  1202. debug = TRUE;
  1203. }
  1204. }
  1205. RegCloseKey(key);
  1206. }
  1207. // Priority order: Audition, Debug, Retail
  1208. hr = CoCreateInstance(audition ? &CLSID_XACTAuditionEngine
  1209. : (debug ? &CLSID_XACTDebugEngine : &CLSID_XACTEngine),
  1210. NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void**)ppEngine);
  1211. // If debug engine does not exist fallback to retail version
  1212. if(FAILED(hr) && debug && !audition)
  1213. {
  1214. hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void**)ppEngine);
  1215. }
  1216. return hr;
  1217. }
  1218. #endif // #ifdef __cplusplus
  1219. #endif // #ifdef _XBOX
  1220. //------------------------------------------------------------------------------
  1221. // XACT specific error codes
  1222. //------------------------------------------------------------------------------
  1223. #define FACILITY_XACTENGINE 0xAC7
  1224. #define XACTENGINEERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XACTENGINE, n)
  1225. #define XACTENGINE_E_OUTOFMEMORY E_OUTOFMEMORY // Out of memory
  1226. #define XACTENGINE_E_INVALIDARG E_INVALIDARG // Invalid arg
  1227. #define XACTENGINE_E_NOTIMPL E_NOTIMPL // Not implemented
  1228. #define XACTENGINE_E_FAIL E_FAIL // Unknown error
  1229. #define XACTENGINE_E_ALREADYINITIALIZED XACTENGINEERROR(0x001) // The engine is already initialized
  1230. #define XACTENGINE_E_NOTINITIALIZED XACTENGINEERROR(0x002) // The engine has not been initialized
  1231. #define XACTENGINE_E_EXPIRED XACTENGINEERROR(0x003) // The engine has expired (demo or pre-release version)
  1232. #define XACTENGINE_E_NONOTIFICATIONCALLBACK XACTENGINEERROR(0x004) // No notification callback
  1233. #define XACTENGINE_E_NOTIFICATIONREGISTERED XACTENGINEERROR(0x005) // Notification already registered
  1234. #define XACTENGINE_E_INVALIDUSAGE XACTENGINEERROR(0x006) // Invalid usage
  1235. #define XACTENGINE_E_INVALIDDATA XACTENGINEERROR(0x007) // Invalid data
  1236. #define XACTENGINE_E_INSTANCELIMITFAILTOPLAY XACTENGINEERROR(0x008) // Fail to play due to instance limit
  1237. #define XACTENGINE_E_NOGLOBALSETTINGS XACTENGINEERROR(0x009) // Global Settings not loaded
  1238. #define XACTENGINE_E_INVALIDVARIABLEINDEX XACTENGINEERROR(0x00a) // Invalid variable index
  1239. #define XACTENGINE_E_INVALIDCATEGORY XACTENGINEERROR(0x00b) // Invalid category
  1240. #define XACTENGINE_E_INVALIDCUEINDEX XACTENGINEERROR(0x00c) // Invalid cue index
  1241. #define XACTENGINE_E_INVALIDWAVEINDEX XACTENGINEERROR(0x00d) // Invalid wave index
  1242. #define XACTENGINE_E_INVALIDTRACKINDEX XACTENGINEERROR(0x00e) // Invalid track index
  1243. #define XACTENGINE_E_INVALIDSOUNDOFFSETORINDEX XACTENGINEERROR(0x00f) // Invalid sound offset or index
  1244. #define XACTENGINE_E_READFILE XACTENGINEERROR(0x010) // Error reading a file
  1245. #define XACTENGINE_E_UNKNOWNEVENT XACTENGINEERROR(0x011) // Unknown event type
  1246. #define XACTENGINE_E_INCALLBACK XACTENGINEERROR(0x012) // Invalid call of method of function from callback
  1247. #define XACTENGINE_E_NOWAVEBANK XACTENGINEERROR(0x013) // No wavebank exists for desired operation
  1248. #define XACTENGINE_E_SELECTVARIATION XACTENGINEERROR(0x014) // Unable to select a variation
  1249. #define XACTENGINE_E_MULTIPLEAUDITIONENGINES XACTENGINEERROR(0x015) // There can be only one audition engine
  1250. #define XACTENGINE_E_WAVEBANKNOTPREPARED XACTENGINEERROR(0x016) // The wavebank is not prepared
  1251. #define XACTENGINE_E_NORENDERER XACTENGINEERROR(0x017) // No audio device found on.
  1252. #define XACTENGINE_E_INVALIDENTRYCOUNT XACTENGINEERROR(0x018) // Invalid entry count for channel maps
  1253. #define XACTENGINE_E_SEEKTIMEBEYONDCUEEND XACTENGINEERROR(0x019) // Time offset for seeking is beyond the cue end.
  1254. #define XACTENGINE_E_SEEKTIMEBEYONDWAVEEND XACTENGINEERROR(0x01a) // Time offset for seeking is beyond the wave end.
  1255. #define XACTENGINE_E_NOFRIENDLYNAMES XACTENGINEERROR(0x01b) // Friendly names are not included in the bank.
  1256. #define XACTENGINE_E_AUDITION_WRITEFILE XACTENGINEERROR(0x101) // Error writing a file during auditioning
  1257. #define XACTENGINE_E_AUDITION_NOSOUNDBANK XACTENGINEERROR(0x102) // Missing a soundbank
  1258. #define XACTENGINE_E_AUDITION_INVALIDRPCINDEX XACTENGINEERROR(0x103) // Missing an RPC curve
  1259. #define XACTENGINE_E_AUDITION_MISSINGDATA XACTENGINEERROR(0x104) // Missing data for an audition command
  1260. #define XACTENGINE_E_AUDITION_UNKNOWNCOMMAND XACTENGINEERROR(0x105) // Unknown command
  1261. #define XACTENGINE_E_AUDITION_INVALIDDSPINDEX XACTENGINEERROR(0x106) // Missing a DSP parameter
  1262. #define XACTENGINE_E_AUDITION_MISSINGWAVE XACTENGINEERROR(0x107) // Wave does not exist in auditioned wavebank
  1263. #define XACTENGINE_E_AUDITION_CREATEDIRECTORYFAILED XACTENGINEERROR(0x108) // Failed to create a directory for streaming wavebank data
  1264. #define XACTENGINE_E_AUDITION_INVALIDSESSION XACTENGINEERROR(0x109) // Invalid audition session
  1265. #endif // #ifndef GUID_DEFS_ONLY
  1266. #endif // #ifndef _XACT3_H_