Subversion Repositories Games.Chess Giants

Rev

Details | Last modification | View Log | RSS feed

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