wined3d: Avoid storing a material pointer in struct wined3d_cs_set_material.
[wine.git] / include / xaudio2.idl
blob9d8ace2395b11d1ed04833d351ba0de1a363ae8f
1 /*
2 * Copyright (c) 2015 Mark Harmstone
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 import "unknwn.idl";
20 import "mmdeviceapi.idl";
22 import "audiosessiontypes.h";
24 cpp_quote("#include <pshpack1.h>")
27 uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
29 coclass XAudio20 {
30 interface IUnknown;
34 uuid(e21a7345-eb21-468e-be50-804db97cf708)
36 coclass XAudio21 {
37 interface IUnknown;
41 uuid(b802058a-464a-42db-bc10-b650d6f2586a)
43 coclass XAudio22 {
44 interface IUnknown;
48 uuid(4c5e637a-16c7-4de3-9c46-5ed22181962d)
50 coclass XAudio23 {
51 interface IUnknown;
55 uuid(03219e78-5bc3-44d1-b92e-f63d89cc6526)
57 coclass XAudio24 {
58 interface IUnknown;
62 uuid(4c9b6dde-6809-46e6-a278-9b6a97588670)
64 coclass XAudio25 {
65 interface IUnknown;
69 uuid(3eda9b49-2085-498b-9bb2-39a6778493de)
71 coclass XAudio26 {
72 interface IUnknown;
76 uuid(5a508685-a254-4fba-9b82-9a24b00306af)
78 coclass XAudio27 {
79 interface IUnknown;
83 uuid(db05ea35-0329-4d4b-a53a-6dead03d3852)
85 coclass XAudio2Debug {
86 interface IUnknown;
89 cpp_quote("#if 0")
90 typedef struct WAVEFORMATEX
92 WORD wFormatTag;
93 WORD nChannels;
94 DWORD nSamplesPerSec;
95 DWORD nAvgBytesPerSec;
96 WORD nBlockAlign;
97 WORD wBitsPerSample;
98 WORD cbSize;
99 } WAVEFORMATEX;
101 typedef struct {
102 WAVEFORMATEX Format;
103 union {
104 WORD wValidBitsPerSample;
105 WORD wSamplesPerBlock;
106 WORD wReserved;
107 } Samples;
108 DWORD dwChannelMask;
109 GUID SubFormat;
110 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
111 cpp_quote("#else")
112 cpp_quote("#include <mmreg.h>")
113 cpp_quote("#endif")
115 interface IXAudio2Voice;
117 typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
119 Processor1 = 0x00000001,
120 Processor2 = 0x00000002,
121 Processor3 = 0x00000004,
122 Processor4 = 0x00000008,
123 Processor5 = 0x00000010,
124 Processor6 = 0x00000020,
125 Processor7 = 0x00000040,
126 Processor8 = 0x00000080,
127 Processor9 = 0x00000100,
128 Processor10 = 0x00000200,
129 Processor11 = 0x00000400,
130 Processor12 = 0x00000800,
131 Processor13 = 0x00001000,
132 Processor14 = 0x00002000,
133 Processor15 = 0x00004000,
134 Processor16 = 0x00008000,
135 Processor17 = 0x00010000,
136 Processor18 = 0x00020000,
137 Processor19 = 0x00040000,
138 Processor20 = 0x00080000,
139 Processor21 = 0x00100000,
140 Processor22 = 0x00200000,
141 Processor23 = 0x00400000,
142 Processor24 = 0x00800000,
143 Processor25 = 0x01000000,
144 Processor26 = 0x02000000,
145 Processor27 = 0x04000000,
146 Processor28 = 0x08000000,
147 Processor29 = 0x10000000,
148 Processor30 = 0x20000000,
149 Processor31 = 0x40000000,
150 Processor32 = 0x80000000,
151 XAUDIO2_ANY_PROCESSOR = 0xffffffff,
152 XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
153 } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
155 typedef struct XAUDIO2_PERFORMANCE_DATA
157 UINT64 AudioCyclesSinceLastQuery;
158 UINT64 TotalCyclesSinceLastQuery;
159 UINT32 MinimumCyclesPerQuantum;
160 UINT32 MaximumCyclesPerQuantum;
161 UINT32 MemoryUsageInBytes;
162 UINT32 CurrentLatencyInSamples;
163 UINT32 GlitchesSinceEngineStarted;
164 UINT32 ActiveSourceVoiceCount;
165 UINT32 TotalSourceVoiceCount;
166 UINT32 ActiveSubmixVoiceCount;
167 UINT32 ActiveResamplerCount;
168 UINT32 ActiveMatrixMixCount;
169 UINT32 ActiveXmaSourceVoices;
170 UINT32 ActiveXmaStreams;
171 } XAUDIO2_PERFORMANCE_DATA;
173 typedef struct XAUDIO22_PERFORMANCE_DATA
175 UINT64 AudioCyclesSinceLastQuery;
176 UINT64 TotalCyclesSinceLastQuery;
177 UINT32 MinimumCyclesPerQuantum;
178 UINT32 MaximumCyclesPerQuantum;
179 UINT32 MemoryUsageInBytes;
180 UINT32 CurrentLatencyInSamples;
181 UINT32 GlitchesSinceEngineStarted;
182 UINT32 ActiveSourceVoiceCount;
183 UINT32 TotalSourceVoiceCount;
184 UINT32 ActiveSubmixVoiceCount;
185 UINT32 TotalSubmixVoiceCount;
186 UINT32 ActiveXmaSourceVoices;
187 UINT32 ActiveXmaStreams;
188 } XAUDIO22_PERFORMANCE_DATA;
190 typedef struct XAUDIO20_PERFORMANCE_DATA
192 UINT64 AudioCyclesSinceLastQuery;
193 UINT64 TotalCyclesSinceLastQuery;
194 UINT32 MinimumCyclesPerQuantum;
195 UINT32 MaximumCyclesPerQuantum;
196 UINT32 MemoryUsageInBytes;
197 UINT32 CurrentLatencyInSamples;
198 UINT32 GlitchesSinceLastQuery;
199 UINT32 ActiveSourceVoiceCount;
200 UINT32 TotalSourceVoiceCount;
201 UINT32 ActiveSubmixVoiceCount;
202 UINT32 TotalSubmixVoiceCount;
203 UINT32 ActiveXmaSourceVoices;
204 UINT32 ActiveXmaStreams;
205 } XAUDIO20_PERFORMANCE_DATA;
207 typedef enum XAUDIO2_DEVICE_ROLE
209 NotDefaultDevice = 0x0,
210 DefaultConsoleDevice = 0x1,
211 DefaultMultimediaDevice = 0x2,
212 DefaultCommunicationsDevice = 0x4,
213 DefaultGameDevice = 0x8,
214 GlobalDefaultDevice = 0xf,
215 InvalidDeviceRole = ~GlobalDefaultDevice
216 } XAUDIO2_DEVICE_ROLE;
218 typedef struct XAUDIO2_DEVICE_DETAILS
220 WCHAR DeviceID[256];
221 WCHAR DisplayName[256];
222 XAUDIO2_DEVICE_ROLE Role;
223 WAVEFORMATEXTENSIBLE OutputFormat;
224 } XAUDIO2_DEVICE_DETAILS;
226 typedef struct XAUDIO2_VOICE_DETAILS
228 UINT32 CreationFlags;
229 UINT32 InputChannels;
230 UINT32 InputSampleRate;
231 } XAUDIO2_VOICE_DETAILS;
233 typedef struct XAUDIO2_SEND_DESCRIPTOR
235 UINT32 Flags;
236 IXAudio2Voice* pOutputVoice;
237 } XAUDIO2_SEND_DESCRIPTOR;
239 /* XAudio2 2.3's XAUDIO2_VOICE_SENDS struct */
240 typedef struct XAUDIO23_VOICE_SENDS
242 UINT32 OutputCount;
243 IXAudio2Voice **pOutputVoices;
244 } XAUDIO23_VOICE_SENDS;
246 typedef struct XAUDIO2_VOICE_SENDS
248 UINT32 SendCount;
249 XAUDIO2_SEND_DESCRIPTOR* pSends;
250 } XAUDIO2_VOICE_SENDS;
252 typedef struct XAUDIO2_EFFECT_DESCRIPTOR
254 IUnknown* pEffect;
255 BOOL InitialState;
256 UINT32 OutputChannels;
257 } XAUDIO2_EFFECT_DESCRIPTOR;
259 typedef struct XAUDIO2_EFFECT_CHAIN
261 UINT32 EffectCount;
262 XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors;
263 } XAUDIO2_EFFECT_CHAIN;
265 const UINT32 XAUDIO2_MAX_BUFFER_BYTES = 0x80000000;
266 const UINT32 XAUDIO2_MAX_QUEUED_BUFFERS = 64;
267 const UINT32 XAUDIO2_MAX_BUFFERS_SYSTEM = 2;
268 const UINT32 XAUDIO2_MAX_AUDIO_CHANNELS = 64;
269 const UINT32 XAUDIO2_MIN_SAMPLE_RATE = 1000;
270 const UINT32 XAUDIO2_MAX_SAMPLE_RATE = 200000;
271 const float XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0;
272 const float XAUDIO2_MIN_FREQ_RATIO = (1/1024.0);
273 const float XAUDIO2_MAX_FREQ_RATIO = 1024.0;
274 const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
275 const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
276 const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
277 const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
278 const UINT32 XAUDIO20_MAX_LOOP_COUNT = 0x100000; /* xaudio 2.0 */
280 const UINT32 XAUDIO2_COMMIT_NOW = 0;
281 const UINT32 XAUDIO2_COMMIT_ALL = 0;
282 const UINT32 XAUDIO2_INVALID_OPSET = 0xffffffff;
283 const UINT32 XAUDIO2_NO_LOOP_REGION = 0;
284 const UINT32 XAUDIO2_LOOP_INFINITE = 255;
285 const UINT32 XAUDIO20_LOOP_INFINITE = ((UINT)-1); /* xaudio 2.0 */
286 const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
287 const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
290 object,
291 local
293 interface IXAudio2EngineCallback
295 void OnProcessingPassStart();
297 void OnProcessingPassEnd();
299 void OnCriticalError([in] HRESULT Error);
302 typedef enum XAUDIO2_FILTER_TYPE
304 LowPassFilter,
305 BandPassFilter,
306 HighPassFilter,
307 NotchFilter
308 } XAUDIO2_FILTER_TYPE;
310 typedef struct XAUDIO2_FILTER_PARAMETERS
312 XAUDIO2_FILTER_TYPE Type;
313 float Frequency;
314 float OneOverQ;
315 } XAUDIO2_FILTER_PARAMETERS;
317 /* XAudio 2.0's IXAudio2Voice */
318 /* XAudio2 2.0's IXAudio2Voice interface. Actually called
319 * IXAudio2Voice in the Mar 2008 DX SDK */
321 object,
322 local
324 interface IXAudio20Voice
326 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
328 HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
330 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
332 HRESULT EnableEffect(
333 [in] UINT32 EffectIndex,
334 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
336 HRESULT DisableEffect(
337 [in] UINT32 EffectIndex,
338 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
340 void GetEffectState(
341 [in] UINT32 EffectIndex,
342 [out] BOOL* pEnabled);
344 HRESULT SetEffectParameters(
345 [in] UINT32 EffectIndex,
346 [in] const void* pParameters,
347 [in] UINT32 ParametersByteSize,
348 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
350 HRESULT GetEffectParameters(
351 [in] UINT32 EffectIndex,
352 [out] void* pParameters,
353 [in] UINT32 ParametersByteSize);
355 HRESULT SetFilterParameters(
356 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
357 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
359 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
361 HRESULT SetVolume(
362 [in] float Volume,
363 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
365 void GetVolume([out] float* pVolume);
367 HRESULT SetChannelVolumes(
368 [in] UINT32 Channels,
369 [in, size_is(Channels)] const float* pVolumes,
370 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
372 void GetChannelVolumes(
373 [in] UINT32 Channels,
374 [out, size_is(Channels)] float* pVolumes);
376 HRESULT SetOutputMatrix(
377 [in] IXAudio2Voice* pDestinationVoice,
378 [in] UINT32 SourceChannels,
379 [in] UINT32 DestinationChannels,
380 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
381 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
383 HRESULT GetOutputMatrix(
384 [in] IXAudio2Voice* pDestinationVoice,
385 [in] UINT32 SourceChannels,
386 [in] UINT32 DestinationChannels,
387 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
389 void DestroyVoice();
392 /* XAudio 2.3's IXAudio2Voice */
393 /* XAudio2 2.3's IXAudio2Voice interface. Actually called
394 * IXAudio2Voice in the Nov 2008 DX SDK */
396 object,
397 local
399 interface IXAudio23Voice
401 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
403 HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
405 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
407 HRESULT EnableEffect(
408 [in] UINT32 EffectIndex,
409 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
411 HRESULT DisableEffect(
412 [in] UINT32 EffectIndex,
413 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
415 void GetEffectState(
416 [in] UINT32 EffectIndex,
417 [out] BOOL* pEnabled);
419 HRESULT SetEffectParameters(
420 [in] UINT32 EffectIndex,
421 [in] const void* pParameters,
422 [in] UINT32 ParametersByteSize,
423 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
425 HRESULT GetEffectParameters(
426 [in] UINT32 EffectIndex,
427 [out] void* pParameters,
428 [in] UINT32 ParametersByteSize);
430 HRESULT SetFilterParameters(
431 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
432 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
434 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
436 HRESULT SetVolume(
437 [in] float Volume,
438 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
440 void GetVolume([out] float* pVolume);
442 HRESULT SetChannelVolumes(
443 [in] UINT32 Channels,
444 [in, size_is(Channels)] const float* pVolumes,
445 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
447 void GetChannelVolumes(
448 [in] UINT32 Channels,
449 [out, size_is(Channels)] float* pVolumes);
451 HRESULT SetOutputMatrix(
452 [in] IXAudio2Voice* pDestinationVoice,
453 [in] UINT32 SourceChannels,
454 [in] UINT32 DestinationChannels,
455 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
456 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
458 void GetOutputMatrix(
459 [in] IXAudio2Voice* pDestinationVoice,
460 [in] UINT32 SourceChannels,
461 [in] UINT32 DestinationChannels,
462 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
464 void DestroyVoice();
468 object,
469 local
471 interface IXAudio2Voice
473 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
475 HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
477 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
479 HRESULT EnableEffect(
480 [in] UINT32 EffectIndex,
481 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
483 HRESULT DisableEffect(
484 [in] UINT32 EffectIndex,
485 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
487 void GetEffectState(
488 [in] UINT32 EffectIndex,
489 [out] BOOL* pEnabled);
491 HRESULT SetEffectParameters(
492 [in] UINT32 EffectIndex,
493 [in] const void* pParameters,
494 [in] UINT32 ParametersByteSize,
495 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
497 HRESULT GetEffectParameters(
498 [in] UINT32 EffectIndex,
499 [out] void* pParameters,
500 [in] UINT32 ParametersByteSize);
502 HRESULT SetFilterParameters(
503 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
504 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
506 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
508 HRESULT SetOutputFilterParameters(
509 [in] IXAudio2Voice* pDestinationVoice,
510 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
511 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
513 void GetOutputFilterParameters(
514 [in] IXAudio2Voice* pDestinationVoice,
515 [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
517 HRESULT SetVolume(
518 [in] float Volume,
519 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
521 void GetVolume([out] float* pVolume);
523 HRESULT SetChannelVolumes(
524 [in] UINT32 Channels,
525 [in, size_is(Channels)] const float* pVolumes,
526 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
528 void GetChannelVolumes(
529 [in] UINT32 Channels,
530 [out, size_is(Channels)] float* pVolumes);
532 HRESULT SetOutputMatrix(
533 [in] IXAudio2Voice* pDestinationVoice,
534 [in] UINT32 SourceChannels,
535 [in] UINT32 DestinationChannels,
536 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
537 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
539 void GetOutputMatrix(
540 [in] IXAudio2Voice* pDestinationVoice,
541 [in] UINT32 SourceChannels,
542 [in] UINT32 DestinationChannels,
543 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
545 void DestroyVoice();
548 typedef struct XAUDIO2_BUFFER
550 UINT32 Flags;
551 UINT32 AudioBytes;
552 const BYTE* pAudioData;
553 UINT32 PlayBegin;
554 UINT32 PlayLength;
555 UINT32 LoopBegin;
556 UINT32 LoopLength;
557 UINT32 LoopCount;
558 void* pContext;
559 } XAUDIO2_BUFFER;
561 typedef struct XAUDIO2_BUFFER_WMA
563 const UINT32* pDecodedPacketCumulativeBytes;
564 UINT32 PacketCount;
565 } XAUDIO2_BUFFER_WMA;
567 typedef struct XAUDIO2_VOICE_STATE
569 void* pCurrentBufferContext;
570 UINT32 BuffersQueued;
571 UINT64 SamplesPlayed;
572 } XAUDIO2_VOICE_STATE;
575 local
577 /* XAudio2 2.0's IXAudio2SourceVoice interface. Actually called
578 * IXAudio2SourceVoice in the Mar 2008 DX SDK */
579 interface IXAudio20SourceVoice : IXAudio20Voice
581 HRESULT Start(
582 [in, defaultvalue(0)] UINT32 Flags,
583 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
585 HRESULT Stop(
586 [in, defaultvalue(0)] UINT32 Flags,
587 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
589 HRESULT SubmitSourceBuffer(
590 [in] const XAUDIO2_BUFFER* pBuffer,
591 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
593 HRESULT FlushSourceBuffers();
595 HRESULT Discontinuity();
597 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
599 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
601 HRESULT SetFrequencyRatio(
602 [in] float Ratio,
603 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
605 void GetFrequencyRatio([out] float* pRatio);
609 local
611 /* XAudio2 2.3's IXAudio2SourceVoice interface. Actually called
612 * IXAudio2SourceVoice in the Nov 2008 DX SDK */
613 interface IXAudio23SourceVoice : IXAudio23Voice
615 HRESULT Start(
616 [in, defaultvalue(0)] UINT32 Flags,
617 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
619 HRESULT Stop(
620 [in, defaultvalue(0)] UINT32 Flags,
621 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
623 HRESULT SubmitSourceBuffer(
624 [in] const XAUDIO2_BUFFER* pBuffer,
625 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
627 HRESULT FlushSourceBuffers();
629 HRESULT Discontinuity();
631 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
633 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
635 HRESULT SetFrequencyRatio(
636 [in] float Ratio,
637 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
639 void GetFrequencyRatio([out] float* pRatio);
643 local
645 /* XAudio2 2.7's IXAudio2SourceVoice interface. Actually called
646 * IXAudio2SourceVoice in the Jun 2010 DX SDK */
647 interface IXAudio27SourceVoice : IXAudio2Voice
649 HRESULT Start(
650 [in, defaultvalue(0)] UINT32 Flags,
651 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
653 HRESULT Stop(
654 [in, defaultvalue(0)] UINT32 Flags,
655 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
657 HRESULT SubmitSourceBuffer(
658 [in] const XAUDIO2_BUFFER* pBuffer,
659 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
661 HRESULT FlushSourceBuffers();
663 HRESULT Discontinuity();
665 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
667 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
669 HRESULT SetFrequencyRatio(
670 [in] float Ratio,
671 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
673 void GetFrequencyRatio([out] float* pRatio);
675 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
679 local
681 /* XAudio2 2.8's IXAudio2SourceVoice interface. */
682 interface IXAudio2SourceVoice : IXAudio2Voice
684 HRESULT Start(
685 [in, defaultvalue(0)] UINT32 Flags,
686 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
688 HRESULT Stop(
689 [in, defaultvalue(0)] UINT32 Flags,
690 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
692 HRESULT SubmitSourceBuffer(
693 [in] const XAUDIO2_BUFFER* pBuffer,
694 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
696 HRESULT FlushSourceBuffers();
698 HRESULT Discontinuity();
700 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
702 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState, [in, defaultvalue(0)] UINT32 Flags);
704 HRESULT SetFrequencyRatio(
705 [in] float Ratio,
706 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
708 void GetFrequencyRatio([out] float* pRatio);
710 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
714 local
716 /* XAudio2 2.0's IXAudio2SubmixVoice interface. Actually called
717 * IXAudio2SubmixVoice in the Mar 2008 DX SDK */
718 interface IXAudio20SubmixVoice : IXAudio20Voice
723 local
725 /* XAudio2 2.3's IXAudio2SubmixVoice interface. Actually called
726 * IXAudio2SubmixVoice in the Nov 2008 DX SDK */
727 interface IXAudio23SubmixVoice : IXAudio23Voice
732 local
734 interface IXAudio2SubmixVoice : IXAudio2Voice
739 local
741 /* XAudio2 2.0's IXAudio2MasteringVoice interface. Actually called
742 * IXAudio2MasteringVoice in the Mar 2008 DX SDK */
743 interface IXAudio20MasteringVoice : IXAudio20Voice
748 local
750 /* XAudio2 2.3's IXAudio2MasteringVoice interface. Actually called
751 * IXAudio2MasteringVoice in the Nov 2008 DX SDK */
752 interface IXAudio23MasteringVoice : IXAudio23Voice
757 local
759 interface IXAudio2MasteringVoice : IXAudio2Voice
761 /* not present in XAudio2 2.7 */
762 void GetChannelMask([out] DWORD *pChannelMask);
766 object,
767 local
769 interface IXAudio20VoiceCallback
771 void OnVoiceProcessingPassStart();
773 void OnVoiceProcessingPassEnd();
775 void OnStreamEnd();
777 void OnBufferStart([in] void* pBufferContext);
779 void OnBufferEnd([in] void* pBufferContext);
781 void OnLoopEnd([in] void* pBufferContext);
783 void OnVoiceError(
784 [in] void* pBuffercontext,
785 [in] HRESULT Error);
789 object,
790 local
792 interface IXAudio2VoiceCallback
794 void OnVoiceProcessingPassStart([in] UINT32 BytesRequired);
796 void OnVoiceProcessingPassEnd();
798 void OnStreamEnd();
800 void OnBufferStart([in] void* pBufferContext);
802 void OnBufferEnd([in] void* pBufferContext);
804 void OnLoopEnd([in] void* pBufferContext);
806 void OnVoiceError(
807 [in] void* pBuffercontext,
808 [in] HRESULT Error);
811 typedef struct XAUDIO2_DEBUG_CONFIGURATION
813 UINT32 TraceMask;
814 UINT32 BreakMask;
815 BOOL LogThreadID;
816 BOOL LogFileline;
817 BOOL LogFunctionName;
818 BOOL LogTiming;
819 } XAUDIO2_DEBUG_CONFIGURATION;
822 object,
823 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
825 /* XAudio2 2.0's IXAudio2 interface. Actually called IXAudio2 in the Mar 2008
826 * DX SDK */
827 interface IXAudio20 : IUnknown
829 HRESULT GetDeviceCount([out] UINT32* pCount);
831 HRESULT GetDeviceDetails(
832 [in] UINT32 Index,
833 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
835 HRESULT Initialize(
836 [in, defaultvalue(0)] UINT32 Flags,
837 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
839 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
841 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
843 HRESULT CreateSourceVoice(
844 [out] IXAudio2SourceVoice** ppSourceVoice,
845 [in] const WAVEFORMATEX* pSourceFormat,
846 [in, defaultvalue(0)] UINT32 Flags,
847 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
848 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
849 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
850 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
852 HRESULT CreateSubmixVoice(
853 [out] IXAudio2SubmixVoice** ppSubmixVoice,
854 [in] UINT32 InputChannels,
855 [in] UINT32 InputSampleRate,
856 [in, defaultvalue(0)] UINT32 Flags,
857 [in, defaultvalue(0)] UINT32 ProcessingStage,
858 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
859 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
861 HRESULT CreateMasteringVoice(
862 [out] IXAudio2MasteringVoice** ppMasteringVoice,
863 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
864 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
865 [in, defaultvalue(0)] UINT32 Flags,
866 [in, defaultvalue(0)] UINT32 DeviceIndex,
867 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
869 HRESULT StartEngine();
871 void StopEngine();
873 HRESULT CommitChanges([in] UINT32 OperationSet);
875 void GetPerformanceData([out] XAUDIO20_PERFORMANCE_DATA* pPerfData);
877 [local] void SetDebugConfiguration(
878 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
879 [in, defaultvalue(NULL)] void* pReserved);
883 object,
884 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
886 /* XAudio2 2.2's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
887 * DX SDK */
888 interface IXAudio22 : IUnknown
890 HRESULT GetDeviceCount([out] UINT32* pCount);
892 HRESULT GetDeviceDetails(
893 [in] UINT32 Index,
894 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
896 HRESULT Initialize(
897 [in, defaultvalue(0)] UINT32 Flags,
898 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
900 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
902 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
904 HRESULT CreateSourceVoice(
905 [out] IXAudio2SourceVoice** ppSourceVoice,
906 [in] const WAVEFORMATEX* pSourceFormat,
907 [in, defaultvalue(0)] UINT32 Flags,
908 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
909 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
910 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
911 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
913 HRESULT CreateSubmixVoice(
914 [out] IXAudio2SubmixVoice** ppSubmixVoice,
915 [in] UINT32 InputChannels,
916 [in] UINT32 InputSampleRate,
917 [in, defaultvalue(0)] UINT32 Flags,
918 [in, defaultvalue(0)] UINT32 ProcessingStage,
919 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
920 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
922 HRESULT CreateMasteringVoice(
923 [out] IXAudio2MasteringVoice** ppMasteringVoice,
924 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
925 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
926 [in, defaultvalue(0)] UINT32 Flags,
927 [in, defaultvalue(0)] UINT32 DeviceIndex,
928 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
930 HRESULT StartEngine();
932 void StopEngine();
934 HRESULT CommitChanges([in] UINT32 OperationSet);
936 void GetPerformanceData([out] XAUDIO22_PERFORMANCE_DATA* pPerfData);
938 [local] void SetDebugConfiguration(
939 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
940 [in, defaultvalue(NULL)] void* pReserved);
944 object,
945 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb),
947 /* XAudio2 2.7's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
948 * DX SDK */
949 interface IXAudio27 : IUnknown
951 HRESULT GetDeviceCount([out] UINT32* pCount);
953 HRESULT GetDeviceDetails(
954 [in] UINT32 Index,
955 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
957 HRESULT Initialize(
958 [in, defaultvalue(0)] UINT32 Flags,
959 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
961 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
963 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
965 HRESULT CreateSourceVoice(
966 [out] IXAudio2SourceVoice** ppSourceVoice,
967 [in] const WAVEFORMATEX* pSourceFormat,
968 [in, defaultvalue(0)] UINT32 Flags,
969 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
970 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
971 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
972 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
974 HRESULT CreateSubmixVoice(
975 [out] IXAudio2SubmixVoice** ppSubmixVoice,
976 [in] UINT32 InputChannels,
977 [in] UINT32 InputSampleRate,
978 [in, defaultvalue(0)] UINT32 Flags,
979 [in, defaultvalue(0)] UINT32 ProcessingStage,
980 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
981 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
983 HRESULT CreateMasteringVoice(
984 [out] IXAudio2MasteringVoice** ppMasteringVoice,
985 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
986 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
987 [in, defaultvalue(0)] UINT32 Flags,
988 [in, defaultvalue(0)] UINT32 DeviceIndex,
989 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
991 HRESULT StartEngine();
993 void StopEngine();
995 HRESULT CommitChanges([in] UINT32 OperationSet);
997 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
999 [local] void SetDebugConfiguration(
1000 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
1001 [in, defaultvalue(NULL)] void* pReserved);
1004 /* XAudio2 2.8's IXAudio2 is identical to 2.9's */
1005 cpp_quote("DEFINE_GUID(IID_IXAudio28, 0x60d8dac8, 0x5aa1, 0x4e8e, 0xb5, 0x97, 0x2f, 0x5e, 0x28, 0x83, 0xd4, 0x84);")
1008 object,
1009 uuid(2b02e3cf-2e0b-4ec3-be45-1b2a3fe7210d)
1011 /* XAudio2 2.9's IXAudio2 interface. */
1012 interface IXAudio2 : IUnknown
1014 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
1016 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
1018 HRESULT CreateSourceVoice(
1019 [out] IXAudio2SourceVoice** ppSourceVoice,
1020 [in] const WAVEFORMATEX* pSourceFormat,
1021 [in, defaultvalue(0)] UINT32 Flags,
1022 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
1023 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
1024 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
1025 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
1027 HRESULT CreateSubmixVoice(
1028 [out] IXAudio2SubmixVoice** ppSubmixVoice,
1029 [in] UINT32 InputChannels,
1030 [in] UINT32 InputSampleRate,
1031 [in, defaultvalue(0)] UINT32 Flags,
1032 [in, defaultvalue(0)] UINT32 ProcessingStage,
1033 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
1034 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
1036 HRESULT CreateMasteringVoice(
1037 [out] IXAudio2MasteringVoice** ppMasteringVoice,
1038 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
1039 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
1040 [in, defaultvalue(0)] UINT32 Flags,
1041 [in, defaultvalue(NULL)] LPCWSTR DeviceId,
1042 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain,
1043 [in, defaultvalue(AudioCategory_GameEffects)] AUDIO_STREAM_CATEGORY StreamCategory);
1045 HRESULT StartEngine();
1047 void StopEngine();
1049 HRESULT CommitChanges([in] UINT32 OperationSet);
1051 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
1053 [local] void SetDebugConfiguration(
1054 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
1055 [in, defaultvalue(NULL)] void* pReserved);
1058 const UINT32 XAUDIO2_DEBUG_ENGINE = 1;
1059 const UINT32 XAUDIO2_VOICE_NOPITCH = 2;
1060 const UINT32 XAUDIO2_VOICE_NOSRC = 4;
1061 const UINT32 XAUDIO2_VOICE_USEFILTER = 8;
1062 const UINT32 XAUDIO2_VOICE_MUSIC = 16;
1063 const UINT32 XAUDIO2_PLAY_TAILS = 32;
1064 const UINT32 XAUDIO2_END_OF_STREAM = 64;
1065 const UINT32 XAUDIO2_SEND_USEFILTER = 128;
1066 const UINT32 XAUDIO2_VOICE_NOSAMPLESPLAYED = 256;
1068 const XAUDIO2_FILTER_TYPE XAUDIO2_DEFAULT_FILTER_TYPE = LowPassFilter;
1069 const float XAUDIO2_DEFAULT_FILTER_FREQUENCY = XAUDIO2_MAX_FILTER_FREQUENCY;
1070 const float XAUDIO2_DEFAULT_FILTER_ONEOVERQ = 1.0;
1071 const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
1072 const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
1073 const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
1075 const HRESULT XAUDIO2_E_INVALID_CALL = 0x88960001;
1076 const HRESULT XAUDIO2_E_XMA_DECODER_ERROR = 0x88960002;
1077 const HRESULT XAUDIO2_E_XAPO_CREATION_FAILED = 0x88960003;
1078 const HRESULT XAUDIO2_E_DEVICE_INVALIDATED = 0x88960004;
1080 /* xaudio 2.0 error codes */
1081 const HRESULT XAUDIO20_E_XMA_DECODER_ERROR = 0x88960001;
1082 const HRESULT XAUDIO20_E_XAPO_CREATION_FAILED = 0x88960002;
1083 const HRESULT XAUDIO20_E_DEVICE_INVALIDATED = 0x88960003;
1085 cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
1086 cpp_quote("#define _USE_MATH_DEFINES")
1087 cpp_quote("#include <math.h>")
1088 cpp_quote("inline static float XAudio2DecibelsToAmplitudeRatio(float decibels) { return powf(10.0f, decibels/20.0f); }")
1089 cpp_quote("inline static float XAudio2AmplitudeRatioToDecibels(float volume) { if (volume == 0) { return -3.402823466e+38f; } return 20.0f * log10f(volume); }")
1090 cpp_quote("inline static float XAudio2SemitonesToFrequencyRatio(float semitones) { return powf(2.0f, semitones/12.0f); }")
1091 cpp_quote("inline static float XAudio2FrequencyRatioToSemitones(float freqratio) { return 39.86313713864835f * log10f(freqratio); }")
1092 cpp_quote("inline static float XAudio2CutoffFrequencyToRadians(float cutofffreq, UINT32 samplerate) { if ((UINT32)(cutofffreq * 6.0f) >= samplerate) { return XAUDIO2_MAX_FILTER_FREQUENCY; } return 2.0f * sinf((float)M_PI * cutofffreq / samplerate); }")
1093 cpp_quote("inline static float XAudio2RadiansToCutoffFrequency(float radians, float samplerate) { return samplerate * asinf(radians/2.0f) / (float)M_PI; }")
1094 cpp_quote("#endif")
1096 cpp_quote("HRESULT WINAPI XAudio2Create(IXAudio2** pxaudio2, UINT32 flags, XAUDIO2_PROCESSOR processor);")
1098 cpp_quote("#include <poppack.h>")