opengl32: Skip debug callback messages called from native thread.
[wine.git] / include / xaudio2.idl
blob277fc450469dd89b56426ffcc9558649b8185ce9
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 #ifndef XAUDIO2_VER
20 #define XAUDIO2_VER 9
21 #endif
23 import "unknwn.idl";
24 import "mmdeviceapi.idl";
26 import "audiosessiontypes.h";
28 cpp_quote("#include <pshpack1.h>")
30 #if XAUDIO2_VER <= 7
33 threading(both),
34 #if XAUDIO2_VER == 0
35 uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
36 #elif XAUDIO2_VER == 1
37 uuid(e21a7345-eb21-468e-be50-804db97cf708)
38 #elif XAUDIO2_VER == 2
39 uuid(b802058a-464a-42db-bc10-b650d6f2586a)
40 #elif XAUDIO2_VER == 3
41 uuid(4c5e637a-16c7-4de3-9c46-5ed22181962d)
42 #elif XAUDIO2_VER == 4
43 uuid(03219e78-5bc3-44d1-b92e-f63d89cc6526)
44 #elif XAUDIO2_VER == 5
45 uuid(4c9b6dde-6809-46e6-a278-9b6a97588670)
46 #elif XAUDIO2_VER == 6
47 uuid(3eda9b49-2085-498b-9bb2-39a6778493de)
48 #else
49 uuid(5a508685-a254-4fba-9b82-9a24b00306af)
50 #endif
52 coclass XAudio2 {
53 interface IUnknown;
57 #if XAUDIO2_VER == 0
58 uuid(fac23f48-31f5-45a8-b49b-5225d61401db)
59 #elif XAUDIO2_VER == 1
60 uuid(f7a76c21-53d4-46bb-ac53-8b459cae46bd)
61 #elif XAUDIO2_VER == 2
62 uuid(97dfb7e7-5161-4015-87a9-c79e6a1952cc)
63 #elif XAUDIO2_VER == 3
64 uuid(ef0aa05d-8075-4e5d-bead-45be0c3ccbb3)
65 #elif XAUDIO2_VER == 4
66 uuid(4256535c-1ea4-4d4b-8ad5-f9db762eca9e)
67 #elif XAUDIO2_VER == 5
68 uuid(715bdd1a-aa82-436b-b0fa-6acea39bd0a1)
69 #elif XAUDIO2_VER == 6
70 uuid(47199894-7cc2-444d-9873-ced2562cc60e)
71 #else
72 uuid(db05ea35-0329-4d4b-a53a-6dead03d3852)
73 #endif
75 coclass XAudio2Debug {
76 interface IUnknown;
79 #endif
81 cpp_quote("#if 0")
82 typedef struct WAVEFORMATEX
84 WORD wFormatTag;
85 WORD nChannels;
86 DWORD nSamplesPerSec;
87 DWORD nAvgBytesPerSec;
88 WORD nBlockAlign;
89 WORD wBitsPerSample;
90 WORD cbSize;
91 } WAVEFORMATEX;
93 typedef struct {
94 WAVEFORMATEX Format;
95 union {
96 WORD wValidBitsPerSample;
97 WORD wSamplesPerBlock;
98 WORD wReserved;
99 } Samples;
100 DWORD dwChannelMask;
101 GUID SubFormat;
102 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
103 cpp_quote("#else")
104 cpp_quote("#include <mmreg.h>")
105 cpp_quote("#endif")
107 interface IXAudio2Voice;
109 typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
111 Processor1 = 0x00000001,
112 Processor2 = 0x00000002,
113 Processor3 = 0x00000004,
114 Processor4 = 0x00000008,
115 Processor5 = 0x00000010,
116 Processor6 = 0x00000020,
117 Processor7 = 0x00000040,
118 Processor8 = 0x00000080,
119 Processor9 = 0x00000100,
120 Processor10 = 0x00000200,
121 Processor11 = 0x00000400,
122 Processor12 = 0x00000800,
123 Processor13 = 0x00001000,
124 Processor14 = 0x00002000,
125 Processor15 = 0x00004000,
126 Processor16 = 0x00008000,
127 Processor17 = 0x00010000,
128 Processor18 = 0x00020000,
129 Processor19 = 0x00040000,
130 Processor20 = 0x00080000,
131 Processor21 = 0x00100000,
132 Processor22 = 0x00200000,
133 Processor23 = 0x00400000,
134 Processor24 = 0x00800000,
135 Processor25 = 0x01000000,
136 Processor26 = 0x02000000,
137 Processor27 = 0x04000000,
138 Processor28 = 0x08000000,
139 Processor29 = 0x10000000,
140 Processor30 = 0x20000000,
141 Processor31 = 0x40000000,
142 Processor32 = 0x80000000,
143 XAUDIO2_ANY_PROCESSOR = 0xffffffff,
144 XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
145 } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
147 typedef struct XAUDIO2_PERFORMANCE_DATA
149 UINT64 AudioCyclesSinceLastQuery;
150 UINT64 TotalCyclesSinceLastQuery;
151 UINT32 MinimumCyclesPerQuantum;
152 UINT32 MaximumCyclesPerQuantum;
153 UINT32 MemoryUsageInBytes;
154 UINT32 CurrentLatencyInSamples;
155 #if XAUDIO2_VER == 0
156 UINT32 GlitchesSinceLastQuery;
157 #else
158 UINT32 GlitchesSinceEngineStarted;
159 #endif
160 UINT32 ActiveSourceVoiceCount;
161 UINT32 TotalSourceVoiceCount;
162 UINT32 ActiveSubmixVoiceCount;
163 #if XAUDIO2_VER <= 2
164 UINT32 TotalSubmixVoiceCount;
165 #else
166 UINT32 ActiveResamplerCount;
167 UINT32 ActiveMatrixMixCount;
168 #endif
169 UINT32 ActiveXmaSourceVoices;
170 UINT32 ActiveXmaStreams;
171 } XAUDIO2_PERFORMANCE_DATA;
173 typedef enum XAUDIO2_DEVICE_ROLE
175 NotDefaultDevice = 0x0,
176 DefaultConsoleDevice = 0x1,
177 DefaultMultimediaDevice = 0x2,
178 DefaultCommunicationsDevice = 0x4,
179 DefaultGameDevice = 0x8,
180 GlobalDefaultDevice = 0xf,
181 InvalidDeviceRole = ~GlobalDefaultDevice
182 } XAUDIO2_DEVICE_ROLE;
184 #if XAUDIO2_VER <= 7
185 typedef struct XAUDIO2_DEVICE_DETAILS
187 WCHAR DeviceID[256];
188 WCHAR DisplayName[256];
189 XAUDIO2_DEVICE_ROLE Role;
190 WAVEFORMATEXTENSIBLE OutputFormat;
191 } XAUDIO2_DEVICE_DETAILS;
192 #endif
194 typedef struct XAUDIO2_VOICE_DETAILS
196 UINT32 CreationFlags;
197 #if XAUDIO2_VER >= 8
198 UINT32 ActiveFlags;
199 #endif
200 UINT32 InputChannels;
201 UINT32 InputSampleRate;
202 } XAUDIO2_VOICE_DETAILS;
204 #if XAUDIO2_VER <= 3
205 typedef struct XAUDIO2_VOICE_SENDS
207 UINT32 OutputCount;
208 IXAudio2Voice **pOutputVoices;
209 } XAUDIO2_VOICE_SENDS;
210 #else
211 typedef struct XAUDIO2_SEND_DESCRIPTOR
213 UINT32 Flags;
214 IXAudio2Voice* pOutputVoice;
215 } XAUDIO2_SEND_DESCRIPTOR;
217 typedef struct XAUDIO2_VOICE_SENDS
219 UINT32 SendCount;
220 XAUDIO2_SEND_DESCRIPTOR* pSends;
221 } XAUDIO2_VOICE_SENDS;
222 #endif
224 typedef struct XAUDIO2_EFFECT_DESCRIPTOR
226 IUnknown* pEffect;
227 BOOL InitialState;
228 UINT32 OutputChannels;
229 } XAUDIO2_EFFECT_DESCRIPTOR;
231 typedef struct XAUDIO2_EFFECT_CHAIN
233 UINT32 EffectCount;
234 XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors;
235 } XAUDIO2_EFFECT_CHAIN;
237 const UINT32 XAUDIO2_MAX_BUFFER_BYTES = 0x80000000;
238 const UINT32 XAUDIO2_MAX_QUEUED_BUFFERS = 64;
239 const UINT32 XAUDIO2_MAX_BUFFERS_SYSTEM = 2;
240 const UINT32 XAUDIO2_MAX_AUDIO_CHANNELS = 64;
241 const UINT32 XAUDIO2_MIN_SAMPLE_RATE = 1000;
242 const UINT32 XAUDIO2_MAX_SAMPLE_RATE = 200000;
243 const float XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0;
244 const float XAUDIO2_MIN_FREQ_RATIO = (1/1024.0);
245 const float XAUDIO2_MAX_FREQ_RATIO = 1024.0;
246 const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
247 const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
248 const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
249 #if XAUDIO2_VER > 0
250 const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
251 #else
252 const UINT32 XAUDIO2_MAX_LOOP_COUNT = 0x100000;
253 #endif
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 #if XAUDIO2_VER > 0
260 const UINT32 XAUDIO2_LOOP_INFINITE = 255;
261 #else
262 const UINT32 XAUDIO2_LOOP_INFINITE = ((UINT)-1);
263 #endif
264 const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
265 const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
268 object,
269 local
271 interface IXAudio2EngineCallback
273 void OnProcessingPassStart();
275 void OnProcessingPassEnd();
277 void OnCriticalError([in] HRESULT Error);
280 typedef enum XAUDIO2_FILTER_TYPE
282 LowPassFilter,
283 BandPassFilter,
284 HighPassFilter,
285 NotchFilter
286 } XAUDIO2_FILTER_TYPE;
288 typedef struct XAUDIO2_FILTER_PARAMETERS
290 XAUDIO2_FILTER_TYPE Type;
291 float Frequency;
292 float OneOverQ;
293 } XAUDIO2_FILTER_PARAMETERS;
296 object,
297 local
299 interface IXAudio2Voice
301 void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
303 HRESULT SetOutputVoices([in] const XAUDIO2_VOICE_SENDS* pSendList);
305 HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
307 HRESULT EnableEffect(
308 [in] UINT32 EffectIndex,
309 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
311 HRESULT DisableEffect(
312 [in] UINT32 EffectIndex,
313 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
315 void GetEffectState(
316 [in] UINT32 EffectIndex,
317 [out] BOOL* pEnabled);
319 HRESULT SetEffectParameters(
320 [in] UINT32 EffectIndex,
321 [in] const void* pParameters,
322 [in] UINT32 ParametersByteSize,
323 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
325 HRESULT GetEffectParameters(
326 [in] UINT32 EffectIndex,
327 [out] void* pParameters,
328 [in] UINT32 ParametersByteSize);
330 HRESULT SetFilterParameters(
331 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
332 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
334 void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
336 #if XAUDIO2_VER >= 4
337 HRESULT SetOutputFilterParameters(
338 [in] IXAudio2Voice* pDestinationVoice,
339 [in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
340 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
342 void GetOutputFilterParameters(
343 [in] IXAudio2Voice* pDestinationVoice,
344 [out] XAUDIO2_FILTER_PARAMETERS* pParameters);
345 #endif
347 HRESULT SetVolume(
348 [in] float Volume,
349 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
351 void GetVolume([out] float* pVolume);
353 HRESULT SetChannelVolumes(
354 [in] UINT32 Channels,
355 [in, size_is(Channels)] const float* pVolumes,
356 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
358 void GetChannelVolumes(
359 [in] UINT32 Channels,
360 [out, size_is(Channels)] float* pVolumes);
362 HRESULT SetOutputMatrix(
363 [in] IXAudio2Voice* pDestinationVoice,
364 [in] UINT32 SourceChannels,
365 [in] UINT32 DestinationChannels,
366 [in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
367 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
369 #if XAUDIO2_VER == 0
370 HRESULT
371 #else
372 void
373 #endif
374 GetOutputMatrix(
375 [in] IXAudio2Voice* pDestinationVoice,
376 [in] UINT32 SourceChannels,
377 [in] UINT32 DestinationChannels,
378 [out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
380 void DestroyVoice();
383 typedef struct XAUDIO2_BUFFER
385 UINT32 Flags;
386 UINT32 AudioBytes;
387 const BYTE* pAudioData;
388 UINT32 PlayBegin;
389 UINT32 PlayLength;
390 UINT32 LoopBegin;
391 UINT32 LoopLength;
392 UINT32 LoopCount;
393 void* pContext;
394 } XAUDIO2_BUFFER;
396 typedef struct XAUDIO2_BUFFER_WMA
398 const UINT32* pDecodedPacketCumulativeBytes;
399 UINT32 PacketCount;
400 } XAUDIO2_BUFFER_WMA;
402 typedef struct XAUDIO2_VOICE_STATE
404 void* pCurrentBufferContext;
405 UINT32 BuffersQueued;
406 UINT64 SamplesPlayed;
407 } XAUDIO2_VOICE_STATE;
410 local
412 interface IXAudio2SourceVoice : IXAudio2Voice
414 HRESULT Start(
415 [in, defaultvalue(0)] UINT32 Flags,
416 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
418 HRESULT Stop(
419 [in, defaultvalue(0)] UINT32 Flags,
420 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
422 HRESULT SubmitSourceBuffer(
423 [in] const XAUDIO2_BUFFER* pBuffer,
424 [in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
426 HRESULT FlushSourceBuffers();
428 HRESULT Discontinuity();
430 HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
432 #if XAUDIO2_VER >= 8
433 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState, [in, defaultvalue(0)] UINT32 Flags);
434 #else
435 void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
436 #endif
438 HRESULT SetFrequencyRatio(
439 [in] float Ratio,
440 [in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
442 void GetFrequencyRatio([out] float* pRatio);
444 #if XAUDIO2_VER >= 4
445 HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
446 #endif
450 local
452 interface IXAudio2SubmixVoice : IXAudio2Voice
457 local
459 interface IXAudio2MasteringVoice : IXAudio2Voice
461 #if XAUDIO2_VER >= 8
462 void GetChannelMask([out] DWORD *pChannelMask);
463 #endif
467 object,
468 local
470 interface IXAudio2VoiceCallback
472 #if XAUDIO2_VER > 0
473 void OnVoiceProcessingPassStart([in] UINT32 BytesRequired);
474 #else
475 void OnVoiceProcessingPassStart();
476 #endif
478 void OnVoiceProcessingPassEnd();
480 void OnStreamEnd();
482 void OnBufferStart([in] void* pBufferContext);
484 void OnBufferEnd([in] void* pBufferContext);
486 void OnLoopEnd([in] void* pBufferContext);
488 void OnVoiceError(
489 [in] void* pBuffercontext,
490 [in] HRESULT Error);
493 typedef struct XAUDIO2_DEBUG_CONFIGURATION
495 UINT32 TraceMask;
496 UINT32 BreakMask;
497 BOOL LogThreadID;
498 BOOL LogFileline;
499 BOOL LogFunctionName;
500 BOOL LogTiming;
501 } XAUDIO2_DEBUG_CONFIGURATION;
504 object,
505 #if XAUDIO2_VER <= 7
506 uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb)
507 #elif XAUDIO2_VER == 8
508 uuid(60d8dac8-5aa1-4e8e-b597-2f5e2883d484)
509 #else
510 uuid(2b02e3cf-2e0b-4ec3-be45-1b2a3fe7210d)
511 #endif
513 /* XAudio2 2.9's IXAudio2 interface. */
514 interface IXAudio2 : IUnknown
516 #if XAUDIO2_VER <= 7
517 HRESULT GetDeviceCount(UINT32 *count);
519 HRESULT GetDeviceDetails(UINT32 index, XAUDIO2_DEVICE_DETAILS *details);
521 HRESULT Initialize(UINT32 flags, XAUDIO2_PROCESSOR processor);
522 #endif
524 HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
526 void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
528 HRESULT CreateSourceVoice(
529 [out] IXAudio2SourceVoice** ppSourceVoice,
530 [in] const WAVEFORMATEX* pSourceFormat,
531 [in, defaultvalue(0)] UINT32 Flags,
532 [in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
533 [in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
534 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
535 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
537 HRESULT CreateSubmixVoice(
538 [out] IXAudio2SubmixVoice** ppSubmixVoice,
539 [in] UINT32 InputChannels,
540 [in] UINT32 InputSampleRate,
541 [in, defaultvalue(0)] UINT32 Flags,
542 [in, defaultvalue(0)] UINT32 ProcessingStage,
543 [in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
544 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
546 HRESULT CreateMasteringVoice(
547 [out] IXAudio2MasteringVoice** ppMasteringVoice,
548 [in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
549 [in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
550 [in, defaultvalue(0)] UINT32 Flags,
551 #if XAUDIO2_VER >= 8
552 [in, defaultvalue(NULL)] LPCWSTR DeviceId,
553 #else
554 [in, defaultvalue(0)] UINT32 index,
555 #endif
556 [in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain
557 #if XAUDIO2_VER >= 8
558 , [in, defaultvalue(AudioCategory_GameEffects)] AUDIO_STREAM_CATEGORY category
559 #endif
562 HRESULT StartEngine();
564 void StopEngine();
566 HRESULT CommitChanges([in] UINT32 OperationSet);
568 void GetPerformanceData([out] XAUDIO2_PERFORMANCE_DATA* pPerfData);
570 [local] void SetDebugConfiguration(
571 [in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
572 [in, defaultvalue(NULL)] void* pReserved);
575 const UINT32 XAUDIO2_DEBUG_ENGINE = 0x00000001;
576 const UINT32 XAUDIO2_VOICE_NOPITCH = 0x00000002;
577 const UINT32 XAUDIO2_VOICE_NOSRC = 0x00000004;
578 const UINT32 XAUDIO2_VOICE_USEFILTER = 0x00000008;
579 const UINT32 XAUDIO2_VOICE_MUSIC = 0x00000010;
580 const UINT32 XAUDIO2_PLAY_TAILS = 0x00000020;
581 const UINT32 XAUDIO2_END_OF_STREAM = 0x00000040;
582 const UINT32 XAUDIO2_SEND_USEFILTER = 0x00000080;
583 const UINT32 XAUDIO2_VOICE_NOSAMPLESPLAYED = 0x00000100;
585 const XAUDIO2_FILTER_TYPE XAUDIO2_DEFAULT_FILTER_TYPE = LowPassFilter;
586 const float XAUDIO2_DEFAULT_FILTER_FREQUENCY = XAUDIO2_MAX_FILTER_FREQUENCY;
587 const float XAUDIO2_DEFAULT_FILTER_ONEOVERQ = 1.0;
588 const UINT32 XAUDIO2_QUANTUM_NUMERATOR = 1;
589 const UINT32 XAUDIO2_QUANTUM_DENOMINATOR = 100;
590 const float XAUDIO2_QUANTUM_MS = (1000.0 * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR);
592 /* use cpp_quote to retain the HRESULT type in header file */
593 #if XAUDIO2_VER > 0
594 cpp_quote("#define XAUDIO2_E_INVALID_CALL ((HRESULT)0x88960001)")
595 cpp_quote("#define XAUDIO2_E_XMA_DECODER_ERROR ((HRESULT)0x88960002)")
596 cpp_quote("#define XAUDIO2_E_XAPO_CREATION_FAILED ((HRESULT)0x88960003)")
597 cpp_quote("#define XAUDIO2_E_DEVICE_INVALIDATED ((HRESULT)0x88960004)")
598 #else
599 cpp_quote("#define XAUDIO2_E_XMA_DECODER_ERROR ((HRESULT)0x88960001)")
600 cpp_quote("#define XAUDIO2_E_XAPO_CREATION_FAILED ((HRESULT)0x88960002)")
601 cpp_quote("#define XAUDIO2_E_DEVICE_INVALIDATED ((HRESULT)0x88960003)")
602 #endif
604 cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
605 cpp_quote("#define _USE_MATH_DEFINES")
606 cpp_quote("#include <math.h>")
607 cpp_quote("inline static float XAudio2DecibelsToAmplitudeRatio(float decibels) { return powf(10.0f, decibels/20.0f); }")
608 cpp_quote("inline static float XAudio2AmplitudeRatioToDecibels(float volume) { if (volume == 0) { return -3.402823466e+38f; } return 20.0f * log10f(volume); }")
609 cpp_quote("inline static float XAudio2SemitonesToFrequencyRatio(float semitones) { return powf(2.0f, semitones/12.0f); }")
610 cpp_quote("inline static float XAudio2FrequencyRatioToSemitones(float freqratio) { return 39.86313713864835f * log10f(freqratio); }")
611 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); }")
612 cpp_quote("inline static float XAudio2RadiansToCutoffFrequency(float radians, float samplerate) { return samplerate * asinf(radians/2.0f) / (float)M_PI; }")
613 cpp_quote("#endif")
615 cpp_quote("#include <poppack.h>")
617 #if XAUDIO2_VER >= 8
618 cpp_quote("HRESULT WINAPI XAudio2Create(IXAudio2** pxaudio2, UINT32 flags, XAUDIO2_PROCESSOR processor);")
619 #endif