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.

1641 lines
75 KiB

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