[go: up one dir, main page]

File: xact3.h

package info (click to toggle)
faudio 21.02-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,576 kB
  • sloc: ansic: 25,642; cpp: 10,815; cs: 1,899; sh: 82; makefile: 21
file content (334 lines) | stat: -rw-r--r-- 8,773 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#ifndef FACT_CPP_XACT3_H
#define FACT_CPP_XACT3_H

#include "xaudio2.h"
#include <FACT.h>


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#ifndef XACT3_VERSION
#define XACT3_VERSION 7
#endif

typedef FACTRendererDetails XACT_RENDERER_DETAILS;
typedef FACTFileIOCallbacks XACT_FILEIO_CALLBACKS;
typedef FACTRuntimeParameters XACT_RUNTIME_PARAMETERS;
typedef FACTStreamingParameters XACT_STREAMING_PARAMETERS;
typedef FACTWaveBankRegion WAVEBANKREGION;
typedef FACTWaveBankSampleRegion WAVEBANKSAMPLEREGION;
typedef FACTWaveBankHeader WAVEBANKHEADER;
typedef FACTWaveBankMiniWaveFormat WAVEBANKMINIWAVEFORMAT;
typedef FACTWaveBankEntry WAVEBANKENTRY;
typedef FACTWaveBankEntryCompact WAVEBANKENTRYCOMPACT;
typedef FACTWaveBankData WAVEBANKDATA;
typedef FACTWaveProperties XACT_WAVE_PROPERTIES;
typedef FACTWaveInstanceProperties XACT_WAVE_INSTANCE_PROPERTIES;
typedef FACTCueProperties XACT_CUE_PROPERTIES;
typedef FACTTrackProperties XACT_TRACK_PROPERTIES;
typedef FACTVariationProperties XACT_VARIATION_PROPERTIES;
typedef FACTSoundProperties XACT_SOUND_PROPERTIES;
typedef FACTSoundVariationProperties XACT_SOUND_VARIATION_PROPERTIES;
typedef FACTCueInstanceProperties XACT_CUE_INSTANCE_PROPERTIES;

typedef FACTReadFileCallback XACT_READFILE_CALLBACK;
typedef FACTGetOverlappedResultCallback XACT_GETOVERLAPPEDRESULT_CALLBACK;

typedef FACTWaveBankSegIdx WAVEBANKSEGIDX;

class IXACT3Engine;
class IXACT3SoundBank;
class IXACT3WaveBank;
class IXACT3Wave;
class IXACT3Cue;

#pragma pack(push, 1)

typedef struct XACT_NOTIFICATION_DESCRIPTION
{
	uint8_t type;
	uint8_t flags;
	IXACT3SoundBank *pSoundBank;
	IXACT3WaveBank *pWaveBank;
	IXACT3Cue *pCue;
	IXACT3Wave *pWave;
	uint16_t cueIndex;
	uint16_t waveIndex;
	void* pvContext;
} XACT_NOTIFICATION_DESCRIPTION;

typedef struct XACT_NOTIFICATION_CUE
{
	uint16_t cueIndex;
	IXACT3SoundBank *pSoundBank;
	IXACT3Cue *pCue;
} XACT_NOTIFICATION_CUE;

typedef struct XACT_NOTIFICATION_MARKER
{
	uint16_t cueIndex;
	IXACT3SoundBank *pSoundBank;
	IXACT3Cue *pCue;
	uint32_t marker;
} XACT_NOTIFICATION_MARKER;

typedef struct XACT_NOTIFICATION_SOUNDBANK
{
	IXACT3SoundBank *pSoundBank;
} XACT_NOTIFICATION_SOUNDBANK;

typedef struct XACT_NOTIFICATION_WAVEBANK
{
	IXACT3WaveBank *pWaveBank;
} XACT_NOTIFICATION_WAVEBANK;

typedef struct XACT_NOTIFICATION_VARIABLE
{
	uint16_t cueIndex;
	IXACT3SoundBank *pSoundBank;
	IXACT3Cue *pCue;
	uint16_t variableIndex;
	float variableValue;
	uint8_t local;
} XACT_NOTIFICATION_VARIABLE;

typedef struct XACT_NOTIFICATION_GUI
{
	uint32_t reserved;
} XACT_NOTIFICATION_GUI;

typedef struct XACT_NOTIFICATION_WAVE
{
	IXACT3WaveBank *pWaveBank;
	uint16_t waveIndex;
	uint16_t cueIndex;
	IXACT3SoundBank *pSoundBank;
	IXACT3Cue *pCue;
	IXACT3Wave *pWave;
} XACT_NOTIFICATION_WAVE;

typedef struct XACT_NOTIFICATION
{
	uint8_t type;
	int32_t timeStamp;
	void *pvContext;
	union
	{
		XACT_NOTIFICATION_CUE cue;
		XACT_NOTIFICATION_MARKER marker;
		XACT_NOTIFICATION_SOUNDBANK soundBank;
		XACT_NOTIFICATION_WAVEBANK waveBank;
		XACT_NOTIFICATION_VARIABLE variable;
		XACT_NOTIFICATION_GUI gui;
		XACT_NOTIFICATION_WAVE wave;
	};
} XACT_NOTIFICATION;

#pragma pack(pop)

class IXACT3Engine : public IUnknown
{
public:
	COM_METHOD(HRESULT) GetRendererCount(
		uint16_t *pnRendererCount
	) = 0;
	COM_METHOD(HRESULT) GetRendererDetails(
		uint16_t nRendererIndex,
		XACT_RENDERER_DETAILS *pRendererDetails
	) = 0;
	COM_METHOD(HRESULT) GetFinalMixFormat(
		WAVEFORMATEXTENSIBLE *pFinalMixFormat
	) = 0;
	COM_METHOD(HRESULT) Initialize(
		const XACT_RUNTIME_PARAMETERS *pParams
	) = 0;
	COM_METHOD(HRESULT) ShutDown() = 0;
	COM_METHOD(HRESULT) DoWork() = 0;
	COM_METHOD(HRESULT) CreateSoundBank(
		const void *pvBuffer,
		uint32_t dwSize,
		uint32_t dwFlags,
		uint32_t dwAllocAttributes,
		IXACT3SoundBank **ppSoundBank
	) = 0;
	COM_METHOD(HRESULT) CreateInMemoryWaveBank(
		const void *pvBuffer,
		uint32_t dwSize,
		uint32_t dwFlags,
		uint32_t dwAllocAttributes,
		IXACT3WaveBank **ppWaveBank
	) = 0;
	COM_METHOD(HRESULT) CreateStreamingWaveBank(
		const XACT_STREAMING_PARAMETERS *pParms,
		IXACT3WaveBank **ppWaveBank
	) = 0;
	COM_METHOD(HRESULT) PrepareWave(
		uint32_t dwFlags,
		const char *szWavePath,
		uint32_t wStreamingPacketSize,
		uint32_t dwAlignment,
		uint32_t dwPlayOffset,
		uint8_t nLoopCount,
		IXACT3Wave **ppWave
	) = 0;
	COM_METHOD(HRESULT) PrepareInMemoryWave(
		uint32_t dwFlags,
		WAVEBANKENTRY entry,
		uint32_t *pdwSeekTable, /* Optional! */
		uint8_t *pbWaveData,
		uint32_t dwPlayOffset,
		uint8_t nLoopCount,
		IXACT3Wave **ppWave
	) = 0;
	COM_METHOD(HRESULT) PrepareStreamingWave(
		uint32_t dwFlags,
		WAVEBANKENTRY entry,
		XACT_STREAMING_PARAMETERS streamingParams,
		uint32_t dwAlignment,
		uint32_t *pdwSeekTable, /* Optional! */
		uint8_t *pbWaveData,
		uint32_t dwPlayOffset,
		uint8_t nLoopCount,
		IXACT3Wave **ppWave
	) = 0;
	COM_METHOD(HRESULT) RegisterNotification(
		const XACT_NOTIFICATION_DESCRIPTION *pNotificationDescription
	) = 0;
	COM_METHOD(HRESULT) UnRegisterNotification(
		const XACT_NOTIFICATION_DESCRIPTION *pNotificationDescription
	) = 0;
	COM_METHOD(uint16_t) GetCategory(const char *szFriendlyName) = 0;
	COM_METHOD(HRESULT) Stop(uint16_t nCategory, uint32_t dwFlags) = 0;
	COM_METHOD(HRESULT) SetVolume(uint16_t nCategory, float volume) = 0;
	COM_METHOD(HRESULT) Pause(uint16_t nCategory, int32_t fPause) = 0;
	COM_METHOD(uint16_t) GetGlobalVariableIndex(
		const char *szFriendlyName
	) = 0;
	COM_METHOD(HRESULT) SetGlobalVariable(
		uint16_t nIndex,
		float nValue
	) = 0;
	COM_METHOD(HRESULT) GetGlobalVariable(
		uint16_t nIndex,
		float *pnValue
	) = 0;
};

class IXACT3SoundBank
{
public:
	COM_METHOD(uint16_t) GetCueIndex(const char *szFriendlyName) = 0;
	COM_METHOD(HRESULT) GetNumCues(uint16_t *pnNumCues) = 0;
	COM_METHOD(HRESULT) GetCueProperties(
		uint16_t nCueIndex,
		XACT_CUE_PROPERTIES *pProperties
	) = 0;
	COM_METHOD(HRESULT) Prepare(
		uint16_t nCueIndex,
		uint32_t dwFlags,
		int32_t timeOffset,
		IXACT3Cue** ppCue
	) = 0;
	COM_METHOD(HRESULT) Play(
		uint16_t nCueIndex,
		uint32_t dwFlags,
		int32_t timeOffset,
		IXACT3Cue** ppCue /* Optional! */
	) = 0;
	COM_METHOD(HRESULT) Stop(uint16_t nCueIndex, uint32_t dwFlags) = 0;
	COM_METHOD(HRESULT) Destroy() = 0;
	COM_METHOD(HRESULT) GetState(uint32_t *pdwState) = 0;
};

class IXACT3WaveBank
{
public:
	COM_METHOD(HRESULT) Destroy() = 0;
	COM_METHOD(HRESULT) GetNumWaves(uint16_t *pnNumWaves) = 0;
	COM_METHOD(uint16_t) GetWaveIndex(const char *szFriendlyName) = 0;
	COM_METHOD(HRESULT) GetWaveProperties(
		uint16_t nWaveIndex,
		XACT_WAVE_PROPERTIES *pWaveProperties
	) = 0;
	COM_METHOD(HRESULT) Prepare(
		uint16_t nWaveIndex,
		uint32_t dwFlags,
		uint32_t dwPlayOffset,
		uint8_t nLoopCount,
		IXACT3Wave **ppWave
	) = 0;
	COM_METHOD(HRESULT) Play(
		uint16_t nWaveIndex,
		uint32_t dwFlags,
		uint32_t dwPlayOffset,
		uint8_t nLoopCount,
		IXACT3Wave **ppWave
	) = 0;
	COM_METHOD(HRESULT) Stop(
		uint16_t nWaveIndex,
		uint32_t dwFlags
	) = 0;
	COM_METHOD(HRESULT) GetState(uint32_t *pdwState) = 0;
};

class IXACT3Wave
{
public:
	COM_METHOD(HRESULT) Destroy() = 0;
	COM_METHOD(HRESULT) Play() = 0;
	COM_METHOD(HRESULT) Stop(uint32_t dwFlags) = 0;
	COM_METHOD(HRESULT) Pause(int32_t fPause) = 0;
	COM_METHOD(HRESULT) GetState(uint32_t *pdwState) = 0;
	COM_METHOD(HRESULT) SetPitch(int16_t pitch) = 0;
	COM_METHOD(HRESULT) SetVolume(float volume) = 0;
	COM_METHOD(HRESULT) SetMatrixCoefficients(
		uint32_t uSrcChannelCount,
		uint32_t uDstChannelCount,
		float *pMatrixCoefficients
	) = 0;
	COM_METHOD(HRESULT) GetProperties(
		XACT_WAVE_INSTANCE_PROPERTIES *pProperties
	) = 0;
};

class IXACT3Cue
{
public:
	COM_METHOD(HRESULT) Play() = 0;
	COM_METHOD(HRESULT) Stop(uint32_t dwFlags) = 0;
	COM_METHOD(HRESULT) GetState(uint32_t *pdwState) = 0;
	COM_METHOD(HRESULT) Destroy() = 0;
	COM_METHOD(HRESULT) SetMatrixCoefficients(
		uint32_t uSrcChannelCount,
		uint32_t uDstChannelCount,
		float *pMatrixCoefficients
	) = 0;
	COM_METHOD(uint16_t) GetVariableIndex(const char *szFriendlyName) = 0;
	COM_METHOD(HRESULT) SetVariable(uint16_t nIndex, float nValue) = 0;
	COM_METHOD(HRESULT) GetVariable(uint16_t nIndex, float *nValue) = 0;
	COM_METHOD(HRESULT) Pause(int32_t fPause) = 0;
	COM_METHOD(HRESULT) GetProperties(
		XACT_CUE_INSTANCE_PROPERTIES **ppProperties
	) = 0;
#if XACT3_VERSION >= 5
	COM_METHOD(HRESULT) SetOutputVoices(
		const XAUDIO2_VOICE_SENDS *pSendList /* Optional! */
	) = 0;
	COM_METHOD(HRESULT) SetOutputVoiceMatrix(
		const IXAudio2Voice *pDestinationVoice, /* Optional! */
		uint32_t SourceChannels,
		uint32_t DestinationChannels,
		const float *pLevelMatrix /* SourceChannels * DestinationChannels */
	) = 0;
#endif /* XACT_VERSION >= 5 */
};


#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif // FACT_CPP_XACT3_H