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