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 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_XAUDIO2_H
#define _SDL_XAUDIO2_H
#include <windows.h>
#include <mmreg.h>
#include <objbase.h>
/* XAudio2 packs its structure members together as tightly as possible.
This pragma is needed to ensure compatibility with XAudio2 on 64-bit
platforms.
*/
#pragma pack(push, 1)
typedef interface IXAudio2 IXAudio2;
typedef interface IXAudio2SourceVoice IXAudio2SourceVoice;
typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice;
typedef interface IXAudio2EngineCallback IXAudio2EngineCallback;
typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback;
typedef interface IXAudio2Voice IXAudio2Voice;
typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice;
typedef enum _AUDIO_STREAM_CATEGORY {
AudioCategory_Other = 0,
AudioCategory_ForegroundOnlyMedia,
AudioCategory_BackgroundCapableMedia,
AudioCategory_Communications,
AudioCategory_Alerts,
AudioCategory_SoundEffects,
AudioCategory_GameEffects,
AudioCategory_GameMedia,
AudioCategory_GameChat,
AudioCategory_Movie,
AudioCategory_Media
} AUDIO_STREAM_CATEGORY;
typedef struct XAUDIO2_BUFFER {
UINT32 Flags;
UINT32 AudioBytes;
const BYTE *pAudioData;
UINT32 PlayBegin;
UINT32 PlayLength;
UINT32 LoopBegin;
UINT32 LoopLength;
UINT32 LoopCount;
void *pContext;
} XAUDIO2_BUFFER;
typedef struct XAUDIO2_BUFFER_WMA {
const UINT32 *pDecodedPacketCumulativeBytes;
UINT32 PacketCount;
} XAUDIO2_BUFFER_WMA;
typedef struct XAUDIO2_SEND_DESCRIPTOR {
UINT32 Flags;
IXAudio2Voice *pOutputVoice;
} XAUDIO2_SEND_DESCRIPTOR;
typedef struct XAUDIO2_VOICE_SENDS {
UINT32 SendCount;
XAUDIO2_SEND_DESCRIPTOR *pSends;
} XAUDIO2_VOICE_SENDS;
typedef struct XAUDIO2_EFFECT_DESCRIPTOR {
IUnknown *pEffect;
BOOL InitialState;
UINT32 OutputChannels;
} XAUDIO2_EFFECT_DESCRIPTOR;
typedef struct XAUDIO2_EFFECT_CHAIN {
UINT32 EffectCount;
XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors;
} XAUDIO2_EFFECT_CHAIN;
typedef struct XAUDIO2_PERFORMANCE_DATA {
UINT64 AudioCyclesSinceLastQuery;
UINT64 TotalCyclesSinceLastQuery;
UINT32 MinimumCyclesPerQuantum;
UINT32 MaximumCyclesPerQuantum;
UINT32 MemoryUsageInBytes;
UINT32 CurrentLatencyInSamples;
UINT32 GlitchesSinceEngineStarted;
UINT32 ActiveSourceVoiceCount;
UINT32 TotalSourceVoiceCount;
UINT32 ActiveSubmixVoiceCount;
UINT32 ActiveResamplerCount;
UINT32 ActiveMatrixMixCount;
UINT32 ActiveXmaSourceVoices;
UINT32 ActiveXmaStreams;
} XAUDIO2_PERFORMANCE_DATA;
typedef struct XAUDIO2_DEBUG_CONFIGURATION {
UINT32 TraceMask;
UINT32 BreakMask;
BOOL LogThreadID;
BOOL LogFileline;
BOOL LogFunctionName;
BOOL LogTiming;
} XAUDIO2_DEBUG_CONFIGURATION;
typedef struct XAUDIO2_VOICE_DETAILS {
UINT32 CreationFlags;
UINT32 ActiveFlags;
UINT32 InputChannels;
UINT32 InputSampleRate;
} XAUDIO2_VOICE_DETAILS;
typedef enum XAUDIO2_FILTER_TYPE {
LowPassFilter = 0,
BandPassFilter = 1,
HighPassFilter = 2,
NotchFilter = 3,
LowPassOnePoleFilter = 4,
HighPassOnePoleFilter = 5
} XAUDIO2_FILTER_TYPE;
typedef struct XAUDIO2_FILTER_PARAMETERS {
XAUDIO2_FILTER_TYPE Type;
float Frequency;
float OneOverQ;
} XAUDIO2_FILTER_PARAMETERS;
typedef struct XAUDIO2_VOICE_STATE {
void *pCurrentBufferContext;
UINT32 BuffersQueued;
UINT64 SamplesPlayed;
} XAUDIO2_VOICE_STATE;
typedef UINT32 XAUDIO2_PROCESSOR;
#define Processor1 0x00000001
#define XAUDIO2_DEFAULT_PROCESSOR Processor1
#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004
#define XAUDIO2_COMMIT_NOW 0
#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100
#define XAUDIO2_DEFAULT_CHANNELS 0
extern HRESULT __stdcall XAudio2Create(
_Out_ IXAudio2 **ppXAudio2,
_In_ UINT32 Flags,
_In_ XAUDIO2_PROCESSOR XAudio2Processor
);
#undef INTERFACE
#define INTERFACE IXAudio2
typedef interface IXAudio2 {
const struct IXAudio2Vtbl FAR* lpVtbl;
} IXAudio2;
typedef const struct IXAudio2Vtbl IXAudio2Vtbl;
const struct IXAudio2Vtbl
{
/* IUnknown */
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
/* IXAudio2 */
STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE;
STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE;
STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice,
const WAVEFORMATEX *pSourceFormat,
UINT32 Flags,
float MaxFrequencyRatio,
IXAudio2VoiceCallback *pCallback,
const XAUDIO2_VOICE_SENDS *pSendList,
const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice,
UINT32 InputChannels,
UINT32 InputSampleRate,
UINT32 Flags,
UINT32 ProcessingStage,
const XAUDIO2_VOICE_SENDS *pSendList,
const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice,
UINT32 InputChannels,
UINT32 InputSampleRate,
UINT32 Flags,
LPCWSTR szDeviceId,
const XAUDIO2_EFFECT_CHAIN *pEffectChain,
AUDIO_STREAM_CATEGORY StreamCategory) PURE;
STDMETHOD_(HRESULT, StartEngine)(THIS) PURE;
STDMETHOD_(VOID, StopEngine)(THIS) PURE;
STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE;
STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE;
STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
VOID *pReserved) PURE;
};
#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A))
#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H))
#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H))
#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A))
#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A))
#undef INTERFACE
#define INTERFACE IXAudio2SourceVoice
typedef interface IXAudio2SourceVoice {
const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl;
} IXAudio2SourceVoice;
typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl;
const struct IXAudio2SourceVoiceVtbl
{
/* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger
* says otherwise, and that IXAudio2Voice doesn't inherit from any other
* interface!
*/
/* IXAudio2Voice */
STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE;
STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE;
STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE;
STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex,
const void *pParameters,
UINT32 ParametersByteSize,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex,
void *pParameters,
UINT32 ParametersByteSize) PURE;
STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
XAUDIO2_FILTER_PARAMETERS *pParameters,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE;
STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels,
const float *pVolumes,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels,
float *pVolumes) PURE;
STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
UINT32 SourceChannels,
UINT32 DestinationChannels,
const float *pLevelMatrix,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
UINT32 SourceChannels,
UINT32 DestinationChannels,
float *pLevelMatrix) PURE;
STDMETHOD_(VOID, DestroyVoice)(THIS) PURE;
/* IXAudio2SourceVoice */
STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags,
UINT32 OperationSet) PURE;
STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags,
UINT32 OperationSet) PURE;
STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer,
const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE;
STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE;
STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE;
STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState,
UINT32 Flags) PURE;
STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE;
STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE;
};
#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A))
#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C))
#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C))
#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C))
#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A))
#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A))
#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C))
#undef INTERFACE
#define INTERFACE IXAudio2MasteringVoice
typedef interface IXAudio2MasteringVoice {
const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl;
} IXAudio2MasteringVoice;
typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl;
const struct IXAudio2MasteringVoiceVtbl
{
/* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger
* says otherwise, and that IXAudio2Voice doesn't inherit from any other
* interface!
*/
/* IXAudio2Voice */
STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE;
STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE;
STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE;
STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex,
const void *pParameters,
UINT32 ParametersByteSize,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex,
void *pParameters,
UINT32 ParametersByteSize) PURE;
STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
XAUDIO2_FILTER_PARAMETERS *pParameters,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE;
STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels,
const float *pVolumes,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels,
float *pVolumes) PURE;
STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
UINT32 SourceChannels,
UINT32 DestinationChannels,
const float *pLevelMatrix,
UINT32 OperationSet) PURE;
STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
UINT32 SourceChannels,
UINT32 DestinationChannels,
float *pLevelMatrix) PURE;
STDMETHOD_(VOID, DestroyVoice)(THIS) PURE;
/* IXAudio2SourceVoice */
STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE;
};
#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A))
#undef INTERFACE
#define INTERFACE IXAudio2VoiceCallback
typedef interface IXAudio2VoiceCallback {
const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl;
} IXAudio2VoiceCallback;
typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl;
const struct IXAudio2VoiceCallbackVtbl
{
/* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's
* own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit
* from any other interface!
*/
/* IXAudio2VoiceCallback */
STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE;
STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE;
STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE;
STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE;
STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE;
STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE;
STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE;
};
#pragma pack(pop) /* Undo pragma push */
#endif /* _SDL_XAUDIO2_H */
/* vi: set ts=4 sw=4 expandtab: */