ntdll: Use an __ms_va_list in sscanf (Clang).
[wine/multimedia.git] / include / xaudio2.idl
blob3ac3e221adbcc36432cf7f28dea99dd59a86cb8b
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(db05ea35-0329-4d4b-a53a-6dead03d3852)
36 coclass XAudio2Debug {
37 interface IUnknown;
40 cpp_quote("#if 0")
41 typedef struct WAVEFORMATEX
43 WORD wFormatTag;
44 WORD nChannels;
45 DWORD nSamplesPerSec;
46 DWORD nAvgBytesPerSec;
47 WORD nBlockAlign;
48 WORD wBitsPerSample;
49 WORD cbSize;
50 } WAVEFORMATEX;
52 typedef struct {
53 WAVEFORMATEX Format;
54 union {
55 WORD wValidBitsPerSample;
56 WORD wSamplesPerBlock;
57 WORD wReserved;
58 } Samples;
59 DWORD dwChannelMask;
60 GUID SubFormat;
61 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
62 cpp_quote("#else")
63 cpp_quote("#include <mmreg.h>")
64 cpp_quote("#endif")
66 interface IXAudio2Voice;
68 typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
70 Processor1 = 0x00000001,
71 Processor2 = 0x00000002,
72 Processor3 = 0x00000004,
73 Processor4 = 0x00000008,
74 Processor5 = 0x00000010,
75 Processor6 = 0x00000020,
76 Processor7 = 0x00000040,
77 Processor8 = 0x00000080,
78 Processor9 = 0x00000100,
79 Processor10 = 0x00000200,
80 Processor11 = 0x00000400,
81 Processor12 = 0x00000800,
82 Processor13 = 0x00001000,
83 Processor14 = 0x00002000,
84 Processor15 = 0x00004000,
85 Processor16 = 0x00008000,
86 Processor17 = 0x00010000,
87 Processor18 = 0x00020000,
88 Processor19 = 0x00040000,
89 Processor20 = 0x00080000,
90 Processor21 = 0x00100000,
91 Processor22 = 0x00200000,
92 Processor23 = 0x00400000,
93 Processor24 = 0x00800000,
94 Processor25 = 0x01000000,
95 Processor26 = 0x02000000,
96 Processor27 = 0x04000000,
97 Processor28 = 0x08000000,
98 Processor29 = 0x10000000,
99 Processor30 = 0x20000000,
100 Processor31 = 0x40000000,
101 Processor32 = 0x80000000,
102 XAUDIO2_ANY_PROCESSOR = 0xffffffff,
103 XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
104 } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
106 typedef struct XAUDIO2_PERFORMANCE_DATA
108 UINT64 AudioCyclesSinceLastQuery;
109 UINT64 TotalCyclesSinceLastQuery;
110 UINT32 MinimumCyclesPerQuantum;
111 UINT32 MaximumCyclesPerQuantum;
112 UINT32 MemoryUsageInBytes;
113 UINT32 CurrentLatencyInSamples;
114 UINT32 GlitchesSinceEngineStarted;
115 UINT32 ActiveSourceVoiceCount;
116 UINT32 TotalSourceVoiceCount;
117 UINT32 ActiveSubmixVoiceCount;
118 UINT32 ActiveResamplerCount;
119 UINT32 ActiveMatrixMixCount;
120 UINT32 ActiveXmaSourceVoices;
121 UINT32 ActiveXmaStreams;
122 } XAUDIO2_PERFORMANCE_DATA;
124 typedef enum XAUDIO2_DEVICE_ROLE
126 NotDefaultDevice = 0x0,
127 DefaultConsoleDevice = 0x1,
128 DefaultMultimediaDevice = 0x2,
129 DefaultCommunicationsDevice = 0x4,
130 DefaultGameDevice = 0x8,
131 GlobalDefaultDevice = 0xf,
132 InvalidDeviceRole = ~GlobalDefaultDevice
133 } XAUDIO2_DEVICE_ROLE;
135 typedef struct XAUDIO2_DEVICE_DETAILS
137 WCHAR DeviceID[256];
138 WCHAR DisplayName[256];
139 XAUDIO2_DEVICE_ROLE Role;
140 WAVEFORMATEXTENSIBLE OutputFormat;
141 } XAUDIO2_DEVICE_DETAILS;
143 typedef struct XAUDIO2_VOICE_DETAILS
145 UINT32 CreationFlags;
146 UINT32 InputChannels;
147 UINT32 InputSampleRate;
148 } XAUDIO2_VOICE_DETAILS;
150 typedef struct XAUDIO2_SEND_DESCRIPTOR
152 UINT32 Flags;
153 IXAudio2Voice* pOutputVoice;
154 } XAUDIO2_SEND_DESCRIPTOR;
156 typedef struct XAUDIO2_VOICE_SENDS
158 UINT32 SendCount;
159 XAUDIO2_SEND_DESCRIPTOR* pSends;
160 } XAUDIO2_VOICE_SENDS;
162 typedef struct XAUDIO2_EFFECT_DESCRIPTOR
164 IUnknown* pEffect;
165 BOOL InitialState;
166 UINT32 OutputChannels;
167 } XAUDIO2_EFFECT_DESCRIPTOR;
169 typedef struct XAUDIO2_EFFECT_CHAIN
171 UINT32 EffectCount;
172 XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors;
173 } XAUDIO2_EFFECT_CHAIN;
175 const UINT32 XAUDIO2_MAX_BUFFER_BYTES = 0x80000000;
176 const UINT32 XAUDIO2_MAX_QUEUED_BUFFERS = 64;
177 const UINT32 XAUDIO2_MAX_BUFFERS_SYSTEM = 2;
178 const UINT32 XAUDIO2_MAX_AUDIO_CHANNELS = 64;
179 const UINT32 XAUDIO2_MIN_SAMPLE_RATE = 1000;
180 const UINT32 XAUDIO2_MAX_SAMPLE_RATE = 200000;
181 const float XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0;
182 const float XAUDIO2_MIN_FREQ_RATIO = (1/1024.0);
183 const float XAUDIO2_MAX_FREQ_RATIO = 1024.0;
184 const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
185 const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
186 const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
187 const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
189 const UINT32 XAUDIO2_COMMIT_NOW = 0;
190 const UINT32 XAUDIO2_COMMIT_ALL = 0;
191 const UINT32 XAUDIO2_INVALID_OPSET = 0xffffffff;
192 const UINT32 XAUDIO2_NO_LOOP_REGION = 0;
193 const UINT32 XAUDIO2_LOOP_INFINITE = 255;
194 const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
195 const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
198 object,
199 local
201 interface IXAudio2EngineCallback
203 void OnProcessingPassStart();
205 void OnProcessingPassEnd();
207 void OnCriticalError([in] HRESULT Error);
210 typedef enum XAUDIO2_FILTER_TYPE
212 LowPassFilter,
213 BandPassFilter,
214 HighPassFilter,
215 NotchFilter
216 } XAUDIO2_FILTER_TYPE;
218 typedef struct XAUDIO2_FILTER_PARAMETERS
220 XAUDIO2_FILTER_TYPE Type;
221 float Frequency;
222 float OneOverQ;
223 } XAUDIO2_FILTER_PARAMETERS;
226 object,
227 local
229 interface IXAudio2Voice
231 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
233 HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
235 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
237 HRESULT EnableEffect(
238 [in] UINT32 EffectIndex,
239 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
241 HRESULT DisableEffect(
242 [in] UINT32 EffectIndex,
243 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
245 void GetEffectState(
246 [in] UINT32 EffectIndex,
247 [out] BOOL* pEnabled);
249 HRESULT SetEffectParameters(
250 [in] UINT32 EffectIndex,
251 [in] const void* pParameters,
252 [in] UINT32 ParametersByteSize,
253 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
255 HRESULT GetEffectParameters(
256 [in] UINT32 EffectIndex,
257 [out] void* pParameters,
258 [in] UINT32 ParametersByteSize);
260 HRESULT SetFilterParameters(
261 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
262 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
264 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
266 HRESULT SetOutputFilterParameters(
267 [in] IXAudio2Voice* pDestinationVoice,
268 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
269 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
271 void GetOutputFilterParameters(
272 [in] IXAudio2Voice* pDestinationVoice,
273 [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
275 HRESULT SetVolume(
276 [in] float Volume,
277 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
279 void GetVolume([out] float* pVolume);
281 HRESULT SetChannelVolumes(
282 [in] UINT32 Channels,
283 [in, size_is(Channels)] const float* pVolumes,
284 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
286 void GetChannelVolumes(
287 [in] UINT32 Channels,
288 [out, size_is(Channels)] float* pVolumes);
290 HRESULT SetOutputMatrix(
291 [in] IXAudio2Voice* pDestinationVoice,
292 [in] UINT32 SourceChannels,
293 [in] UINT32 DestinationChannels,
294 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
295 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
297 void GetOutputMatrix(
298 [in] IXAudio2Voice* pDestinationVoice,
299 [in] UINT32 SourceChannels,
300 [in] UINT32 DestinationChannels,
301 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
303 void DestroyVoice();
306 typedef struct XAUDIO2_BUFFER
308 UINT32 Flags;
309 UINT32 AudioBytes;
310 const BYTE* pAudioData;
311 UINT32 PlayBegin;
312 UINT32 PlayLength;
313 UINT32 LoopBegin;
314 UINT32 LoopLength;
315 UINT32 LoopCount;
316 void* pContext;
317 } XAUDIO2_BUFFER;
319 typedef struct XAUDIO2_BUFFER_WMA
321 const UINT32* pDecodedPacketCumulativeBytes;
322 UINT32 PacketCount;
323 } XAUDIO2_BUFFER_WMA;
325 typedef struct XAUDIO2_VOICE_STATE
327 void* pCurrentBufferContext;
328 UINT32 BuffersQueued;
329 UINT64 SamplesPlayed;
330 } XAUDIO2_VOICE_STATE;
333 local
335 /* XAudio2 2.7's IXAudio2SourceVoice interface. Actually called
336 * IXAudio2SourceVoice in the Jun 2010 DX SDK */
337 interface IXAudio27SourceVoice : IXAudio2Voice
339 HRESULT Start(
340 [in, defaultvalue(0)] UINT32 Flags,
341 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
343 HRESULT Stop(
344 [in, defaultvalue(0)] UINT32 Flags,
345 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
347 HRESULT SubmitSourceBuffer(
348 [in] const XAUDIO2_BUFFER* pBuffer,
349 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
351 HRESULT FlushSourceBuffers();
353 HRESULT Discontinuity();
355 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
357 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
359 HRESULT SetFrequencyRatio(
360 [in] float Ratio,
361 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
363 void GetFrequencyRatio([out] float* pRatio);
365 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
369 local
371 /* XAudio2 2.8's IXAudio2SourceVoice interface. */
372 interface IXAudio2SourceVoice : IXAudio2Voice
374 HRESULT Start(
375 [in, defaultvalue(0)] UINT32 Flags,
376 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
378 HRESULT Stop(
379 [in, defaultvalue(0)] UINT32 Flags,
380 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
382 HRESULT SubmitSourceBuffer(
383 [in] const XAUDIO2_BUFFER* pBuffer,
384 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
386 HRESULT FlushSourceBuffers();
388 HRESULT Discontinuity();
390 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
392 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState, [in, defaultvalue(0)] UINT32 Flags);
394 HRESULT SetFrequencyRatio(
395 [in] float Ratio,
396 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
398 void GetFrequencyRatio([out] float* pRatio);
400 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
404 local
406 interface IXAudio2SubmixVoice : IXAudio2Voice
411 local
413 interface IXAudio2MasteringVoice : IXAudio2Voice
415 /* not present in XAudio2 2.7 */
416 void GetChannelMask([out] DWORD *pChannelMask);
420 object,
421 local
423 interface IXAudio2VoiceCallback
425 void OnVoiceProcessingPassStart([in] UINT32 BytesRequired);
427 void OnVoiceProcessingPassEnd();
429 void OnStreamEnd();
431 void OnBufferStart([in] void* pBufferContext);
433 void OnBufferEnd([in] void* pBufferContext);
435 void OnLoopEnd([in] void* pBufferContext);
437 void OnVoiceError(
438 [in] void* pBuffercontext,
439 [in] HRESULT Error);
442 typedef struct XAUDIO2_DEBUG_CONFIGURATION
444 UINT32 TraceMask;
445 UINT32 BreakMask;
446 BOOL LogThreadID;
447 BOOL LogFileline;
448 BOOL LogFunctionName;
449 BOOL LogTiming;
450 } XAUDIO2_DEBUG_CONFIGURATION;
453 object,
454 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb),
456 /* XAudio2 2.7's IXAudio2 interface. Actually called IXAudio2 in the Jun 2010
457 * DX SDK */
458 interface IXAudio27 : IUnknown
460 HRESULT GetDeviceCount([out] UINT32* pCount);
462 HRESULT GetDeviceDetails(
463 [in] UINT32 Index,
464 [out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
466 HRESULT Initialize(
467 [in, defaultvalue(0)] UINT32 Flags,
468 [in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
470 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
472 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
474 HRESULT CreateSourceVoice(
475 [out] IXAudio2SourceVoice** ppSourceVoice,
476 [in] const WAVEFORMATEX* pSourceFormat,
477 [in, defaultvalue(0)] UINT32 Flags,
478 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
479 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
480 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
481 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
483 HRESULT CreateSubmixVoice(
484 [out] IXAudio2SubmixVoice** ppSubmixVoice,
485 [in] UINT32 InputChannels,
486 [in] UINT32 InputSampleRate,
487 [in, defaultvalue(0)] UINT32 Flags,
488 [in, defaultvalue(0)] UINT32 ProcessingStage,
489 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
490 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
492 HRESULT CreateMasteringVoice(
493 [out] IXAudio2MasteringVoice** ppMasteringVoice,
494 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
495 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
496 [in, defaultvalue(0)] UINT32 Flags,
497 [in, defaultvalue(0)] UINT32 DeviceIndex,
498 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
500 HRESULT StartEngine();
502 void StopEngine();
504 HRESULT CommitChanges([in] UINT32 OperationSet);
506 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
508 [local] void SetDebugConfiguration(
509 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
510 [in, defaultvalue(NULL)] void* pReserved);
514 object,
515 uuid(60d8dac8-5aa1-4e8e-b597-2f5e2883d484),
517 /* XAudio2 2.8's IXAudio2 interface. */
518 interface IXAudio2 : IUnknown
520 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
522 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
524 HRESULT CreateSourceVoice(
525 [out] IXAudio2SourceVoice** ppSourceVoice,
526 [in] const WAVEFORMATEX* pSourceFormat,
527 [in, defaultvalue(0)] UINT32 Flags,
528 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
529 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
530 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
531 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
533 HRESULT CreateSubmixVoice(
534 [out] IXAudio2SubmixVoice** ppSubmixVoice,
535 [in] UINT32 InputChannels,
536 [in] UINT32 InputSampleRate,
537 [in, defaultvalue(0)] UINT32 Flags,
538 [in, defaultvalue(0)] UINT32 ProcessingStage,
539 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
540 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
542 HRESULT CreateMasteringVoice(
543 [out] IXAudio2MasteringVoice** ppMasteringVoice,
544 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
545 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
546 [in, defaultvalue(0)] UINT32 Flags,
547 [in, defaultvalue(NULL)] LPCWSTR DeviceId,
548 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain,
549 [in, defaultvalue(AudioCategory_GameEffects)] AUDIO_STREAM_CATEGORY StreamCategory);
551 HRESULT StartEngine();
553 void StopEngine();
555 HRESULT CommitChanges([in] UINT32 OperationSet);
557 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
559 [local] void SetDebugConfiguration(
560 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
561 [in, defaultvalue(NULL)] void* pReserved);
564 const UINT32 XAUDIO2_DEBUG_ENGINE = 1;
565 const UINT32 XAUDIO2_VOICE_NOPITCH = 2;
566 const UINT32 XAUDIO2_VOICE_NOSRC = 4;
567 const UINT32 XAUDIO2_VOICE_USEFILTER = 8;
568 const UINT32 XAUDIO2_VOICE_MUSIC = 16;
569 const UINT32 XAUDIO2_PLAY_TAILS = 32;
570 const UINT32 XAUDIO2_END_OF_STREAM = 64;
571 const UINT32 XAUDIO2_SEND_USEFILTER = 128;
572 const UINT32 XAUDIO2_VOICE_NOSAMPLESPLAYED = 256;
574 const XAUDIO2_FILTER_TYPE XAUDIO2_DEFAULT_FILTER_TYPE = LowPassFilter;
575 const float XAUDIO2_DEFAULT_FILTER_FREQUENCY = XAUDIO2_MAX_FILTER_FREQUENCY;
576 const float XAUDIO2_DEFAULT_FILTER_ONEOVERQ = 1.0;
577 const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
578 const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
579 const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
581 const HRESULT XAUDIO2_E_INVALID_CALL = 0x88960001;
582 const HRESULT XAUDIO2_E_XMA_DECODER_ERROR = 0x88960002;
583 const HRESULT XAUDIO2_E_XAPO_CREATION_FAILED = 0x88960003;
584 const HRESULT XAUDIO2_E_DEVICE_INVALIDATED = 0x88960004;
586 cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
587 cpp_quote("#define _USE_MATH_DEFINES")
588 cpp_quote("#include <math.h>")
589 cpp_quote("inline static float XAudio2DecibelsToAmplitudeRatio(float decibels) { return powf(10.0f, decibels/20.0f); }")
590 cpp_quote("inline static float XAudio2AmplitudeRatioToDecibels(float volume) { if (volume == 0) { return -3.402823466e+38f; } return 20.0f * log10f(volume); }")
591 cpp_quote("inline static float XAudio2SemitonesToFrequencyRatio(float semitones) { return powf(2.0f, semitones/12.0f); }")
592 cpp_quote("inline static float XAudio2FrequencyRatioToSemitones(float freqratio) { return 39.86313713864835f * log10f(freqratio); }")
593 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); }")
594 cpp_quote("inline static float XAudio2RadiansToCutoffFrequency(float radians, float samplerate) { return samplerate * asinf(radians/2.0f) / (float)M_PI; }")
595 cpp_quote("#endif")
597 cpp_quote("HRESULT WINAPI XAudio2Create(IXAudio2** pxaudio2, UINT32 flags, XAUDIO2_PROCESSOR processor);")
599 cpp_quote("#include <poppack.h>")