msi: Add a trace to msi_get_property.
[wine.git] / include / xaudio2.idl
blob5d4726a8545e873c36d11af504101c1292a42073
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(5a508685-a254-4fba-9b82-9a24b00306af)
29 coclass XAudio2 {
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(db05ea35-0329-4d4b-a53a-6dead03d3852)
78 coclass XAudio2Debug {
79 interface IUnknown;
82 cpp_quote("#if 0")
83 typedef struct WAVEFORMATEX
85 WORD wFormatTag;
86 WORD nChannels;
87 DWORD nSamplesPerSec;
88 DWORD nAvgBytesPerSec;
89 WORD nBlockAlign;
90 WORD wBitsPerSample;
91 WORD cbSize;
92 } WAVEFORMATEX;
94 typedef struct {
95 WAVEFORMATEX Format;
96 union {
97 WORD wValidBitsPerSample;
98 WORD wSamplesPerBlock;
99 WORD wReserved;
100 } Samples;
101 DWORD dwChannelMask;
102 GUID SubFormat;
103 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
104 cpp_quote("#else")
105 cpp_quote("#include <mmreg.h>")
106 cpp_quote("#endif")
108 interface IXAudio2Voice;
110 typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
112 Processor1 = 0x00000001,
113 Processor2 = 0x00000002,
114 Processor3 = 0x00000004,
115 Processor4 = 0x00000008,
116 Processor5 = 0x00000010,
117 Processor6 = 0x00000020,
118 Processor7 = 0x00000040,
119 Processor8 = 0x00000080,
120 Processor9 = 0x00000100,
121 Processor10 = 0x00000200,
122 Processor11 = 0x00000400,
123 Processor12 = 0x00000800,
124 Processor13 = 0x00001000,
125 Processor14 = 0x00002000,
126 Processor15 = 0x00004000,
127 Processor16 = 0x00008000,
128 Processor17 = 0x00010000,
129 Processor18 = 0x00020000,
130 Processor19 = 0x00040000,
131 Processor20 = 0x00080000,
132 Processor21 = 0x00100000,
133 Processor22 = 0x00200000,
134 Processor23 = 0x00400000,
135 Processor24 = 0x00800000,
136 Processor25 = 0x01000000,
137 Processor26 = 0x02000000,
138 Processor27 = 0x04000000,
139 Processor28 = 0x08000000,
140 Processor29 = 0x10000000,
141 Processor30 = 0x20000000,
142 Processor31 = 0x40000000,
143 Processor32 = 0x80000000,
144 XAUDIO2_ANY_PROCESSOR = 0xffffffff,
145 XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
146 } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
148 typedef struct XAUDIO2_PERFORMANCE_DATA
150 UINT64 AudioCyclesSinceLastQuery;
151 UINT64 TotalCyclesSinceLastQuery;
152 UINT32 MinimumCyclesPerQuantum;
153 UINT32 MaximumCyclesPerQuantum;
154 UINT32 MemoryUsageInBytes;
155 UINT32 CurrentLatencyInSamples;
156 UINT32 GlitchesSinceEngineStarted;
157 UINT32 ActiveSourceVoiceCount;
158 UINT32 TotalSourceVoiceCount;
159 UINT32 ActiveSubmixVoiceCount;
160 UINT32 ActiveResamplerCount;
161 UINT32 ActiveMatrixMixCount;
162 UINT32 ActiveXmaSourceVoices;
163 UINT32 ActiveXmaStreams;
164 } XAUDIO2_PERFORMANCE_DATA;
166 typedef struct XAUDIO22_PERFORMANCE_DATA
168 UINT64 AudioCyclesSinceLastQuery;
169 UINT64 TotalCyclesSinceLastQuery;
170 UINT32 MinimumCyclesPerQuantum;
171 UINT32 MaximumCyclesPerQuantum;
172 UINT32 MemoryUsageInBytes;
173 UINT32 CurrentLatencyInSamples;
174 UINT32 GlitchesSinceEngineStarted;
175 UINT32 ActiveSourceVoiceCount;
176 UINT32 TotalSourceVoiceCount;
177 UINT32 ActiveSubmixVoiceCount;
178 UINT32 TotalSubmixVoiceCount;
179 UINT32 ActiveXmaSourceVoices;
180 UINT32 ActiveXmaStreams;
181 } XAUDIO22_PERFORMANCE_DATA;
183 typedef enum XAUDIO2_DEVICE_ROLE
185 NotDefaultDevice = 0x0,
186 DefaultConsoleDevice = 0x1,
187 DefaultMultimediaDevice = 0x2,
188 DefaultCommunicationsDevice = 0x4,
189 DefaultGameDevice = 0x8,
190 GlobalDefaultDevice = 0xf,
191 InvalidDeviceRole = ~GlobalDefaultDevice
192 } XAUDIO2_DEVICE_ROLE;
194 typedef struct XAUDIO2_DEVICE_DETAILS
196 WCHAR DeviceID[256];
197 WCHAR DisplayName[256];
198 XAUDIO2_DEVICE_ROLE Role;
199 WAVEFORMATEXTENSIBLE OutputFormat;
200 } XAUDIO2_DEVICE_DETAILS;
202 typedef struct XAUDIO2_VOICE_DETAILS
204 UINT32 CreationFlags;
205 UINT32 InputChannels;
206 UINT32 InputSampleRate;
207 } XAUDIO2_VOICE_DETAILS;
209 typedef struct XAUDIO2_SEND_DESCRIPTOR
211 UINT32 Flags;
212 IXAudio2Voice* pOutputVoice;
213 } XAUDIO2_SEND_DESCRIPTOR;
215 /* XAudio2 2.3's XAUDIO2_VOICE_SENDS struct */
216 typedef struct XAUDIO23_VOICE_SENDS
218 UINT32 OutputCount;
219 IXAudio2Voice **pOutputVoices;
220 } XAUDIO23_VOICE_SENDS;
222 typedef struct XAUDIO2_VOICE_SENDS
224 UINT32 SendCount;
225 XAUDIO2_SEND_DESCRIPTOR* pSends;
226 } XAUDIO2_VOICE_SENDS;
228 typedef struct XAUDIO2_EFFECT_DESCRIPTOR
230 IUnknown* pEffect;
231 BOOL InitialState;
232 UINT32 OutputChannels;
233 } XAUDIO2_EFFECT_DESCRIPTOR;
235 typedef struct XAUDIO2_EFFECT_CHAIN
237 UINT32 EffectCount;
238 XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors;
239 } XAUDIO2_EFFECT_CHAIN;
241 const UINT32 XAUDIO2_MAX_BUFFER_BYTES = 0x80000000;
242 const UINT32 XAUDIO2_MAX_QUEUED_BUFFERS = 64;
243 const UINT32 XAUDIO2_MAX_BUFFERS_SYSTEM = 2;
244 const UINT32 XAUDIO2_MAX_AUDIO_CHANNELS = 64;
245 const UINT32 XAUDIO2_MIN_SAMPLE_RATE = 1000;
246 const UINT32 XAUDIO2_MAX_SAMPLE_RATE = 200000;
247 const float XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0;
248 const float XAUDIO2_MIN_FREQ_RATIO = (1/1024.0);
249 const float XAUDIO2_MAX_FREQ_RATIO = 1024.0;
250 const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
251 const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
252 const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
253 const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
255 const UINT32 XAUDIO2_COMMIT_NOW = 0;
256 const UINT32 XAUDIO2_COMMIT_ALL = 0;
257 const UINT32 XAUDIO2_INVALID_OPSET = 0xffffffff;
258 const UINT32 XAUDIO2_NO_LOOP_REGION = 0;
259 const UINT32 XAUDIO2_LOOP_INFINITE = 255;
260 const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
261 const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
264 object,
265 local
267 interface IXAudio2EngineCallback
269 void OnProcessingPassStart();
271 void OnProcessingPassEnd();
273 void OnCriticalError([in] HRESULT Error);
276 typedef enum XAUDIO2_FILTER_TYPE
278 LowPassFilter,
279 BandPassFilter,
280 HighPassFilter,
281 NotchFilter
282 } XAUDIO2_FILTER_TYPE;
284 typedef struct XAUDIO2_FILTER_PARAMETERS
286 XAUDIO2_FILTER_TYPE Type;
287 float Frequency;
288 float OneOverQ;
289 } XAUDIO2_FILTER_PARAMETERS;
291 /* XAudio 2.3's IXAudio2Voice */
292 /* XAudio2 2.3's IXAudio2Voice interface. Actually called
293 * IXAudio2Voice in the Nov 2008 DX SDK */
295 object,
296 local
298 interface IXAudio23Voice
300 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
302 HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
304 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
306 HRESULT EnableEffect(
307 [in] UINT32 EffectIndex,
308 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
310 HRESULT DisableEffect(
311 [in] UINT32 EffectIndex,
312 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
314 void GetEffectState(
315 [in] UINT32 EffectIndex,
316 [out] BOOL* pEnabled);
318 HRESULT SetEffectParameters(
319 [in] UINT32 EffectIndex,
320 [in] const void* pParameters,
321 [in] UINT32 ParametersByteSize,
322 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
324 HRESULT GetEffectParameters(
325 [in] UINT32 EffectIndex,
326 [out] void* pParameters,
327 [in] UINT32 ParametersByteSize);
329 HRESULT SetFilterParameters(
330 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
331 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
333 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
335 HRESULT SetVolume(
336 [in] float Volume,
337 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
339 void GetVolume([out] float* pVolume);
341 HRESULT SetChannelVolumes(
342 [in] UINT32 Channels,
343 [in, size_is(Channels)] const float* pVolumes,
344 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
346 void GetChannelVolumes(
347 [in] UINT32 Channels,
348 [out, size_is(Channels)] float* pVolumes);
350 HRESULT SetOutputMatrix(
351 [in] IXAudio2Voice* pDestinationVoice,
352 [in] UINT32 SourceChannels,
353 [in] UINT32 DestinationChannels,
354 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
355 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
357 void GetOutputMatrix(
358 [in] IXAudio2Voice* pDestinationVoice,
359 [in] UINT32 SourceChannels,
360 [in] UINT32 DestinationChannels,
361 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
363 void DestroyVoice();
366 object,
367 local
369 interface IXAudio2Voice
371 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
373 HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
375 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
377 HRESULT EnableEffect(
378 [in] UINT32 EffectIndex,
379 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
381 HRESULT DisableEffect(
382 [in] UINT32 EffectIndex,
383 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
385 void GetEffectState(
386 [in] UINT32 EffectIndex,
387 [out] BOOL* pEnabled);
389 HRESULT SetEffectParameters(
390 [in] UINT32 EffectIndex,
391 [in] const void* pParameters,
392 [in] UINT32 ParametersByteSize,
393 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
395 HRESULT GetEffectParameters(
396 [in] UINT32 EffectIndex,
397 [out] void* pParameters,
398 [in] UINT32 ParametersByteSize);
400 HRESULT SetFilterParameters(
401 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
402 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
404 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
406 HRESULT SetOutputFilterParameters(
407 [in] IXAudio2Voice* pDestinationVoice,
408 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
409 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
411 void GetOutputFilterParameters(
412 [in] IXAudio2Voice* pDestinationVoice,
413 [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
415 HRESULT SetVolume(
416 [in] float Volume,
417 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
419 void GetVolume([out] float* pVolume);
421 HRESULT SetChannelVolumes(
422 [in] UINT32 Channels,
423 [in, size_is(Channels)] const float* pVolumes,
424 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
426 void GetChannelVolumes(
427 [in] UINT32 Channels,
428 [out, size_is(Channels)] float* pVolumes);
430 HRESULT SetOutputMatrix(
431 [in] IXAudio2Voice* pDestinationVoice,
432 [in] UINT32 SourceChannels,
433 [in] UINT32 DestinationChannels,
434 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
435 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
437 void GetOutputMatrix(
438 [in] IXAudio2Voice* pDestinationVoice,
439 [in] UINT32 SourceChannels,
440 [in] UINT32 DestinationChannels,
441 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
443 void DestroyVoice();
446 typedef struct XAUDIO2_BUFFER
448 UINT32 Flags;
449 UINT32 AudioBytes;
450 const BYTE* pAudioData;
451 UINT32 PlayBegin;
452 UINT32 PlayLength;
453 UINT32 LoopBegin;
454 UINT32 LoopLength;
455 UINT32 LoopCount;
456 void* pContext;
457 } XAUDIO2_BUFFER;
459 typedef struct XAUDIO2_BUFFER_WMA
461 const UINT32* pDecodedPacketCumulativeBytes;
462 UINT32 PacketCount;
463 } XAUDIO2_BUFFER_WMA;
465 typedef struct XAUDIO2_VOICE_STATE
467 void* pCurrentBufferContext;
468 UINT32 BuffersQueued;
469 UINT64 SamplesPlayed;
470 } XAUDIO2_VOICE_STATE;
473 local
475 /* XAudio2 2.3's IXAudio2SourceVoice interface. Actually called
476 * IXAudio2SourceVoice in the Nov 2008 DX SDK */
477 interface IXAudio23SourceVoice : IXAudio23Voice
479 HRESULT Start(
480 [in, defaultvalue(0)] UINT32 Flags,
481 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
483 HRESULT Stop(
484 [in, defaultvalue(0)] UINT32 Flags,
485 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
487 HRESULT SubmitSourceBuffer(
488 [in] const XAUDIO2_BUFFER* pBuffer,
489 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
491 HRESULT FlushSourceBuffers();
493 HRESULT Discontinuity();
495 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
497 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
499 HRESULT SetFrequencyRatio(
500 [in] float Ratio,
501 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
503 void GetFrequencyRatio([out] float* pRatio);
507 local
509 /* XAudio2 2.7's IXAudio2SourceVoice interface. Actually called
510 * IXAudio2SourceVoice in the Jun 2010 DX SDK */
511 interface IXAudio27SourceVoice : IXAudio2Voice
513 HRESULT Start(
514 [in, defaultvalue(0)] UINT32 Flags,
515 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
517 HRESULT Stop(
518 [in, defaultvalue(0)] UINT32 Flags,
519 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
521 HRESULT SubmitSourceBuffer(
522 [in] const XAUDIO2_BUFFER* pBuffer,
523 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
525 HRESULT FlushSourceBuffers();
527 HRESULT Discontinuity();
529 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
531 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
533 HRESULT SetFrequencyRatio(
534 [in] float Ratio,
535 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
537 void GetFrequencyRatio([out] float* pRatio);
539 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
543 local
545 /* XAudio2 2.8's IXAudio2SourceVoice interface. */
546 interface IXAudio2SourceVoice : IXAudio2Voice
548 HRESULT Start(
549 [in, defaultvalue(0)] UINT32 Flags,
550 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
552 HRESULT Stop(
553 [in, defaultvalue(0)] UINT32 Flags,
554 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
556 HRESULT SubmitSourceBuffer(
557 [in] const XAUDIO2_BUFFER* pBuffer,
558 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
560 HRESULT FlushSourceBuffers();
562 HRESULT Discontinuity();
564 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
566 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState, [in, defaultvalue(0)] UINT32 Flags);
568 HRESULT SetFrequencyRatio(
569 [in] float Ratio,
570 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
572 void GetFrequencyRatio([out] float* pRatio);
574 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
578 local
580 /* XAudio2 2.3's IXAudio2SubmixVoice interface. Actually called
581 * IXAudio2SubmixVoice in the Nov 2008 DX SDK */
582 interface IXAudio23SubmixVoice : IXAudio23Voice
587 local
589 interface IXAudio2SubmixVoice : IXAudio2Voice
594 local
596 /* XAudio2 2.3's IXAudio2MasteringVoice interface. Actually called
597 * IXAudio2MasteringVoice in the Nov 2008 DX SDK */
598 interface IXAudio23MasteringVoice : IXAudio23Voice
603 local
605 interface IXAudio2MasteringVoice : IXAudio2Voice
607 /* not present in XAudio2 2.7 */
608 void GetChannelMask([out] DWORD *pChannelMask);
612 object,
613 local
615 interface IXAudio2VoiceCallback
617 void OnVoiceProcessingPassStart([in] UINT32 BytesRequired);
619 void OnVoiceProcessingPassEnd();
621 void OnStreamEnd();
623 void OnBufferStart([in] void* pBufferContext);
625 void OnBufferEnd([in] void* pBufferContext);
627 void OnLoopEnd([in] void* pBufferContext);
629 void OnVoiceError(
630 [in] void* pBuffercontext,
631 [in] HRESULT Error);
634 typedef struct XAUDIO2_DEBUG_CONFIGURATION
636 UINT32 TraceMask;
637 UINT32 BreakMask;
638 BOOL LogThreadID;
639 BOOL LogFileline;
640 BOOL LogFunctionName;
641 BOOL LogTiming;
642 } XAUDIO2_DEBUG_CONFIGURATION;
645 object,
646 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
648 /* XAudio2 2.2's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
649 * DX SDK */
650 interface IXAudio22 : IUnknown
652 HRESULT GetDeviceCount([out] UINT32* pCount);
654 HRESULT GetDeviceDetails(
655 [in] UINT32 Index,
656 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
658 HRESULT Initialize(
659 [in, defaultvalue(0)] UINT32 Flags,
660 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
662 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
664 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
666 HRESULT CreateSourceVoice(
667 [out] IXAudio2SourceVoice** ppSourceVoice,
668 [in] const WAVEFORMATEX* pSourceFormat,
669 [in, defaultvalue(0)] UINT32 Flags,
670 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
671 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
672 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
673 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
675 HRESULT CreateSubmixVoice(
676 [out] IXAudio2SubmixVoice** ppSubmixVoice,
677 [in] UINT32 InputChannels,
678 [in] UINT32 InputSampleRate,
679 [in, defaultvalue(0)] UINT32 Flags,
680 [in, defaultvalue(0)] UINT32 ProcessingStage,
681 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
682 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
684 HRESULT CreateMasteringVoice(
685 [out] IXAudio2MasteringVoice** ppMasteringVoice,
686 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
687 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
688 [in, defaultvalue(0)] UINT32 Flags,
689 [in, defaultvalue(0)] UINT32 DeviceIndex,
690 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
692 HRESULT StartEngine();
694 void StopEngine();
696 HRESULT CommitChanges([in] UINT32 OperationSet);
698 void GetPerformanceData([out] XAUDIO22_PERFORMANCE_DATA* pPerfData);
700 [local] void SetDebugConfiguration(
701 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
702 [in, defaultvalue(NULL)] void* pReserved);
706 object,
707 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb),
709 /* XAudio2 2.7's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
710 * DX SDK */
711 interface IXAudio27 : IUnknown
713 HRESULT GetDeviceCount([out] UINT32* pCount);
715 HRESULT GetDeviceDetails(
716 [in] UINT32 Index,
717 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
719 HRESULT Initialize(
720 [in, defaultvalue(0)] UINT32 Flags,
721 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
723 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
725 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
727 HRESULT CreateSourceVoice(
728 [out] IXAudio2SourceVoice** ppSourceVoice,
729 [in] const WAVEFORMATEX* pSourceFormat,
730 [in, defaultvalue(0)] UINT32 Flags,
731 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
732 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
733 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
734 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
736 HRESULT CreateSubmixVoice(
737 [out] IXAudio2SubmixVoice** ppSubmixVoice,
738 [in] UINT32 InputChannels,
739 [in] UINT32 InputSampleRate,
740 [in, defaultvalue(0)] UINT32 Flags,
741 [in, defaultvalue(0)] UINT32 ProcessingStage,
742 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
743 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
745 HRESULT CreateMasteringVoice(
746 [out] IXAudio2MasteringVoice** ppMasteringVoice,
747 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
748 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
749 [in, defaultvalue(0)] UINT32 Flags,
750 [in, defaultvalue(0)] UINT32 DeviceIndex,
751 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
753 HRESULT StartEngine();
755 void StopEngine();
757 HRESULT CommitChanges([in] UINT32 OperationSet);
759 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
761 [local] void SetDebugConfiguration(
762 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
763 [in, defaultvalue(NULL)] void* pReserved);
767 object,
768 uuid(60d8dac8-5aa1-4e8e-b597-2f5e2883d484),
770 /* XAudio2 2.8's IXAudio2 interface. */
771 interface IXAudio2 : IUnknown
773 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
775 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
777 HRESULT CreateSourceVoice(
778 [out] IXAudio2SourceVoice** ppSourceVoice,
779 [in] const WAVEFORMATEX* pSourceFormat,
780 [in, defaultvalue(0)] UINT32 Flags,
781 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
782 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
783 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
784 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
786 HRESULT CreateSubmixVoice(
787 [out] IXAudio2SubmixVoice** ppSubmixVoice,
788 [in] UINT32 InputChannels,
789 [in] UINT32 InputSampleRate,
790 [in, defaultvalue(0)] UINT32 Flags,
791 [in, defaultvalue(0)] UINT32 ProcessingStage,
792 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
793 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
795 HRESULT CreateMasteringVoice(
796 [out] IXAudio2MasteringVoice** ppMasteringVoice,
797 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
798 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
799 [in, defaultvalue(0)] UINT32 Flags,
800 [in, defaultvalue(NULL)] LPCWSTR DeviceId,
801 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain,
802 [in, defaultvalue(AudioCategory_GameEffects)] AUDIO_STREAM_CATEGORY StreamCategory);
804 HRESULT StartEngine();
806 void StopEngine();
808 HRESULT CommitChanges([in] UINT32 OperationSet);
810 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
812 [local] void SetDebugConfiguration(
813 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
814 [in, defaultvalue(NULL)] void* pReserved);
817 const UINT32 XAUDIO2_DEBUG_ENGINE = 1;
818 const UINT32 XAUDIO2_VOICE_NOPITCH = 2;
819 const UINT32 XAUDIO2_VOICE_NOSRC = 4;
820 const UINT32 XAUDIO2_VOICE_USEFILTER = 8;
821 const UINT32 XAUDIO2_VOICE_MUSIC = 16;
822 const UINT32 XAUDIO2_PLAY_TAILS = 32;
823 const UINT32 XAUDIO2_END_OF_STREAM = 64;
824 const UINT32 XAUDIO2_SEND_USEFILTER = 128;
825 const UINT32 XAUDIO2_VOICE_NOSAMPLESPLAYED = 256;
827 const XAUDIO2_FILTER_TYPE XAUDIO2_DEFAULT_FILTER_TYPE = LowPassFilter;
828 const float XAUDIO2_DEFAULT_FILTER_FREQUENCY = XAUDIO2_MAX_FILTER_FREQUENCY;
829 const float XAUDIO2_DEFAULT_FILTER_ONEOVERQ = 1.0;
830 const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
831 const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
832 const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
834 const HRESULT XAUDIO2_E_INVALID_CALL = 0x88960001;
835 const HRESULT XAUDIO2_E_XMA_DECODER_ERROR = 0x88960002;
836 const HRESULT XAUDIO2_E_XAPO_CREATION_FAILED = 0x88960003;
837 const HRESULT XAUDIO2_E_DEVICE_INVALIDATED = 0x88960004;
839 cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
840 cpp_quote("#define _USE_MATH_DEFINES")
841 cpp_quote("#include <math.h>")
842 cpp_quote("inline static float XAudio2DecibelsToAmplitudeRatio(float decibels) { return powf(10.0f, decibels/20.0f); }")
843 cpp_quote("inline static float XAudio2AmplitudeRatioToDecibels(float volume) { if (volume == 0) { return -3.402823466e+38f; } return 20.0f * log10f(volume); }")
844 cpp_quote("inline static float XAudio2SemitonesToFrequencyRatio(float semitones) { return powf(2.0f, semitones/12.0f); }")
845 cpp_quote("inline static float XAudio2FrequencyRatioToSemitones(float freqratio) { return 39.86313713864835f * log10f(freqratio); }")
846 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); }")
847 cpp_quote("inline static float XAudio2RadiansToCutoffFrequency(float radians, float samplerate) { return samplerate * asinf(radians/2.0f) / (float)M_PI; }")
848 cpp_quote("#endif")
850 cpp_quote("HRESULT WINAPI XAudio2Create(IXAudio2** pxaudio2, UINT32 flags, XAUDIO2_PROCESSOR processor);")
852 cpp_quote("#include <poppack.h>")