msvcp90: Remove MSVCP_bool type.
[wine.git] / dlls / xaudio2_7 / compat.c
blobc4538ae36770b44e52fc486c256be071180b66f9
1 /*
2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
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
18 ***************
20 * Some versions of XAudio2 add or remove functions to the COM vtables, or
21 * incompatibly change structures. This file provides implementations of the
22 * older XAudio2 versions onto the new XAudio2 APIs.
24 * Below is a list of significant changes to the main XAudio2 interfaces and
25 * API. There may be further changes to effects and other parts that Wine
26 * doesn't currently implement.
28 * 2.0
29 * Initial version
31 * 2.1
32 * Change CLSID_XAudio2
33 * Re-order Error codes
34 * Change XAUDIO2_LOOP_INFINITE
35 * Change struct XAUDIO2_PERFORMANCE_DATA
36 * Change IXAudio2Voice::GetOutputMatrix return value to void
37 * Add parameter to IXAudio2VoiceCallback::OnVoiceProcessingPassStart
38 * Change struct XAPO_REGISTRATION_PROPERTIES. CAREFUL when using! Not all
39 * implementations of IXAPO are Wine implementations.
41 * 2.2
42 * Change CLSID_XAudio2
43 * No ABI break
45 * 2.3
46 * Change CLSID_XAudio2
47 * ABI break:
48 * Change struct XAUDIO2_PERFORMANCE_DATA
50 * 2.4
51 * Change CLSID_XAudio2
52 * ABI break:
53 * Add IXAudio2Voice::SetOutputFilterParameters
54 * Add IXAudio2Voice::GetOutputFilterParameters
55 * Add IXAudio2SourceVoice::SetSourceSampleRate
56 * Change struct XAUDIO2_VOICE_SENDS
58 * 2.5
59 * Change CLSID_XAudio2
60 * No ABI break
62 * 2.6
63 * Change CLSID_XAudio2
64 * No ABI break
66 * 2.7
67 * Change CLSID_XAudio2
68 * No ABI break
70 * 2.8
71 * Remove CLSID_XAudio2
72 * Change IID_IXAudio2
73 * Add xaudio2_8.XAudio2Create
74 * ABI break:
75 * Remove IXAudio2::GetDeviceCount
76 * Remove IXAudio2::GetDeviceDetails
77 * Remove IXAudio2::Initialize
78 * Change parameter of IXAudio2::CreateMasteringVoice
79 * Add Flags parameter to IXAudio2SourceVoice::GetState
80 * Add IXAudio2MasteringVoice::GetChannelMask
81 * Add DisableLateField member to XAUDIO2FX_REVERB_PARAMETERS
82 * Add ActiveFlags member to XAUDIO2_VOICE_DETAILS
84 * 2.9
85 * Change IID_IXAudio2
86 * New flags: XAUDIO2_STOP_ENGINE_WHEN_IDLE, XAUDIO2_1024_QUANTUM,
87 * XAUDIO2_NO_VIRTUAL_AUDIO_CLIENT
88 * ABI break:
89 * Add SideDelay member to XAUDIO2FX_REVERB_PARAMETERS
92 #include "config.h"
94 #define NONAMELESSUNION
95 #define NONAMELESSSTRUCT
96 #define COBJMACROS
98 #include <stdarg.h>
100 #include "xaudio_private.h"
102 #include "wine/debug.h"
104 #if XAUDIO2_VER <= 7
105 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
106 #endif
108 #if XAUDIO2_VER <= 3
109 static XAUDIO2_SEND_DESCRIPTOR *convert_send_descriptors23(const XAUDIO23_VOICE_SENDS *sends)
111 XAUDIO2_SEND_DESCRIPTOR *ret;
112 DWORD i;
114 ret = HeapAlloc(GetProcessHeap(), 0, sends->OutputCount * sizeof(XAUDIO2_SEND_DESCRIPTOR));
116 for(i = 0; i < sends->OutputCount; ++i){
117 ret[i].Flags = 0;
118 ret[i].pOutputVoice = sends->pOutputVoices[i];
121 return ret;
123 #endif
125 /* BEGIN IXAudio2SourceVoice */
126 #if XAUDIO2_VER == 0
127 XA2VoiceImpl *impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice *iface)
129 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio20SourceVoice_iface);
132 static void WINAPI XA20SRC_GetVoiceDetails(IXAudio20SourceVoice *iface,
133 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
135 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
136 XAUDIO2_VOICE_DETAILS details;
138 IXAudio2SourceVoice_GetVoiceDetails(&This->IXAudio2SourceVoice_iface, &details);
140 pVoiceDetails->CreationFlags = details.CreationFlags;
141 pVoiceDetails->InputChannels = details.InputChannels;
142 pVoiceDetails->InputSampleRate = details.InputSampleRate;
145 static HRESULT WINAPI XA20SRC_SetOutputVoices(IXAudio20SourceVoice *iface,
146 const XAUDIO23_VOICE_SENDS *pSendList)
148 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
149 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
150 HRESULT hr;
152 TRACE("%p, %p\n", This, pSendList);
154 if(pSendList){
155 sends.SendCount = pSendList->OutputCount;
156 sends.pSends = convert_send_descriptors23(pSendList);
157 psends = &sends;
160 hr = IXAudio2SourceVoice_SetOutputVoices(&This->IXAudio2SourceVoice_iface, psends);
162 if(pSendList)
163 HeapFree(GetProcessHeap(), 0, sends.pSends);
165 return hr;
168 static HRESULT WINAPI XA20SRC_SetEffectChain(IXAudio20SourceVoice *iface,
169 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
171 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
172 return IXAudio2SourceVoice_SetEffectChain(&This->IXAudio2SourceVoice_iface, pEffectChain);
175 static HRESULT WINAPI XA20SRC_EnableEffect(IXAudio20SourceVoice *iface,
176 UINT32 EffectIndex, UINT32 OperationSet)
178 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
179 return IXAudio2SourceVoice_EnableEffect(&This->IXAudio2SourceVoice_iface,
180 EffectIndex, OperationSet);
183 static HRESULT WINAPI XA20SRC_DisableEffect(IXAudio20SourceVoice *iface,
184 UINT32 EffectIndex, UINT32 OperationSet)
186 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
187 return IXAudio2SourceVoice_DisableEffect(&This->IXAudio2SourceVoice_iface,
188 EffectIndex, OperationSet);
191 static void WINAPI XA20SRC_GetEffectState(IXAudio20SourceVoice *iface,
192 UINT32 EffectIndex, BOOL *pEnabled)
194 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
195 return IXAudio2SourceVoice_GetEffectState(&This->IXAudio2SourceVoice_iface,
196 EffectIndex, pEnabled);
199 static HRESULT WINAPI XA20SRC_SetEffectParameters(IXAudio20SourceVoice *iface,
200 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
201 UINT32 OperationSet)
203 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
204 return IXAudio2SourceVoice_SetEffectParameters(&This->IXAudio2SourceVoice_iface,
205 EffectIndex, pParameters, ParametersByteSize, OperationSet);
208 static HRESULT WINAPI XA20SRC_GetEffectParameters(IXAudio20SourceVoice *iface,
209 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
211 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
212 return IXAudio2SourceVoice_GetEffectParameters(&This->IXAudio2SourceVoice_iface,
213 EffectIndex, pParameters, ParametersByteSize);
216 static HRESULT WINAPI XA20SRC_SetFilterParameters(IXAudio20SourceVoice *iface,
217 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
219 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
220 return IXAudio2SourceVoice_SetFilterParameters(&This->IXAudio2SourceVoice_iface,
221 pParameters, OperationSet);
224 static void WINAPI XA20SRC_GetFilterParameters(IXAudio20SourceVoice *iface,
225 XAUDIO2_FILTER_PARAMETERS *pParameters)
227 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
228 return IXAudio2SourceVoice_GetFilterParameters(&This->IXAudio2SourceVoice_iface, pParameters);
231 static HRESULT WINAPI XA20SRC_SetVolume(IXAudio20SourceVoice *iface,
232 float Volume, UINT32 OperationSet)
234 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
235 return IXAudio2SourceVoice_SetVolume(&This->IXAudio2SourceVoice_iface,
236 Volume, OperationSet);
239 static void WINAPI XA20SRC_GetVolume(IXAudio20SourceVoice *iface,
240 float *pVolume)
242 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
243 return IXAudio2SourceVoice_GetVolume(&This->IXAudio2SourceVoice_iface, pVolume);
246 static HRESULT WINAPI XA20SRC_SetChannelVolumes(IXAudio20SourceVoice *iface,
247 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
249 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
250 return IXAudio2SourceVoice_SetChannelVolumes(&This->IXAudio2SourceVoice_iface,
251 Channels, pVolumes, OperationSet);
254 static void WINAPI XA20SRC_GetChannelVolumes(IXAudio20SourceVoice *iface,
255 UINT32 Channels, float *pVolumes)
257 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
258 return IXAudio2SourceVoice_GetChannelVolumes(&This->IXAudio2SourceVoice_iface,
259 Channels, pVolumes);
262 static HRESULT WINAPI XA20SRC_SetOutputMatrix(IXAudio20SourceVoice *iface,
263 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
264 UINT32 DestinationChannels, const float *pLevelMatrix,
265 UINT32 OperationSet)
267 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
268 return IXAudio2SourceVoice_SetOutputMatrix(&This->IXAudio2SourceVoice_iface,
269 pDestinationVoice, SourceChannels, DestinationChannels,
270 pLevelMatrix, OperationSet);
273 static HRESULT WINAPI XA20SRC_GetOutputMatrix(IXAudio20SourceVoice *iface,
274 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
275 UINT32 DestinationChannels, float *pLevelMatrix)
277 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
278 IXAudio2SourceVoice_GetOutputMatrix(&This->IXAudio2SourceVoice_iface,
279 pDestinationVoice, SourceChannels, DestinationChannels,
280 pLevelMatrix);
281 return S_OK;
284 static void WINAPI XA20SRC_DestroyVoice(IXAudio20SourceVoice *iface)
286 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
287 return IXAudio2SourceVoice_DestroyVoice(&This->IXAudio2SourceVoice_iface);
290 static HRESULT WINAPI XA20SRC_Start(IXAudio20SourceVoice *iface, UINT32 Flags,
291 UINT32 OperationSet)
293 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
294 return IXAudio2SourceVoice_Start(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
297 static HRESULT WINAPI XA20SRC_Stop(IXAudio20SourceVoice *iface, UINT32 Flags,
298 UINT32 OperationSet)
300 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
301 return IXAudio2SourceVoice_Stop(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
304 static HRESULT WINAPI XA20SRC_SubmitSourceBuffer(IXAudio20SourceVoice *iface,
305 const XAUDIO2_BUFFER *pBuffer, const XAUDIO2_BUFFER_WMA *pBufferWMA)
307 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
308 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface,
309 pBuffer, pBufferWMA);
312 static HRESULT WINAPI XA20SRC_FlushSourceBuffers(IXAudio20SourceVoice *iface)
314 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
315 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
318 static HRESULT WINAPI XA20SRC_Discontinuity(IXAudio20SourceVoice *iface)
320 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
321 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
324 static HRESULT WINAPI XA20SRC_ExitLoop(IXAudio20SourceVoice *iface,
325 UINT32 OperationSet)
327 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
328 return IXAudio2SourceVoice_ExitLoop(&This->IXAudio2SourceVoice_iface, OperationSet);
331 static void WINAPI XA20SRC_GetState(IXAudio20SourceVoice *iface,
332 XAUDIO2_VOICE_STATE *pVoiceState)
334 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
335 return IXAudio2SourceVoice_GetState(&This->IXAudio2SourceVoice_iface, pVoiceState, 0);
338 static HRESULT WINAPI XA20SRC_SetFrequencyRatio(IXAudio20SourceVoice *iface,
339 float Ratio, UINT32 OperationSet)
341 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
342 return IXAudio2SourceVoice_SetFrequencyRatio(&This->IXAudio2SourceVoice_iface,
343 Ratio, OperationSet);
346 static void WINAPI XA20SRC_GetFrequencyRatio(IXAudio20SourceVoice *iface,
347 float *pRatio)
349 XA2VoiceImpl *This = impl_from_IXAudio20SourceVoice(iface);
350 return IXAudio2SourceVoice_GetFrequencyRatio(&This->IXAudio2SourceVoice_iface, pRatio);
353 const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl = {
354 XA20SRC_GetVoiceDetails,
355 XA20SRC_SetOutputVoices,
356 XA20SRC_SetEffectChain,
357 XA20SRC_EnableEffect,
358 XA20SRC_DisableEffect,
359 XA20SRC_GetEffectState,
360 XA20SRC_SetEffectParameters,
361 XA20SRC_GetEffectParameters,
362 XA20SRC_SetFilterParameters,
363 XA20SRC_GetFilterParameters,
364 XA20SRC_SetVolume,
365 XA20SRC_GetVolume,
366 XA20SRC_SetChannelVolumes,
367 XA20SRC_GetChannelVolumes,
368 XA20SRC_SetOutputMatrix,
369 XA20SRC_GetOutputMatrix,
370 XA20SRC_DestroyVoice,
371 XA20SRC_Start,
372 XA20SRC_Stop,
373 XA20SRC_SubmitSourceBuffer,
374 XA20SRC_FlushSourceBuffers,
375 XA20SRC_Discontinuity,
376 XA20SRC_ExitLoop,
377 XA20SRC_GetState,
378 XA20SRC_SetFrequencyRatio,
379 XA20SRC_GetFrequencyRatio,
382 #elif XAUDIO2_VER <= 3
384 XA2VoiceImpl *impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice *iface)
386 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio23SourceVoice_iface);
389 static void WINAPI XA23SRC_GetVoiceDetails(IXAudio23SourceVoice *iface,
390 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
392 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
393 XAUDIO2_VOICE_DETAILS details;
395 IXAudio2SourceVoice_GetVoiceDetails(&This->IXAudio2SourceVoice_iface, &details);
397 pVoiceDetails->CreationFlags = details.CreationFlags;
398 pVoiceDetails->InputChannels = details.InputChannels;
399 pVoiceDetails->InputSampleRate = details.InputSampleRate;
402 static HRESULT WINAPI XA23SRC_SetOutputVoices(IXAudio23SourceVoice *iface,
403 const XAUDIO23_VOICE_SENDS *pSendList)
405 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
406 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
407 HRESULT hr;
409 TRACE("%p, %p\n", This, pSendList);
411 if(pSendList){
412 sends.SendCount = pSendList->OutputCount;
413 sends.pSends = convert_send_descriptors23(pSendList);
414 psends = &sends;
417 hr = IXAudio2SourceVoice_SetOutputVoices(&This->IXAudio2SourceVoice_iface, psends);
419 if(pSendList)
420 HeapFree(GetProcessHeap(), 0, sends.pSends);
422 return hr;
425 static HRESULT WINAPI XA23SRC_SetEffectChain(IXAudio23SourceVoice *iface,
426 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
428 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
429 return IXAudio2SourceVoice_SetEffectChain(&This->IXAudio2SourceVoice_iface, pEffectChain);
432 static HRESULT WINAPI XA23SRC_EnableEffect(IXAudio23SourceVoice *iface,
433 UINT32 EffectIndex, UINT32 OperationSet)
435 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
436 return IXAudio2SourceVoice_EnableEffect(&This->IXAudio2SourceVoice_iface,
437 EffectIndex, OperationSet);
440 static HRESULT WINAPI XA23SRC_DisableEffect(IXAudio23SourceVoice *iface,
441 UINT32 EffectIndex, UINT32 OperationSet)
443 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
444 return IXAudio2SourceVoice_DisableEffect(&This->IXAudio2SourceVoice_iface,
445 EffectIndex, OperationSet);
448 static void WINAPI XA23SRC_GetEffectState(IXAudio23SourceVoice *iface,
449 UINT32 EffectIndex, BOOL *pEnabled)
451 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
452 return IXAudio2SourceVoice_GetEffectState(&This->IXAudio2SourceVoice_iface,
453 EffectIndex, pEnabled);
456 static HRESULT WINAPI XA23SRC_SetEffectParameters(IXAudio23SourceVoice *iface,
457 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
458 UINT32 OperationSet)
460 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
461 return IXAudio2SourceVoice_SetEffectParameters(&This->IXAudio2SourceVoice_iface,
462 EffectIndex, pParameters, ParametersByteSize, OperationSet);
465 static HRESULT WINAPI XA23SRC_GetEffectParameters(IXAudio23SourceVoice *iface,
466 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
468 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
469 return IXAudio2SourceVoice_GetEffectParameters(&This->IXAudio2SourceVoice_iface,
470 EffectIndex, pParameters, ParametersByteSize);
473 static HRESULT WINAPI XA23SRC_SetFilterParameters(IXAudio23SourceVoice *iface,
474 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
476 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
477 return IXAudio2SourceVoice_SetFilterParameters(&This->IXAudio2SourceVoice_iface,
478 pParameters, OperationSet);
481 static void WINAPI XA23SRC_GetFilterParameters(IXAudio23SourceVoice *iface,
482 XAUDIO2_FILTER_PARAMETERS *pParameters)
484 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
485 return IXAudio2SourceVoice_GetFilterParameters(&This->IXAudio2SourceVoice_iface, pParameters);
488 static HRESULT WINAPI XA23SRC_SetVolume(IXAudio23SourceVoice *iface,
489 float Volume, UINT32 OperationSet)
491 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
492 return IXAudio2SourceVoice_SetVolume(&This->IXAudio2SourceVoice_iface,
493 Volume, OperationSet);
496 static void WINAPI XA23SRC_GetVolume(IXAudio23SourceVoice *iface,
497 float *pVolume)
499 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
500 return IXAudio2SourceVoice_GetVolume(&This->IXAudio2SourceVoice_iface, pVolume);
503 static HRESULT WINAPI XA23SRC_SetChannelVolumes(IXAudio23SourceVoice *iface,
504 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
506 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
507 return IXAudio2SourceVoice_SetChannelVolumes(&This->IXAudio2SourceVoice_iface,
508 Channels, pVolumes, OperationSet);
511 static void WINAPI XA23SRC_GetChannelVolumes(IXAudio23SourceVoice *iface,
512 UINT32 Channels, float *pVolumes)
514 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
515 return IXAudio2SourceVoice_GetChannelVolumes(&This->IXAudio2SourceVoice_iface,
516 Channels, pVolumes);
519 static HRESULT WINAPI XA23SRC_SetOutputMatrix(IXAudio23SourceVoice *iface,
520 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
521 UINT32 DestinationChannels, const float *pLevelMatrix,
522 UINT32 OperationSet)
524 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
525 return IXAudio2SourceVoice_SetOutputMatrix(&This->IXAudio2SourceVoice_iface,
526 pDestinationVoice, SourceChannels, DestinationChannels,
527 pLevelMatrix, OperationSet);
530 static void WINAPI XA23SRC_GetOutputMatrix(IXAudio23SourceVoice *iface,
531 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
532 UINT32 DestinationChannels, float *pLevelMatrix)
534 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
535 return IXAudio2SourceVoice_GetOutputMatrix(&This->IXAudio2SourceVoice_iface,
536 pDestinationVoice, SourceChannels, DestinationChannels,
537 pLevelMatrix);
540 static void WINAPI XA23SRC_DestroyVoice(IXAudio23SourceVoice *iface)
542 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
543 return IXAudio2SourceVoice_DestroyVoice(&This->IXAudio2SourceVoice_iface);
546 static HRESULT WINAPI XA23SRC_Start(IXAudio23SourceVoice *iface, UINT32 Flags,
547 UINT32 OperationSet)
549 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
550 return IXAudio2SourceVoice_Start(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
553 static HRESULT WINAPI XA23SRC_Stop(IXAudio23SourceVoice *iface, UINT32 Flags,
554 UINT32 OperationSet)
556 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
557 return IXAudio2SourceVoice_Stop(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
560 static HRESULT WINAPI XA23SRC_SubmitSourceBuffer(IXAudio23SourceVoice *iface,
561 const XAUDIO2_BUFFER *pBuffer, const XAUDIO2_BUFFER_WMA *pBufferWMA)
563 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
564 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface,
565 pBuffer, pBufferWMA);
568 static HRESULT WINAPI XA23SRC_FlushSourceBuffers(IXAudio23SourceVoice *iface)
570 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
571 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
574 static HRESULT WINAPI XA23SRC_Discontinuity(IXAudio23SourceVoice *iface)
576 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
577 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
580 static HRESULT WINAPI XA23SRC_ExitLoop(IXAudio23SourceVoice *iface,
581 UINT32 OperationSet)
583 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
584 return IXAudio2SourceVoice_ExitLoop(&This->IXAudio2SourceVoice_iface, OperationSet);
587 static void WINAPI XA23SRC_GetState(IXAudio23SourceVoice *iface,
588 XAUDIO2_VOICE_STATE *pVoiceState)
590 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
591 return IXAudio2SourceVoice_GetState(&This->IXAudio2SourceVoice_iface, pVoiceState, 0);
594 static HRESULT WINAPI XA23SRC_SetFrequencyRatio(IXAudio23SourceVoice *iface,
595 float Ratio, UINT32 OperationSet)
597 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
598 return IXAudio2SourceVoice_SetFrequencyRatio(&This->IXAudio2SourceVoice_iface,
599 Ratio, OperationSet);
602 static void WINAPI XA23SRC_GetFrequencyRatio(IXAudio23SourceVoice *iface,
603 float *pRatio)
605 XA2VoiceImpl *This = impl_from_IXAudio23SourceVoice(iface);
606 return IXAudio2SourceVoice_GetFrequencyRatio(&This->IXAudio2SourceVoice_iface, pRatio);
609 const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl = {
610 XA23SRC_GetVoiceDetails,
611 XA23SRC_SetOutputVoices,
612 XA23SRC_SetEffectChain,
613 XA23SRC_EnableEffect,
614 XA23SRC_DisableEffect,
615 XA23SRC_GetEffectState,
616 XA23SRC_SetEffectParameters,
617 XA23SRC_GetEffectParameters,
618 XA23SRC_SetFilterParameters,
619 XA23SRC_GetFilterParameters,
620 XA23SRC_SetVolume,
621 XA23SRC_GetVolume,
622 XA23SRC_SetChannelVolumes,
623 XA23SRC_GetChannelVolumes,
624 XA23SRC_SetOutputMatrix,
625 XA23SRC_GetOutputMatrix,
626 XA23SRC_DestroyVoice,
627 XA23SRC_Start,
628 XA23SRC_Stop,
629 XA23SRC_SubmitSourceBuffer,
630 XA23SRC_FlushSourceBuffers,
631 XA23SRC_Discontinuity,
632 XA23SRC_ExitLoop,
633 XA23SRC_GetState,
634 XA23SRC_SetFrequencyRatio,
635 XA23SRC_GetFrequencyRatio,
638 #elif XAUDIO2_VER <= 7
640 XA2VoiceImpl *impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice *iface)
642 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio27SourceVoice_iface);
645 static void WINAPI XA27SRC_GetVoiceDetails(IXAudio27SourceVoice *iface,
646 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
648 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
649 XAUDIO2_VOICE_DETAILS details;
651 IXAudio2SourceVoice_GetVoiceDetails(&This->IXAudio2SourceVoice_iface, &details);
653 pVoiceDetails->CreationFlags = details.CreationFlags;
654 pVoiceDetails->InputChannels = details.InputChannels;
655 pVoiceDetails->InputSampleRate = details.InputSampleRate;
658 static HRESULT WINAPI XA27SRC_SetOutputVoices(IXAudio27SourceVoice *iface,
659 const XAUDIO2_VOICE_SENDS *pSendList)
661 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
662 return IXAudio2SourceVoice_SetOutputVoices(&This->IXAudio2SourceVoice_iface, pSendList);
665 static HRESULT WINAPI XA27SRC_SetEffectChain(IXAudio27SourceVoice *iface,
666 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
668 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
669 return IXAudio2SourceVoice_SetEffectChain(&This->IXAudio2SourceVoice_iface, pEffectChain);
672 static HRESULT WINAPI XA27SRC_EnableEffect(IXAudio27SourceVoice *iface,
673 UINT32 EffectIndex, UINT32 OperationSet)
675 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
676 return IXAudio2SourceVoice_EnableEffect(&This->IXAudio2SourceVoice_iface, EffectIndex, OperationSet);
679 static HRESULT WINAPI XA27SRC_DisableEffect(IXAudio27SourceVoice *iface,
680 UINT32 EffectIndex, UINT32 OperationSet)
682 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
683 return IXAudio2SourceVoice_DisableEffect(&This->IXAudio2SourceVoice_iface, EffectIndex, OperationSet);
686 static void WINAPI XA27SRC_GetEffectState(IXAudio27SourceVoice *iface,
687 UINT32 EffectIndex, BOOL *pEnabled)
689 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
690 IXAudio2SourceVoice_GetEffectState(&This->IXAudio2SourceVoice_iface, EffectIndex, pEnabled);
693 static HRESULT WINAPI XA27SRC_SetEffectParameters(IXAudio27SourceVoice *iface,
694 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
695 UINT32 OperationSet)
697 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
698 return IXAudio2SourceVoice_SetEffectParameters(&This->IXAudio2SourceVoice_iface,
699 EffectIndex, pParameters, ParametersByteSize, OperationSet);
702 static HRESULT WINAPI XA27SRC_GetEffectParameters(IXAudio27SourceVoice *iface,
703 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
705 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
706 return IXAudio2SourceVoice_GetEffectParameters(&This->IXAudio2SourceVoice_iface,
707 EffectIndex, pParameters, ParametersByteSize);
710 static HRESULT WINAPI XA27SRC_SetFilterParameters(IXAudio27SourceVoice *iface,
711 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
713 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
714 return IXAudio2SourceVoice_SetFilterParameters(&This->IXAudio2SourceVoice_iface,
715 pParameters, OperationSet);
718 static void WINAPI XA27SRC_GetFilterParameters(IXAudio27SourceVoice *iface,
719 XAUDIO2_FILTER_PARAMETERS *pParameters)
721 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
722 IXAudio2SourceVoice_GetFilterParameters(&This->IXAudio2SourceVoice_iface, pParameters);
725 static HRESULT WINAPI XA27SRC_SetOutputFilterParameters(IXAudio27SourceVoice *iface,
726 IXAudio2Voice *pDestinationVoice,
727 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
729 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
730 return IXAudio2SourceVoice_SetOutputFilterParameters(&This->IXAudio2SourceVoice_iface,
731 pDestinationVoice, pParameters, OperationSet);
734 static void WINAPI XA27SRC_GetOutputFilterParameters(IXAudio27SourceVoice *iface,
735 IXAudio2Voice *pDestinationVoice,
736 XAUDIO2_FILTER_PARAMETERS *pParameters)
738 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
739 IXAudio2SourceVoice_GetOutputFilterParameters(&This->IXAudio2SourceVoice_iface,
740 pDestinationVoice, pParameters);
743 static HRESULT WINAPI XA27SRC_SetVolume(IXAudio27SourceVoice *iface, float Volume,
744 UINT32 OperationSet)
746 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
747 return IXAudio2SourceVoice_SetVolume(&This->IXAudio2SourceVoice_iface, Volume,
748 OperationSet);
751 static void WINAPI XA27SRC_GetVolume(IXAudio27SourceVoice *iface, float *pVolume)
753 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
754 IXAudio2SourceVoice_GetVolume(&This->IXAudio2SourceVoice_iface, pVolume);
757 static HRESULT WINAPI XA27SRC_SetChannelVolumes(IXAudio27SourceVoice *iface,
758 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
760 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
761 return IXAudio2SourceVoice_SetChannelVolumes(&This->IXAudio2SourceVoice_iface, Channels,
762 pVolumes, OperationSet);
765 static void WINAPI XA27SRC_GetChannelVolumes(IXAudio27SourceVoice *iface,
766 UINT32 Channels, float *pVolumes)
768 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
769 IXAudio2SourceVoice_GetChannelVolumes(&This->IXAudio2SourceVoice_iface, Channels,
770 pVolumes);
773 static HRESULT WINAPI XA27SRC_SetOutputMatrix(IXAudio27SourceVoice *iface,
774 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
775 UINT32 DestinationChannels, const float *pLevelMatrix,
776 UINT32 OperationSet)
778 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
779 return IXAudio2SourceVoice_SetOutputMatrix(&This->IXAudio2SourceVoice_iface,
780 pDestinationVoice, SourceChannels, DestinationChannels,
781 pLevelMatrix, OperationSet);
784 static void WINAPI XA27SRC_GetOutputMatrix(IXAudio27SourceVoice *iface,
785 IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
786 UINT32 DestinationChannels, float *pLevelMatrix)
788 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
789 IXAudio2SourceVoice_GetOutputMatrix(&This->IXAudio2SourceVoice_iface, pDestinationVoice,
790 SourceChannels, DestinationChannels, pLevelMatrix);
793 static void WINAPI XA27SRC_DestroyVoice(IXAudio27SourceVoice *iface)
795 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
796 IXAudio2SourceVoice_DestroyVoice(&This->IXAudio2SourceVoice_iface);
799 static HRESULT WINAPI XA27SRC_Start(IXAudio27SourceVoice *iface, UINT32 Flags,
800 UINT32 OperationSet)
802 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
803 return IXAudio2SourceVoice_Start(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
806 static HRESULT WINAPI XA27SRC_Stop(IXAudio27SourceVoice *iface, UINT32 Flags,
807 UINT32 OperationSet)
809 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
810 return IXAudio2SourceVoice_Stop(&This->IXAudio2SourceVoice_iface, Flags, OperationSet);
813 static HRESULT WINAPI XA27SRC_SubmitSourceBuffer(IXAudio27SourceVoice *iface,
814 const XAUDIO2_BUFFER *pBuffer, const XAUDIO2_BUFFER_WMA *pBufferWMA)
816 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
817 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface, pBuffer,
818 pBufferWMA);
821 static HRESULT WINAPI XA27SRC_FlushSourceBuffers(IXAudio27SourceVoice *iface)
823 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
824 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
827 static HRESULT WINAPI XA27SRC_Discontinuity(IXAudio27SourceVoice *iface)
829 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
830 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
833 static HRESULT WINAPI XA27SRC_ExitLoop(IXAudio27SourceVoice *iface, UINT32 OperationSet)
835 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
836 return IXAudio2SourceVoice_ExitLoop(&This->IXAudio2SourceVoice_iface, OperationSet);
839 static void WINAPI XA27SRC_GetState(IXAudio27SourceVoice *iface,
840 XAUDIO2_VOICE_STATE *pVoiceState)
842 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
843 return IXAudio2SourceVoice_GetState(&This->IXAudio2SourceVoice_iface, pVoiceState, 0);
846 static HRESULT WINAPI XA27SRC_SetFrequencyRatio(IXAudio27SourceVoice *iface,
847 float Ratio, UINT32 OperationSet)
849 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
850 return IXAudio2SourceVoice_SetFrequencyRatio(&This->IXAudio2SourceVoice_iface, Ratio, OperationSet);
853 static void WINAPI XA27SRC_GetFrequencyRatio(IXAudio27SourceVoice *iface, float *pRatio)
855 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
856 return IXAudio2SourceVoice_GetFrequencyRatio(&This->IXAudio2SourceVoice_iface, pRatio);
859 static HRESULT WINAPI XA27SRC_SetSourceSampleRate(
860 IXAudio27SourceVoice *iface,
861 UINT32 NewSourceSampleRate)
863 XA2VoiceImpl *This = impl_from_IXAudio27SourceVoice(iface);
864 return IXAudio2SourceVoice_SetSourceSampleRate(&This->IXAudio2SourceVoice_iface, NewSourceSampleRate);
867 const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl = {
868 XA27SRC_GetVoiceDetails,
869 XA27SRC_SetOutputVoices,
870 XA27SRC_SetEffectChain,
871 XA27SRC_EnableEffect,
872 XA27SRC_DisableEffect,
873 XA27SRC_GetEffectState,
874 XA27SRC_SetEffectParameters,
875 XA27SRC_GetEffectParameters,
876 XA27SRC_SetFilterParameters,
877 XA27SRC_GetFilterParameters,
878 XA27SRC_SetOutputFilterParameters,
879 XA27SRC_GetOutputFilterParameters,
880 XA27SRC_SetVolume,
881 XA27SRC_GetVolume,
882 XA27SRC_SetChannelVolumes,
883 XA27SRC_GetChannelVolumes,
884 XA27SRC_SetOutputMatrix,
885 XA27SRC_GetOutputMatrix,
886 XA27SRC_DestroyVoice,
887 XA27SRC_Start,
888 XA27SRC_Stop,
889 XA27SRC_SubmitSourceBuffer,
890 XA27SRC_FlushSourceBuffers,
891 XA27SRC_Discontinuity,
892 XA27SRC_ExitLoop,
893 XA27SRC_GetState,
894 XA27SRC_SetFrequencyRatio,
895 XA27SRC_GetFrequencyRatio,
896 XA27SRC_SetSourceSampleRate
898 #endif
899 /* END IXAudio2SourceVoice */
902 /* BEGIN IXAudio2SubmixVoice */
903 #if XAUDIO2_VER == 0
904 XA2VoiceImpl *impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice *iface)
906 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio20SubmixVoice_iface);
909 static void WINAPI XA20SUB_GetVoiceDetails(IXAudio20SubmixVoice *iface,
910 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
912 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
913 XAUDIO2_VOICE_DETAILS details;
915 IXAudio2SubmixVoice_GetVoiceDetails(&This->IXAudio2SubmixVoice_iface, &details);
917 pVoiceDetails->CreationFlags = details.CreationFlags;
918 pVoiceDetails->InputChannels = details.InputChannels;
919 pVoiceDetails->InputSampleRate = details.InputSampleRate;
922 static HRESULT WINAPI XA20SUB_SetOutputVoices(IXAudio20SubmixVoice *iface,
923 const XAUDIO23_VOICE_SENDS *pSendList)
925 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
926 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
927 HRESULT hr;
929 TRACE("%p, %p\n", This, pSendList);
931 if(pSendList){
932 sends.SendCount = pSendList->OutputCount;
933 sends.pSends = convert_send_descriptors23(pSendList);
934 psends = &sends;
937 hr = IXAudio2SubmixVoice_SetOutputVoices(&This->IXAudio2SubmixVoice_iface, psends);
939 if(pSendList)
940 HeapFree(GetProcessHeap(), 0, sends.pSends);
942 return hr;
945 static HRESULT WINAPI XA20SUB_SetEffectChain(IXAudio20SubmixVoice *iface,
946 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
948 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
949 return IXAudio2SubmixVoice_SetEffectChain(&This->IXAudio2SubmixVoice_iface, pEffectChain);
952 static HRESULT WINAPI XA20SUB_EnableEffect(IXAudio20SubmixVoice *iface,
953 UINT32 EffectIndex, UINT32 OperationSet)
955 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
956 return IXAudio2SubmixVoice_EnableEffect(&This->IXAudio2SubmixVoice_iface,
957 EffectIndex, OperationSet);
960 static HRESULT WINAPI XA20SUB_DisableEffect(IXAudio20SubmixVoice *iface,
961 UINT32 EffectIndex, UINT32 OperationSet)
963 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
964 return IXAudio2SubmixVoice_DisableEffect(&This->IXAudio2SubmixVoice_iface,
965 EffectIndex, OperationSet);
968 static void WINAPI XA20SUB_GetEffectState(IXAudio20SubmixVoice *iface,
969 UINT32 EffectIndex, BOOL *pEnabled)
971 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
972 return IXAudio2SubmixVoice_GetEffectState(&This->IXAudio2SubmixVoice_iface,
973 EffectIndex, pEnabled);
976 static HRESULT WINAPI XA20SUB_SetEffectParameters(IXAudio20SubmixVoice *iface,
977 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
978 UINT32 OperationSet)
980 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
981 return IXAudio2SubmixVoice_SetEffectParameters(&This->IXAudio2SubmixVoice_iface,
982 EffectIndex, pParameters, ParametersByteSize, OperationSet);
985 static HRESULT WINAPI XA20SUB_GetEffectParameters(IXAudio20SubmixVoice *iface,
986 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
988 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
989 return IXAudio2SubmixVoice_GetEffectParameters(&This->IXAudio2SubmixVoice_iface,
990 EffectIndex, pParameters, ParametersByteSize);
993 static HRESULT WINAPI XA20SUB_SetFilterParameters(IXAudio20SubmixVoice *iface,
994 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
996 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
997 return IXAudio2SubmixVoice_SetFilterParameters(&This->IXAudio2SubmixVoice_iface,
998 pParameters, OperationSet);
1001 static void WINAPI XA20SUB_GetFilterParameters(IXAudio20SubmixVoice *iface,
1002 XAUDIO2_FILTER_PARAMETERS *pParameters)
1004 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1005 return IXAudio2SubmixVoice_GetFilterParameters(&This->IXAudio2SubmixVoice_iface, pParameters);
1008 static HRESULT WINAPI XA20SUB_SetVolume(IXAudio20SubmixVoice *iface,
1009 float Volume, UINT32 OperationSet)
1011 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1012 return IXAudio2SubmixVoice_SetVolume(&This->IXAudio2SubmixVoice_iface,
1013 Volume, OperationSet);
1016 static void WINAPI XA20SUB_GetVolume(IXAudio20SubmixVoice *iface,
1017 float *pVolume)
1019 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1020 return IXAudio2SubmixVoice_GetVolume(&This->IXAudio2SubmixVoice_iface, pVolume);
1023 static HRESULT WINAPI XA20SUB_SetChannelVolumes(IXAudio20SubmixVoice *iface,
1024 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1026 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1027 return IXAudio2SubmixVoice_SetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1028 Channels, pVolumes, OperationSet);
1031 static void WINAPI XA20SUB_GetChannelVolumes(IXAudio20SubmixVoice *iface,
1032 UINT32 Channels, float *pVolumes)
1034 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1035 return IXAudio2SubmixVoice_GetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1036 Channels, pVolumes);
1039 static HRESULT WINAPI XA20SUB_SetOutputMatrix(IXAudio20SubmixVoice *iface,
1040 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1041 UINT32 DestinationChannels, const float *pLevelMatrix,
1042 UINT32 OperationSet)
1044 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1045 return IXAudio2SubmixVoice_SetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1046 pDestinationVoice, SubmixChannels, DestinationChannels,
1047 pLevelMatrix, OperationSet);
1050 static HRESULT WINAPI XA20SUB_GetOutputMatrix(IXAudio20SubmixVoice *iface,
1051 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1052 UINT32 DestinationChannels, float *pLevelMatrix)
1054 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1055 IXAudio2SubmixVoice_GetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1056 pDestinationVoice, SubmixChannels, DestinationChannels,
1057 pLevelMatrix);
1058 return S_OK;
1061 static void WINAPI XA20SUB_DestroyVoice(IXAudio20SubmixVoice *iface)
1063 XA2VoiceImpl *This = impl_from_IXAudio20SubmixVoice(iface);
1064 return IXAudio2SubmixVoice_DestroyVoice(&This->IXAudio2SubmixVoice_iface);
1067 const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl = {
1068 XA20SUB_GetVoiceDetails,
1069 XA20SUB_SetOutputVoices,
1070 XA20SUB_SetEffectChain,
1071 XA20SUB_EnableEffect,
1072 XA20SUB_DisableEffect,
1073 XA20SUB_GetEffectState,
1074 XA20SUB_SetEffectParameters,
1075 XA20SUB_GetEffectParameters,
1076 XA20SUB_SetFilterParameters,
1077 XA20SUB_GetFilterParameters,
1078 XA20SUB_SetVolume,
1079 XA20SUB_GetVolume,
1080 XA20SUB_SetChannelVolumes,
1081 XA20SUB_GetChannelVolumes,
1082 XA20SUB_SetOutputMatrix,
1083 XA20SUB_GetOutputMatrix,
1084 XA20SUB_DestroyVoice
1087 #elif XAUDIO2_VER <= 3
1089 XA2VoiceImpl *impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice *iface)
1091 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio23SubmixVoice_iface);
1094 static void WINAPI XA23SUB_GetVoiceDetails(IXAudio23SubmixVoice *iface,
1095 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1097 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1098 XAUDIO2_VOICE_DETAILS details;
1100 IXAudio2SubmixVoice_GetVoiceDetails(&This->IXAudio2SubmixVoice_iface, &details);
1102 pVoiceDetails->CreationFlags = details.CreationFlags;
1103 pVoiceDetails->InputChannels = details.InputChannels;
1104 pVoiceDetails->InputSampleRate = details.InputSampleRate;
1107 static HRESULT WINAPI XA23SUB_SetOutputVoices(IXAudio23SubmixVoice *iface,
1108 const XAUDIO23_VOICE_SENDS *pSendList)
1110 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1111 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
1112 HRESULT hr;
1114 TRACE("%p, %p\n", This, pSendList);
1116 if(pSendList){
1117 sends.SendCount = pSendList->OutputCount;
1118 sends.pSends = convert_send_descriptors23(pSendList);
1119 psends = &sends;
1122 hr = IXAudio2SubmixVoice_SetOutputVoices(&This->IXAudio2SubmixVoice_iface, psends);
1124 if(pSendList)
1125 HeapFree(GetProcessHeap(), 0, sends.pSends);
1127 return hr;
1130 static HRESULT WINAPI XA23SUB_SetEffectChain(IXAudio23SubmixVoice *iface,
1131 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
1133 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1134 return IXAudio2SubmixVoice_SetEffectChain(&This->IXAudio2SubmixVoice_iface, pEffectChain);
1137 static HRESULT WINAPI XA23SUB_EnableEffect(IXAudio23SubmixVoice *iface,
1138 UINT32 EffectIndex, UINT32 OperationSet)
1140 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1141 return IXAudio2SubmixVoice_EnableEffect(&This->IXAudio2SubmixVoice_iface,
1142 EffectIndex, OperationSet);
1145 static HRESULT WINAPI XA23SUB_DisableEffect(IXAudio23SubmixVoice *iface,
1146 UINT32 EffectIndex, UINT32 OperationSet)
1148 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1149 return IXAudio2SubmixVoice_DisableEffect(&This->IXAudio2SubmixVoice_iface,
1150 EffectIndex, OperationSet);
1153 static void WINAPI XA23SUB_GetEffectState(IXAudio23SubmixVoice *iface,
1154 UINT32 EffectIndex, BOOL *pEnabled)
1156 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1157 return IXAudio2SubmixVoice_GetEffectState(&This->IXAudio2SubmixVoice_iface,
1158 EffectIndex, pEnabled);
1161 static HRESULT WINAPI XA23SUB_SetEffectParameters(IXAudio23SubmixVoice *iface,
1162 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
1163 UINT32 OperationSet)
1165 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1166 return IXAudio2SubmixVoice_SetEffectParameters(&This->IXAudio2SubmixVoice_iface,
1167 EffectIndex, pParameters, ParametersByteSize, OperationSet);
1170 static HRESULT WINAPI XA23SUB_GetEffectParameters(IXAudio23SubmixVoice *iface,
1171 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
1173 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1174 return IXAudio2SubmixVoice_GetEffectParameters(&This->IXAudio2SubmixVoice_iface,
1175 EffectIndex, pParameters, ParametersByteSize);
1178 static HRESULT WINAPI XA23SUB_SetFilterParameters(IXAudio23SubmixVoice *iface,
1179 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1181 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1182 return IXAudio2SubmixVoice_SetFilterParameters(&This->IXAudio2SubmixVoice_iface,
1183 pParameters, OperationSet);
1186 static void WINAPI XA23SUB_GetFilterParameters(IXAudio23SubmixVoice *iface,
1187 XAUDIO2_FILTER_PARAMETERS *pParameters)
1189 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1190 return IXAudio2SubmixVoice_GetFilterParameters(&This->IXAudio2SubmixVoice_iface, pParameters);
1193 static HRESULT WINAPI XA23SUB_SetVolume(IXAudio23SubmixVoice *iface,
1194 float Volume, UINT32 OperationSet)
1196 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1197 return IXAudio2SubmixVoice_SetVolume(&This->IXAudio2SubmixVoice_iface,
1198 Volume, OperationSet);
1201 static void WINAPI XA23SUB_GetVolume(IXAudio23SubmixVoice *iface,
1202 float *pVolume)
1204 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1205 return IXAudio2SubmixVoice_GetVolume(&This->IXAudio2SubmixVoice_iface, pVolume);
1208 static HRESULT WINAPI XA23SUB_SetChannelVolumes(IXAudio23SubmixVoice *iface,
1209 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1211 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1212 return IXAudio2SubmixVoice_SetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1213 Channels, pVolumes, OperationSet);
1216 static void WINAPI XA23SUB_GetChannelVolumes(IXAudio23SubmixVoice *iface,
1217 UINT32 Channels, float *pVolumes)
1219 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1220 return IXAudio2SubmixVoice_GetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1221 Channels, pVolumes);
1224 static HRESULT WINAPI XA23SUB_SetOutputMatrix(IXAudio23SubmixVoice *iface,
1225 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1226 UINT32 DestinationChannels, const float *pLevelMatrix,
1227 UINT32 OperationSet)
1229 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1230 return IXAudio2SubmixVoice_SetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1231 pDestinationVoice, SubmixChannels, DestinationChannels,
1232 pLevelMatrix, OperationSet);
1235 static void WINAPI XA23SUB_GetOutputMatrix(IXAudio23SubmixVoice *iface,
1236 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1237 UINT32 DestinationChannels, float *pLevelMatrix)
1239 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1240 return IXAudio2SubmixVoice_GetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1241 pDestinationVoice, SubmixChannels, DestinationChannels,
1242 pLevelMatrix);
1245 static void WINAPI XA23SUB_DestroyVoice(IXAudio23SubmixVoice *iface)
1247 XA2VoiceImpl *This = impl_from_IXAudio23SubmixVoice(iface);
1248 return IXAudio2SubmixVoice_DestroyVoice(&This->IXAudio2SubmixVoice_iface);
1251 const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl = {
1252 XA23SUB_GetVoiceDetails,
1253 XA23SUB_SetOutputVoices,
1254 XA23SUB_SetEffectChain,
1255 XA23SUB_EnableEffect,
1256 XA23SUB_DisableEffect,
1257 XA23SUB_GetEffectState,
1258 XA23SUB_SetEffectParameters,
1259 XA23SUB_GetEffectParameters,
1260 XA23SUB_SetFilterParameters,
1261 XA23SUB_GetFilterParameters,
1262 XA23SUB_SetVolume,
1263 XA23SUB_GetVolume,
1264 XA23SUB_SetChannelVolumes,
1265 XA23SUB_GetChannelVolumes,
1266 XA23SUB_SetOutputMatrix,
1267 XA23SUB_GetOutputMatrix,
1268 XA23SUB_DestroyVoice
1271 #elif XAUDIO2_VER <= 7
1273 XA2VoiceImpl *impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice *iface)
1275 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio27SubmixVoice_iface);
1278 static void WINAPI XA27SUB_GetVoiceDetails(IXAudio27SubmixVoice *iface,
1279 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1281 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1282 XAUDIO2_VOICE_DETAILS details;
1284 IXAudio2SubmixVoice_GetVoiceDetails(&This->IXAudio2SubmixVoice_iface, &details);
1286 pVoiceDetails->CreationFlags = details.CreationFlags;
1287 pVoiceDetails->InputChannels = details.InputChannels;
1288 pVoiceDetails->InputSampleRate = details.InputSampleRate;
1291 static HRESULT WINAPI XA27SUB_SetOutputVoices(IXAudio27SubmixVoice *iface,
1292 const XAUDIO2_VOICE_SENDS *pSendList)
1294 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1295 return IXAudio2SubmixVoice_SetOutputVoices(&This->IXAudio2SubmixVoice_iface, pSendList);
1298 static HRESULT WINAPI XA27SUB_SetEffectChain(IXAudio27SubmixVoice *iface,
1299 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
1301 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1302 return IXAudio2SubmixVoice_SetEffectChain(&This->IXAudio2SubmixVoice_iface, pEffectChain);
1305 static HRESULT WINAPI XA27SUB_EnableEffect(IXAudio27SubmixVoice *iface,
1306 UINT32 EffectIndex, UINT32 OperationSet)
1308 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1309 return IXAudio2SubmixVoice_EnableEffect(&This->IXAudio2SubmixVoice_iface,
1310 EffectIndex, OperationSet);
1313 static HRESULT WINAPI XA27SUB_DisableEffect(IXAudio27SubmixVoice *iface,
1314 UINT32 EffectIndex, UINT32 OperationSet)
1316 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1317 return IXAudio2SubmixVoice_DisableEffect(&This->IXAudio2SubmixVoice_iface,
1318 EffectIndex, OperationSet);
1321 static void WINAPI XA27SUB_GetEffectState(IXAudio27SubmixVoice *iface,
1322 UINT32 EffectIndex, BOOL *pEnabled)
1324 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1325 return IXAudio2SubmixVoice_GetEffectState(&This->IXAudio2SubmixVoice_iface,
1326 EffectIndex, pEnabled);
1329 static HRESULT WINAPI XA27SUB_SetEffectParameters(IXAudio27SubmixVoice *iface,
1330 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
1331 UINT32 OperationSet)
1333 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1334 return IXAudio2SubmixVoice_SetEffectParameters(&This->IXAudio2SubmixVoice_iface,
1335 EffectIndex, pParameters, ParametersByteSize, OperationSet);
1338 static HRESULT WINAPI XA27SUB_GetEffectParameters(IXAudio27SubmixVoice *iface,
1339 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
1341 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1342 return IXAudio2SubmixVoice_GetEffectParameters(&This->IXAudio2SubmixVoice_iface,
1343 EffectIndex, pParameters, ParametersByteSize);
1346 static HRESULT WINAPI XA27SUB_SetFilterParameters(IXAudio27SubmixVoice *iface,
1347 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1349 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1350 return IXAudio2SubmixVoice_SetFilterParameters(&This->IXAudio2SubmixVoice_iface,
1351 pParameters, OperationSet);
1354 static void WINAPI XA27SUB_GetFilterParameters(IXAudio27SubmixVoice *iface,
1355 XAUDIO2_FILTER_PARAMETERS *pParameters)
1357 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1358 return IXAudio2SubmixVoice_GetFilterParameters(&This->IXAudio2SubmixVoice_iface, pParameters);
1361 static HRESULT WINAPI XA27SUB_SetOutputFilterParameters(IXAudio27SubmixVoice *iface,
1362 IXAudio2Voice *pDestinationVoice,
1363 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1365 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1366 return IXAudio2SubmixVoice_SetOutputFilterParameters(&This->IXAudio2SubmixVoice_iface,
1367 pDestinationVoice, pParameters, OperationSet);
1370 static void WINAPI XA27SUB_GetOutputFilterParameters(IXAudio27SubmixVoice *iface,
1371 IXAudio2Voice *pDestinationVoice,
1372 XAUDIO2_FILTER_PARAMETERS *pParameters)
1374 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1375 IXAudio2SubmixVoice_GetOutputFilterParameters(&This->IXAudio2SubmixVoice_iface,
1376 pDestinationVoice, pParameters);
1379 static HRESULT WINAPI XA27SUB_SetVolume(IXAudio27SubmixVoice *iface,
1380 float Volume, UINT32 OperationSet)
1382 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1383 return IXAudio2SubmixVoice_SetVolume(&This->IXAudio2SubmixVoice_iface,
1384 Volume, OperationSet);
1387 static void WINAPI XA27SUB_GetVolume(IXAudio27SubmixVoice *iface,
1388 float *pVolume)
1390 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1391 return IXAudio2SubmixVoice_GetVolume(&This->IXAudio2SubmixVoice_iface, pVolume);
1394 static HRESULT WINAPI XA27SUB_SetChannelVolumes(IXAudio27SubmixVoice *iface,
1395 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1397 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1398 return IXAudio2SubmixVoice_SetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1399 Channels, pVolumes, OperationSet);
1402 static void WINAPI XA27SUB_GetChannelVolumes(IXAudio27SubmixVoice *iface,
1403 UINT32 Channels, float *pVolumes)
1405 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1406 return IXAudio2SubmixVoice_GetChannelVolumes(&This->IXAudio2SubmixVoice_iface,
1407 Channels, pVolumes);
1410 static HRESULT WINAPI XA27SUB_SetOutputMatrix(IXAudio27SubmixVoice *iface,
1411 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1412 UINT32 DestinationChannels, const float *pLevelMatrix,
1413 UINT32 OperationSet)
1415 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1416 return IXAudio2SubmixVoice_SetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1417 pDestinationVoice, SubmixChannels, DestinationChannels,
1418 pLevelMatrix, OperationSet);
1421 static void WINAPI XA27SUB_GetOutputMatrix(IXAudio27SubmixVoice *iface,
1422 IXAudio2Voice *pDestinationVoice, UINT32 SubmixChannels,
1423 UINT32 DestinationChannels, float *pLevelMatrix)
1425 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1426 return IXAudio2SubmixVoice_GetOutputMatrix(&This->IXAudio2SubmixVoice_iface,
1427 pDestinationVoice, SubmixChannels, DestinationChannels,
1428 pLevelMatrix);
1431 static void WINAPI XA27SUB_DestroyVoice(IXAudio27SubmixVoice *iface)
1433 XA2VoiceImpl *This = impl_from_IXAudio27SubmixVoice(iface);
1434 return IXAudio2SubmixVoice_DestroyVoice(&This->IXAudio2SubmixVoice_iface);
1437 const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl = {
1438 XA27SUB_GetVoiceDetails,
1439 XA27SUB_SetOutputVoices,
1440 XA27SUB_SetEffectChain,
1441 XA27SUB_EnableEffect,
1442 XA27SUB_DisableEffect,
1443 XA27SUB_GetEffectState,
1444 XA27SUB_SetEffectParameters,
1445 XA27SUB_GetEffectParameters,
1446 XA27SUB_SetFilterParameters,
1447 XA27SUB_GetFilterParameters,
1448 XA27SUB_SetOutputFilterParameters,
1449 XA27SUB_GetOutputFilterParameters,
1450 XA27SUB_SetVolume,
1451 XA27SUB_GetVolume,
1452 XA27SUB_SetChannelVolumes,
1453 XA27SUB_GetChannelVolumes,
1454 XA27SUB_SetOutputMatrix,
1455 XA27SUB_GetOutputMatrix,
1456 XA27SUB_DestroyVoice
1458 #endif
1459 /* END IXAudio2SubmixVoice */
1462 /* BEGIN IXAudio2MasteringVoice */
1463 #if XAUDIO2_VER == 0
1464 XA2VoiceImpl *impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice *iface)
1466 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio20MasteringVoice_iface);
1469 static void WINAPI XA20M_GetVoiceDetails(IXAudio20MasteringVoice *iface,
1470 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1472 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1473 XAUDIO2_VOICE_DETAILS details;
1475 IXAudio2MasteringVoice_GetVoiceDetails(&This->IXAudio2MasteringVoice_iface, &details);
1477 pVoiceDetails->CreationFlags = details.CreationFlags;
1478 pVoiceDetails->InputChannels = details.InputChannels;
1479 pVoiceDetails->InputSampleRate = details.InputSampleRate;
1482 static HRESULT WINAPI XA20M_SetOutputVoices(IXAudio20MasteringVoice *iface,
1483 const XAUDIO23_VOICE_SENDS *pSendList)
1485 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1486 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
1487 HRESULT hr;
1489 TRACE("%p, %p\n", This, pSendList);
1491 if(pSendList){
1492 sends.SendCount = pSendList->OutputCount;
1493 sends.pSends = convert_send_descriptors23(pSendList);
1494 psends = &sends;
1497 hr = IXAudio2MasteringVoice_SetOutputVoices(&This->IXAudio2MasteringVoice_iface, psends);
1499 if(pSendList)
1500 HeapFree(GetProcessHeap(), 0, sends.pSends);
1502 return hr;
1505 static HRESULT WINAPI XA20M_SetEffectChain(IXAudio20MasteringVoice *iface,
1506 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
1508 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1509 return IXAudio2MasteringVoice_SetEffectChain(&This->IXAudio2MasteringVoice_iface, pEffectChain);
1512 static HRESULT WINAPI XA20M_EnableEffect(IXAudio20MasteringVoice *iface,
1513 UINT32 EffectIndex, UINT32 OperationSet)
1515 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1516 return IXAudio2MasteringVoice_EnableEffect(&This->IXAudio2MasteringVoice_iface,
1517 EffectIndex, OperationSet);
1520 static HRESULT WINAPI XA20M_DisableEffect(IXAudio20MasteringVoice *iface,
1521 UINT32 EffectIndex, UINT32 OperationSet)
1523 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1524 return IXAudio2MasteringVoice_DisableEffect(&This->IXAudio2MasteringVoice_iface,
1525 EffectIndex, OperationSet);
1528 static void WINAPI XA20M_GetEffectState(IXAudio20MasteringVoice *iface,
1529 UINT32 EffectIndex, BOOL *pEnabled)
1531 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1532 return IXAudio2MasteringVoice_GetEffectState(&This->IXAudio2MasteringVoice_iface,
1533 EffectIndex, pEnabled);
1536 static HRESULT WINAPI XA20M_SetEffectParameters(IXAudio20MasteringVoice *iface,
1537 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
1538 UINT32 OperationSet)
1540 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1541 return IXAudio2MasteringVoice_SetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1542 EffectIndex, pParameters, ParametersByteSize, OperationSet);
1545 static HRESULT WINAPI XA20M_GetEffectParameters(IXAudio20MasteringVoice *iface,
1546 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
1548 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1549 return IXAudio2MasteringVoice_GetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1550 EffectIndex, pParameters, ParametersByteSize);
1553 static HRESULT WINAPI XA20M_SetFilterParameters(IXAudio20MasteringVoice *iface,
1554 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1556 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1557 return IXAudio2MasteringVoice_SetFilterParameters(&This->IXAudio2MasteringVoice_iface,
1558 pParameters, OperationSet);
1561 static void WINAPI XA20M_GetFilterParameters(IXAudio20MasteringVoice *iface,
1562 XAUDIO2_FILTER_PARAMETERS *pParameters)
1564 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1565 return IXAudio2MasteringVoice_GetFilterParameters(&This->IXAudio2MasteringVoice_iface, pParameters);
1568 static HRESULT WINAPI XA20M_SetVolume(IXAudio20MasteringVoice *iface,
1569 float Volume, UINT32 OperationSet)
1571 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1572 return IXAudio2MasteringVoice_SetVolume(&This->IXAudio2MasteringVoice_iface,
1573 Volume, OperationSet);
1576 static void WINAPI XA20M_GetVolume(IXAudio20MasteringVoice *iface,
1577 float *pVolume)
1579 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1580 return IXAudio2MasteringVoice_GetVolume(&This->IXAudio2MasteringVoice_iface, pVolume);
1583 static HRESULT WINAPI XA20M_SetChannelVolumes(IXAudio20MasteringVoice *iface,
1584 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1586 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1587 return IXAudio2MasteringVoice_SetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1588 Channels, pVolumes, OperationSet);
1591 static void WINAPI XA20M_GetChannelVolumes(IXAudio20MasteringVoice *iface,
1592 UINT32 Channels, float *pVolumes)
1594 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1595 return IXAudio2MasteringVoice_GetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1596 Channels, pVolumes);
1599 static HRESULT WINAPI XA20M_SetOutputMatrix(IXAudio20MasteringVoice *iface,
1600 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1601 UINT32 DestinationChannels, const float *pLevelMatrix,
1602 UINT32 OperationSet)
1604 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1605 return IXAudio2MasteringVoice_SetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1606 pDestinationVoice, MasteringChannels, DestinationChannels,
1607 pLevelMatrix, OperationSet);
1610 static HRESULT WINAPI XA20M_GetOutputMatrix(IXAudio20MasteringVoice *iface,
1611 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1612 UINT32 DestinationChannels, float *pLevelMatrix)
1614 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1615 IXAudio2MasteringVoice_GetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1616 pDestinationVoice, MasteringChannels, DestinationChannels,
1617 pLevelMatrix);
1618 return S_OK;
1621 static void WINAPI XA20M_DestroyVoice(IXAudio20MasteringVoice *iface)
1623 XA2VoiceImpl *This = impl_from_IXAudio20MasteringVoice(iface);
1624 return IXAudio2MasteringVoice_DestroyVoice(&This->IXAudio2MasteringVoice_iface);
1627 const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl = {
1628 XA20M_GetVoiceDetails,
1629 XA20M_SetOutputVoices,
1630 XA20M_SetEffectChain,
1631 XA20M_EnableEffect,
1632 XA20M_DisableEffect,
1633 XA20M_GetEffectState,
1634 XA20M_SetEffectParameters,
1635 XA20M_GetEffectParameters,
1636 XA20M_SetFilterParameters,
1637 XA20M_GetFilterParameters,
1638 XA20M_SetVolume,
1639 XA20M_GetVolume,
1640 XA20M_SetChannelVolumes,
1641 XA20M_GetChannelVolumes,
1642 XA20M_SetOutputMatrix,
1643 XA20M_GetOutputMatrix,
1644 XA20M_DestroyVoice
1647 #elif XAUDIO2_VER <= 3
1649 XA2VoiceImpl *impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice *iface)
1651 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio23MasteringVoice_iface);
1654 static void WINAPI XA23M_GetVoiceDetails(IXAudio23MasteringVoice *iface,
1655 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1657 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1658 XAUDIO2_VOICE_DETAILS details;
1660 IXAudio2MasteringVoice_GetVoiceDetails(&This->IXAudio2MasteringVoice_iface, &details);
1662 pVoiceDetails->CreationFlags = details.CreationFlags;
1663 pVoiceDetails->InputChannels = details.InputChannels;
1664 pVoiceDetails->InputSampleRate = details.InputSampleRate;
1667 static HRESULT WINAPI XA23M_SetOutputVoices(IXAudio23MasteringVoice *iface,
1668 const XAUDIO23_VOICE_SENDS *pSendList)
1670 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1671 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
1672 HRESULT hr;
1674 TRACE("%p, %p\n", This, pSendList);
1676 if(pSendList){
1677 sends.SendCount = pSendList->OutputCount;
1678 sends.pSends = convert_send_descriptors23(pSendList);
1679 psends = &sends;
1682 hr = IXAudio2MasteringVoice_SetOutputVoices(&This->IXAudio2MasteringVoice_iface, psends);
1684 if(pSendList)
1685 HeapFree(GetProcessHeap(), 0, sends.pSends);
1687 return hr;
1690 static HRESULT WINAPI XA23M_SetEffectChain(IXAudio23MasteringVoice *iface,
1691 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
1693 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1694 return IXAudio2MasteringVoice_SetEffectChain(&This->IXAudio2MasteringVoice_iface, pEffectChain);
1697 static HRESULT WINAPI XA23M_EnableEffect(IXAudio23MasteringVoice *iface,
1698 UINT32 EffectIndex, UINT32 OperationSet)
1700 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1701 return IXAudio2MasteringVoice_EnableEffect(&This->IXAudio2MasteringVoice_iface,
1702 EffectIndex, OperationSet);
1705 static HRESULT WINAPI XA23M_DisableEffect(IXAudio23MasteringVoice *iface,
1706 UINT32 EffectIndex, UINT32 OperationSet)
1708 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1709 return IXAudio2MasteringVoice_DisableEffect(&This->IXAudio2MasteringVoice_iface,
1710 EffectIndex, OperationSet);
1713 static void WINAPI XA23M_GetEffectState(IXAudio23MasteringVoice *iface,
1714 UINT32 EffectIndex, BOOL *pEnabled)
1716 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1717 return IXAudio2MasteringVoice_GetEffectState(&This->IXAudio2MasteringVoice_iface,
1718 EffectIndex, pEnabled);
1721 static HRESULT WINAPI XA23M_SetEffectParameters(IXAudio23MasteringVoice *iface,
1722 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
1723 UINT32 OperationSet)
1725 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1726 return IXAudio2MasteringVoice_SetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1727 EffectIndex, pParameters, ParametersByteSize, OperationSet);
1730 static HRESULT WINAPI XA23M_GetEffectParameters(IXAudio23MasteringVoice *iface,
1731 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
1733 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1734 return IXAudio2MasteringVoice_GetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1735 EffectIndex, pParameters, ParametersByteSize);
1738 static HRESULT WINAPI XA23M_SetFilterParameters(IXAudio23MasteringVoice *iface,
1739 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1741 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1742 return IXAudio2MasteringVoice_SetFilterParameters(&This->IXAudio2MasteringVoice_iface,
1743 pParameters, OperationSet);
1746 static void WINAPI XA23M_GetFilterParameters(IXAudio23MasteringVoice *iface,
1747 XAUDIO2_FILTER_PARAMETERS *pParameters)
1749 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1750 return IXAudio2MasteringVoice_GetFilterParameters(&This->IXAudio2MasteringVoice_iface, pParameters);
1753 static HRESULT WINAPI XA23M_SetVolume(IXAudio23MasteringVoice *iface,
1754 float Volume, UINT32 OperationSet)
1756 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1757 return IXAudio2MasteringVoice_SetVolume(&This->IXAudio2MasteringVoice_iface,
1758 Volume, OperationSet);
1761 static void WINAPI XA23M_GetVolume(IXAudio23MasteringVoice *iface,
1762 float *pVolume)
1764 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1765 return IXAudio2MasteringVoice_GetVolume(&This->IXAudio2MasteringVoice_iface, pVolume);
1768 static HRESULT WINAPI XA23M_SetChannelVolumes(IXAudio23MasteringVoice *iface,
1769 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1771 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1772 return IXAudio2MasteringVoice_SetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1773 Channels, pVolumes, OperationSet);
1776 static void WINAPI XA23M_GetChannelVolumes(IXAudio23MasteringVoice *iface,
1777 UINT32 Channels, float *pVolumes)
1779 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1780 return IXAudio2MasteringVoice_GetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1781 Channels, pVolumes);
1784 static HRESULT WINAPI XA23M_SetOutputMatrix(IXAudio23MasteringVoice *iface,
1785 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1786 UINT32 DestinationChannels, const float *pLevelMatrix,
1787 UINT32 OperationSet)
1789 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1790 return IXAudio2MasteringVoice_SetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1791 pDestinationVoice, MasteringChannels, DestinationChannels,
1792 pLevelMatrix, OperationSet);
1795 static void WINAPI XA23M_GetOutputMatrix(IXAudio23MasteringVoice *iface,
1796 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1797 UINT32 DestinationChannels, float *pLevelMatrix)
1799 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1800 return IXAudio2MasteringVoice_GetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1801 pDestinationVoice, MasteringChannels, DestinationChannels,
1802 pLevelMatrix);
1805 static void WINAPI XA23M_DestroyVoice(IXAudio23MasteringVoice *iface)
1807 XA2VoiceImpl *This = impl_from_IXAudio23MasteringVoice(iface);
1808 return IXAudio2MasteringVoice_DestroyVoice(&This->IXAudio2MasteringVoice_iface);
1811 const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl = {
1812 XA23M_GetVoiceDetails,
1813 XA23M_SetOutputVoices,
1814 XA23M_SetEffectChain,
1815 XA23M_EnableEffect,
1816 XA23M_DisableEffect,
1817 XA23M_GetEffectState,
1818 XA23M_SetEffectParameters,
1819 XA23M_GetEffectParameters,
1820 XA23M_SetFilterParameters,
1821 XA23M_GetFilterParameters,
1822 XA23M_SetVolume,
1823 XA23M_GetVolume,
1824 XA23M_SetChannelVolumes,
1825 XA23M_GetChannelVolumes,
1826 XA23M_SetOutputMatrix,
1827 XA23M_GetOutputMatrix,
1828 XA23M_DestroyVoice
1831 #elif XAUDIO2_VER <= 7
1833 XA2VoiceImpl *impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice *iface)
1835 return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio27MasteringVoice_iface);
1838 static void WINAPI XA27M_GetVoiceDetails(IXAudio27MasteringVoice *iface,
1839 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1841 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1842 XAUDIO2_VOICE_DETAILS details;
1844 IXAudio2MasteringVoice_GetVoiceDetails(&This->IXAudio2MasteringVoice_iface, &details);
1846 pVoiceDetails->CreationFlags = details.CreationFlags;
1847 pVoiceDetails->InputChannels = details.InputChannels;
1848 pVoiceDetails->InputSampleRate = details.InputSampleRate;
1851 static HRESULT WINAPI XA27M_SetOutputVoices(IXAudio27MasteringVoice *iface,
1852 const XAUDIO2_VOICE_SENDS *pSendList)
1854 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1855 return IXAudio2MasteringVoice_SetOutputVoices(&This->IXAudio2MasteringVoice_iface, pSendList);
1858 static HRESULT WINAPI XA27M_SetEffectChain(IXAudio27MasteringVoice *iface,
1859 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
1861 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1862 return IXAudio2MasteringVoice_SetEffectChain(&This->IXAudio2MasteringVoice_iface, pEffectChain);
1865 static HRESULT WINAPI XA27M_EnableEffect(IXAudio27MasteringVoice *iface,
1866 UINT32 EffectIndex, UINT32 OperationSet)
1868 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1869 return IXAudio2MasteringVoice_EnableEffect(&This->IXAudio2MasteringVoice_iface,
1870 EffectIndex, OperationSet);
1873 static HRESULT WINAPI XA27M_DisableEffect(IXAudio27MasteringVoice *iface,
1874 UINT32 EffectIndex, UINT32 OperationSet)
1876 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1877 return IXAudio2MasteringVoice_DisableEffect(&This->IXAudio2MasteringVoice_iface,
1878 EffectIndex, OperationSet);
1881 static void WINAPI XA27M_GetEffectState(IXAudio27MasteringVoice *iface,
1882 UINT32 EffectIndex, BOOL *pEnabled)
1884 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1885 return IXAudio2MasteringVoice_GetEffectState(&This->IXAudio2MasteringVoice_iface,
1886 EffectIndex, pEnabled);
1889 static HRESULT WINAPI XA27M_SetEffectParameters(IXAudio27MasteringVoice *iface,
1890 UINT32 EffectIndex, const void *pParameters, UINT32 ParametersByteSize,
1891 UINT32 OperationSet)
1893 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1894 return IXAudio2MasteringVoice_SetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1895 EffectIndex, pParameters, ParametersByteSize, OperationSet);
1898 static HRESULT WINAPI XA27M_GetEffectParameters(IXAudio27MasteringVoice *iface,
1899 UINT32 EffectIndex, void *pParameters, UINT32 ParametersByteSize)
1901 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1902 return IXAudio2MasteringVoice_GetEffectParameters(&This->IXAudio2MasteringVoice_iface,
1903 EffectIndex, pParameters, ParametersByteSize);
1906 static HRESULT WINAPI XA27M_SetFilterParameters(IXAudio27MasteringVoice *iface,
1907 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1909 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1910 return IXAudio2MasteringVoice_SetFilterParameters(&This->IXAudio2MasteringVoice_iface,
1911 pParameters, OperationSet);
1914 static void WINAPI XA27M_GetFilterParameters(IXAudio27MasteringVoice *iface,
1915 XAUDIO2_FILTER_PARAMETERS *pParameters)
1917 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1918 return IXAudio2MasteringVoice_GetFilterParameters(&This->IXAudio2MasteringVoice_iface, pParameters);
1921 static HRESULT WINAPI XA27M_SetOutputFilterParameters(IXAudio27MasteringVoice *iface,
1922 IXAudio2Voice *pDestinationVoice,
1923 const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
1925 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1926 return IXAudio2MasteringVoice_SetOutputFilterParameters(&This->IXAudio2MasteringVoice_iface,
1927 pDestinationVoice, pParameters, OperationSet);
1930 static void WINAPI XA27M_GetOutputFilterParameters(IXAudio27MasteringVoice *iface,
1931 IXAudio2Voice *pDestinationVoice,
1932 XAUDIO2_FILTER_PARAMETERS *pParameters)
1934 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1935 IXAudio2MasteringVoice_GetOutputFilterParameters(&This->IXAudio2MasteringVoice_iface,
1936 pDestinationVoice, pParameters);
1939 static HRESULT WINAPI XA27M_SetVolume(IXAudio27MasteringVoice *iface,
1940 float Volume, UINT32 OperationSet)
1942 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1943 return IXAudio2MasteringVoice_SetVolume(&This->IXAudio2MasteringVoice_iface,
1944 Volume, OperationSet);
1947 static void WINAPI XA27M_GetVolume(IXAudio27MasteringVoice *iface,
1948 float *pVolume)
1950 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1951 return IXAudio2MasteringVoice_GetVolume(&This->IXAudio2MasteringVoice_iface, pVolume);
1954 static HRESULT WINAPI XA27M_SetChannelVolumes(IXAudio27MasteringVoice *iface,
1955 UINT32 Channels, const float *pVolumes, UINT32 OperationSet)
1957 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1958 return IXAudio2MasteringVoice_SetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1959 Channels, pVolumes, OperationSet);
1962 static void WINAPI XA27M_GetChannelVolumes(IXAudio27MasteringVoice *iface,
1963 UINT32 Channels, float *pVolumes)
1965 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1966 return IXAudio2MasteringVoice_GetChannelVolumes(&This->IXAudio2MasteringVoice_iface,
1967 Channels, pVolumes);
1970 static HRESULT WINAPI XA27M_SetOutputMatrix(IXAudio27MasteringVoice *iface,
1971 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1972 UINT32 DestinationChannels, const float *pLevelMatrix,
1973 UINT32 OperationSet)
1975 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1976 return IXAudio2MasteringVoice_SetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1977 pDestinationVoice, MasteringChannels, DestinationChannels,
1978 pLevelMatrix, OperationSet);
1981 static void WINAPI XA27M_GetOutputMatrix(IXAudio27MasteringVoice *iface,
1982 IXAudio2Voice *pDestinationVoice, UINT32 MasteringChannels,
1983 UINT32 DestinationChannels, float *pLevelMatrix)
1985 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1986 return IXAudio2MasteringVoice_GetOutputMatrix(&This->IXAudio2MasteringVoice_iface,
1987 pDestinationVoice, MasteringChannels, DestinationChannels,
1988 pLevelMatrix);
1991 static void WINAPI XA27M_DestroyVoice(IXAudio27MasteringVoice *iface)
1993 XA2VoiceImpl *This = impl_from_IXAudio27MasteringVoice(iface);
1994 return IXAudio2MasteringVoice_DestroyVoice(&This->IXAudio2MasteringVoice_iface);
1997 const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl = {
1998 XA27M_GetVoiceDetails,
1999 XA27M_SetOutputVoices,
2000 XA27M_SetEffectChain,
2001 XA27M_EnableEffect,
2002 XA27M_DisableEffect,
2003 XA27M_GetEffectState,
2004 XA27M_SetEffectParameters,
2005 XA27M_GetEffectParameters,
2006 XA27M_SetFilterParameters,
2007 XA27M_GetFilterParameters,
2008 XA27M_SetOutputFilterParameters,
2009 XA27M_GetOutputFilterParameters,
2010 XA27M_SetVolume,
2011 XA27M_GetVolume,
2012 XA27M_SetChannelVolumes,
2013 XA27M_GetChannelVolumes,
2014 XA27M_SetOutputMatrix,
2015 XA27M_GetOutputMatrix,
2016 XA27M_DestroyVoice
2018 #endif
2019 /* END IXAudio2MasteringVoice */
2022 /* BEGIN IXAudio2 */
2023 #if XAUDIO2_VER == 0
2024 static inline IXAudio2Impl *impl_from_IXAudio20(IXAudio20 *iface)
2026 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio20_iface);
2029 static HRESULT WINAPI XA20_QueryInterface(IXAudio20 *iface, REFIID riid,
2030 void **ppvObject)
2032 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2033 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2036 static ULONG WINAPI XA20_AddRef(IXAudio20 *iface)
2038 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2039 return IXAudio2_AddRef(&This->IXAudio2_iface);
2042 static ULONG WINAPI XA20_Release(IXAudio20 *iface)
2044 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2045 return IXAudio2_Release(&This->IXAudio2_iface);
2048 static HRESULT WINAPI XA20_GetDeviceCount(IXAudio20 *iface, UINT32 *pCount)
2050 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2051 TRACE("%p, %p\n", This, pCount);
2052 return FAudio_GetDeviceCount(This->faudio, pCount);
2055 static HRESULT WINAPI XA20_GetDeviceDetails(IXAudio20 *iface, UINT32 index,
2056 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2058 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2059 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2060 return FAudio_GetDeviceDetails(This->faudio, index, (FAudioDeviceDetails *)pDeviceDetails);
2063 static HRESULT WINAPI XA20_Initialize(IXAudio20 *iface, UINT32 flags,
2064 XAUDIO2_PROCESSOR processor)
2066 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2067 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2068 return xaudio2_initialize(This, flags, processor);
2071 static HRESULT WINAPI XA20_RegisterForCallbacks(IXAudio20 *iface,
2072 IXAudio2EngineCallback *pCallback)
2074 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2075 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2078 static void WINAPI XA20_UnregisterForCallbacks(IXAudio20 *iface,
2079 IXAudio2EngineCallback *pCallback)
2081 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2082 return IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2085 static HRESULT WINAPI XA20_CreateSourceVoice(IXAudio20 *iface,
2086 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2087 UINT32 flags, float maxFrequencyRatio,
2088 IXAudio2VoiceCallback *pCallback, const XAUDIO23_VOICE_SENDS *pSendList,
2089 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2091 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2092 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2093 HRESULT hr;
2095 if(pSendList){
2096 sends.SendCount = pSendList->OutputCount;
2097 sends.pSends = convert_send_descriptors23(pSendList);
2098 psends = &sends;
2101 hr = IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2102 pSourceFormat, flags, maxFrequencyRatio, pCallback, psends,
2103 pEffectChain);
2105 if(pSendList)
2106 HeapFree(GetProcessHeap(), 0, sends.pSends);
2108 return hr;
2111 static HRESULT WINAPI XA20_CreateSubmixVoice(IXAudio20 *iface,
2112 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2113 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2114 const XAUDIO23_VOICE_SENDS *pSendList,
2115 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2117 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2118 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2119 HRESULT hr;
2121 if(pSendList){
2122 sends.SendCount = pSendList->OutputCount;
2123 sends.pSends = convert_send_descriptors23(pSendList);
2124 psends = &sends;
2127 hr = IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2128 inputChannels, inputSampleRate, flags, processingStage, psends,
2129 pEffectChain);
2131 if(pSendList)
2132 HeapFree(GetProcessHeap(), 0, sends.pSends);
2134 return hr;
2137 static HRESULT WINAPI XA20_CreateMasteringVoice(IXAudio20 *iface,
2138 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2139 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2140 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2142 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2144 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2145 inputChannels, inputSampleRate, flags, deviceIndex,
2146 pEffectChain);
2148 EnterCriticalSection(&This->lock);
2150 /* XAUDIO2_VER == 0 */
2151 *ppMasteringVoice = (IXAudio2MasteringVoice*)&This->mst.IXAudio20MasteringVoice_iface;
2153 EnterCriticalSection(&This->mst.lock);
2155 if(This->mst.in_use){
2156 LeaveCriticalSection(&This->mst.lock);
2157 LeaveCriticalSection(&This->lock);
2158 return COMPAT_E_INVALID_CALL;
2161 LeaveCriticalSection(&This->lock);
2163 This->mst.effect_chain = wrap_effect_chain(pEffectChain);
2165 pthread_mutex_lock(&This->mst.engine_lock);
2167 This->mst.engine_thread = CreateThread(NULL, 0, &engine_thread, &This->mst, 0, NULL);
2169 pthread_cond_wait(&This->mst.engine_done, &This->mst.engine_lock);
2171 pthread_mutex_unlock(&This->mst.engine_lock);
2173 FAudio_SetEngineProcedureEXT(This->faudio, &engine_cb, &This->mst);
2175 FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
2176 inputSampleRate, flags, deviceIndex, This->mst.effect_chain);
2178 This->mst.in_use = TRUE;
2180 LeaveCriticalSection(&This->mst.lock);
2182 return S_OK;
2185 static HRESULT WINAPI XA20_StartEngine(IXAudio20 *iface)
2187 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2188 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2191 static void WINAPI XA20_StopEngine(IXAudio20 *iface)
2193 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2194 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2197 static HRESULT WINAPI XA20_CommitChanges(IXAudio20 *iface, UINT32 operationSet)
2199 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2200 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2203 static void WINAPI XA20_GetPerformanceData(IXAudio20 *iface,
2204 XAUDIO20_PERFORMANCE_DATA *pPerfData)
2206 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2207 XAUDIO2_PERFORMANCE_DATA data;
2209 IXAudio2_GetPerformanceData(&This->IXAudio2_iface, &data);
2211 pPerfData->AudioCyclesSinceLastQuery = data.AudioCyclesSinceLastQuery;
2212 pPerfData->TotalCyclesSinceLastQuery = data.TotalCyclesSinceLastQuery;
2213 pPerfData->MinimumCyclesPerQuantum = data.MinimumCyclesPerQuantum;
2214 pPerfData->MaximumCyclesPerQuantum = data.MaximumCyclesPerQuantum;
2215 pPerfData->MemoryUsageInBytes = data.MemoryUsageInBytes;
2216 pPerfData->CurrentLatencyInSamples = data.CurrentLatencyInSamples;
2217 pPerfData->GlitchesSinceLastQuery = data.GlitchesSinceEngineStarted - This->last_query_glitches;
2218 This->last_query_glitches = data.GlitchesSinceEngineStarted;
2219 pPerfData->ActiveSourceVoiceCount = data.ActiveSourceVoiceCount;
2220 pPerfData->TotalSourceVoiceCount = data.TotalSourceVoiceCount;
2222 pPerfData->ActiveSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2223 pPerfData->TotalSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2225 pPerfData->ActiveXmaSourceVoices = data.ActiveXmaSourceVoices;
2226 pPerfData->ActiveXmaStreams = data.ActiveXmaStreams;
2229 static void WINAPI XA20_SetDebugConfiguration(IXAudio20 *iface,
2230 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2231 void *pReserved)
2233 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2234 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2235 pDebugConfiguration, pReserved);
2238 const IXAudio20Vtbl XAudio20_Vtbl = {
2239 XA20_QueryInterface,
2240 XA20_AddRef,
2241 XA20_Release,
2242 XA20_GetDeviceCount,
2243 XA20_GetDeviceDetails,
2244 XA20_Initialize,
2245 XA20_RegisterForCallbacks,
2246 XA20_UnregisterForCallbacks,
2247 XA20_CreateSourceVoice,
2248 XA20_CreateSubmixVoice,
2249 XA20_CreateMasteringVoice,
2250 XA20_StartEngine,
2251 XA20_StopEngine,
2252 XA20_CommitChanges,
2253 XA20_GetPerformanceData,
2254 XA20_SetDebugConfiguration
2257 #elif XAUDIO2_VER <= 2
2259 static inline IXAudio2Impl *impl_from_IXAudio22(IXAudio22 *iface)
2261 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio22_iface);
2264 static HRESULT WINAPI XA22_QueryInterface(IXAudio22 *iface, REFIID riid,
2265 void **ppvObject)
2267 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2268 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2271 static ULONG WINAPI XA22_AddRef(IXAudio22 *iface)
2273 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2274 return IXAudio2_AddRef(&This->IXAudio2_iface);
2277 static ULONG WINAPI XA22_Release(IXAudio22 *iface)
2279 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2280 return IXAudio2_Release(&This->IXAudio2_iface);
2283 static HRESULT WINAPI XA22_GetDeviceCount(IXAudio22 *iface, UINT32 *pCount)
2285 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2286 TRACE("%p, %p\n", This, pCount);
2287 return FAudio_GetDeviceCount(This->faudio, pCount);
2290 static HRESULT WINAPI XA22_GetDeviceDetails(IXAudio22 *iface, UINT32 index,
2291 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2293 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2294 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2295 return FAudio_GetDeviceDetails(This->faudio, index, (FAudioDeviceDetails *)pDeviceDetails);
2298 static HRESULT WINAPI XA22_Initialize(IXAudio22 *iface, UINT32 flags,
2299 XAUDIO2_PROCESSOR processor)
2301 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2302 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2303 return xaudio2_initialize(This, flags, processor);
2306 static HRESULT WINAPI XA22_RegisterForCallbacks(IXAudio22 *iface,
2307 IXAudio2EngineCallback *pCallback)
2309 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2310 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2313 static void WINAPI XA22_UnregisterForCallbacks(IXAudio22 *iface,
2314 IXAudio2EngineCallback *pCallback)
2316 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2317 IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2320 static HRESULT WINAPI XA22_CreateSourceVoice(IXAudio22 *iface,
2321 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2322 UINT32 flags, float maxFrequencyRatio,
2323 IXAudio2VoiceCallback *pCallback, const XAUDIO23_VOICE_SENDS *pSendList,
2324 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2326 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2327 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2328 HRESULT hr;
2330 if(pSendList){
2331 sends.SendCount = pSendList->OutputCount;
2332 sends.pSends = convert_send_descriptors23(pSendList);
2333 psends = &sends;
2336 hr = IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2337 pSourceFormat, flags, maxFrequencyRatio, pCallback, psends,
2338 pEffectChain);
2340 if(pSendList)
2341 HeapFree(GetProcessHeap(), 0, sends.pSends);
2343 return hr;
2346 static HRESULT WINAPI XA22_CreateSubmixVoice(IXAudio22 *iface,
2347 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2348 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2349 const XAUDIO23_VOICE_SENDS *pSendList,
2350 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2352 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2353 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2354 HRESULT hr;
2356 if(pSendList){
2357 sends.SendCount = pSendList->OutputCount;
2358 sends.pSends = convert_send_descriptors23(pSendList);
2359 psends = &sends;
2362 hr = IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2363 inputChannels, inputSampleRate, flags, processingStage, psends,
2364 pEffectChain);
2366 if(pSendList)
2367 HeapFree(GetProcessHeap(), 0, sends.pSends);
2369 return hr;
2372 static HRESULT WINAPI XA22_CreateMasteringVoice(IXAudio22 *iface,
2373 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2374 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2375 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2377 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2379 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2380 inputChannels, inputSampleRate, flags, deviceIndex,
2381 pEffectChain);
2383 EnterCriticalSection(&This->lock);
2385 /* 1 <= XAUDIO2_VER <= 2 */
2386 *ppMasteringVoice = (IXAudio2MasteringVoice*)&This->mst.IXAudio23MasteringVoice_iface;
2388 EnterCriticalSection(&This->mst.lock);
2390 if(This->mst.in_use){
2391 LeaveCriticalSection(&This->mst.lock);
2392 LeaveCriticalSection(&This->lock);
2393 return COMPAT_E_INVALID_CALL;
2396 LeaveCriticalSection(&This->lock);
2398 This->mst.effect_chain = wrap_effect_chain(pEffectChain);
2400 pthread_mutex_lock(&This->mst.engine_lock);
2402 This->mst.engine_thread = CreateThread(NULL, 0, &engine_thread, &This->mst, 0, NULL);
2404 pthread_cond_wait(&This->mst.engine_done, &This->mst.engine_lock);
2406 pthread_mutex_unlock(&This->mst.engine_lock);
2408 FAudio_SetEngineProcedureEXT(This->faudio, &engine_cb, &This->mst);
2410 FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
2411 inputSampleRate, flags, deviceIndex, This->mst.effect_chain);
2413 This->mst.in_use = TRUE;
2415 LeaveCriticalSection(&This->mst.lock);
2417 return S_OK;
2420 static HRESULT WINAPI XA22_StartEngine(IXAudio22 *iface)
2422 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2423 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2426 static void WINAPI XA22_StopEngine(IXAudio22 *iface)
2428 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2429 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2432 static HRESULT WINAPI XA22_CommitChanges(IXAudio22 *iface, UINT32 operationSet)
2434 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2435 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2438 static void WINAPI XA22_GetPerformanceData(IXAudio22 *iface,
2439 XAUDIO22_PERFORMANCE_DATA *pPerfData)
2441 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2442 XAUDIO2_PERFORMANCE_DATA data;
2444 IXAudio2_GetPerformanceData(&This->IXAudio2_iface, &data);
2446 pPerfData->AudioCyclesSinceLastQuery = data.AudioCyclesSinceLastQuery;
2447 pPerfData->TotalCyclesSinceLastQuery = data.TotalCyclesSinceLastQuery;
2448 pPerfData->MinimumCyclesPerQuantum = data.MinimumCyclesPerQuantum;
2449 pPerfData->MaximumCyclesPerQuantum = data.MaximumCyclesPerQuantum;
2450 pPerfData->MemoryUsageInBytes = data.MemoryUsageInBytes;
2451 pPerfData->CurrentLatencyInSamples = data.CurrentLatencyInSamples;
2452 pPerfData->GlitchesSinceEngineStarted = data.GlitchesSinceEngineStarted;
2453 pPerfData->ActiveSourceVoiceCount = data.ActiveSourceVoiceCount;
2454 pPerfData->TotalSourceVoiceCount = data.TotalSourceVoiceCount;
2456 pPerfData->ActiveSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2457 pPerfData->TotalSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2459 pPerfData->ActiveXmaSourceVoices = data.ActiveXmaSourceVoices;
2460 pPerfData->ActiveXmaStreams = data.ActiveXmaStreams;
2463 static void WINAPI XA22_SetDebugConfiguration(IXAudio22 *iface,
2464 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2465 void *pReserved)
2467 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2468 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2469 pDebugConfiguration, pReserved);
2472 const IXAudio22Vtbl XAudio22_Vtbl = {
2473 XA22_QueryInterface,
2474 XA22_AddRef,
2475 XA22_Release,
2476 XA22_GetDeviceCount,
2477 XA22_GetDeviceDetails,
2478 XA22_Initialize,
2479 XA22_RegisterForCallbacks,
2480 XA22_UnregisterForCallbacks,
2481 XA22_CreateSourceVoice,
2482 XA22_CreateSubmixVoice,
2483 XA22_CreateMasteringVoice,
2484 XA22_StartEngine,
2485 XA22_StopEngine,
2486 XA22_CommitChanges,
2487 XA22_GetPerformanceData,
2488 XA22_SetDebugConfiguration
2491 #elif XAUDIO2_VER <= 3
2493 static inline IXAudio2Impl *impl_from_IXAudio23(IXAudio23 *iface)
2495 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio23_iface);
2498 static HRESULT WINAPI XA23_QueryInterface(IXAudio23 *iface, REFIID riid,
2499 void **ppvObject)
2501 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2502 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2505 static ULONG WINAPI XA23_AddRef(IXAudio23 *iface)
2507 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2508 return IXAudio2_AddRef(&This->IXAudio2_iface);
2511 static ULONG WINAPI XA23_Release(IXAudio23 *iface)
2513 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2514 return IXAudio2_Release(&This->IXAudio2_iface);
2517 static HRESULT WINAPI XA23_GetDeviceCount(IXAudio23 *iface, UINT32 *pCount)
2519 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2520 TRACE("%p, %p\n", This, pCount);
2521 return FAudio_GetDeviceCount(This->faudio, pCount);
2524 static HRESULT WINAPI XA23_GetDeviceDetails(IXAudio23 *iface, UINT32 index,
2525 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2527 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2528 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2529 return FAudio_GetDeviceDetails(This->faudio, index, (FAudioDeviceDetails *)pDeviceDetails);
2532 static HRESULT WINAPI XA23_Initialize(IXAudio23 *iface, UINT32 flags,
2533 XAUDIO2_PROCESSOR processor)
2535 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2536 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2537 return xaudio2_initialize(This, flags, processor);
2540 static HRESULT WINAPI XA23_RegisterForCallbacks(IXAudio23 *iface,
2541 IXAudio2EngineCallback *pCallback)
2543 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2544 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2547 static void WINAPI XA23_UnregisterForCallbacks(IXAudio23 *iface,
2548 IXAudio2EngineCallback *pCallback)
2550 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2551 IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2554 static HRESULT WINAPI XA23_CreateSourceVoice(IXAudio23 *iface,
2555 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2556 UINT32 flags, float maxFrequencyRatio,
2557 IXAudio2VoiceCallback *pCallback, const XAUDIO23_VOICE_SENDS *pSendList,
2558 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2560 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2561 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2562 HRESULT hr;
2564 if(pSendList){
2565 sends.SendCount = pSendList->OutputCount;
2566 sends.pSends = convert_send_descriptors23(pSendList);
2567 psends = &sends;
2570 hr = IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2571 pSourceFormat, flags, maxFrequencyRatio, pCallback, psends,
2572 pEffectChain);
2574 if(pSendList)
2575 HeapFree(GetProcessHeap(), 0, sends.pSends);
2577 return hr;
2580 static HRESULT WINAPI XA23_CreateSubmixVoice(IXAudio23 *iface,
2581 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2582 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2583 const XAUDIO23_VOICE_SENDS *pSendList,
2584 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2586 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2587 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2588 HRESULT hr;
2590 if(pSendList){
2591 sends.SendCount = pSendList->OutputCount;
2592 sends.pSends = convert_send_descriptors23(pSendList);
2593 psends = &sends;
2596 hr = IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2597 inputChannels, inputSampleRate, flags, processingStage, psends,
2598 pEffectChain);
2600 if(pSendList)
2601 HeapFree(GetProcessHeap(), 0, sends.pSends);
2603 return hr;
2606 static HRESULT WINAPI XA23_CreateMasteringVoice(IXAudio23 *iface,
2607 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2608 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2609 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2611 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2613 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2614 inputChannels, inputSampleRate, flags, deviceIndex,
2615 pEffectChain);
2617 EnterCriticalSection(&This->lock);
2619 /* XAUDIO2_VER == 3 */
2620 *ppMasteringVoice = (IXAudio2MasteringVoice*)&This->mst.IXAudio23MasteringVoice_iface;
2622 EnterCriticalSection(&This->mst.lock);
2624 if(This->mst.in_use){
2625 LeaveCriticalSection(&This->mst.lock);
2626 LeaveCriticalSection(&This->lock);
2627 return COMPAT_E_INVALID_CALL;
2630 LeaveCriticalSection(&This->lock);
2632 This->mst.effect_chain = wrap_effect_chain(pEffectChain);
2634 pthread_mutex_lock(&This->mst.engine_lock);
2636 This->mst.engine_thread = CreateThread(NULL, 0, &engine_thread, &This->mst, 0, NULL);
2638 pthread_cond_wait(&This->mst.engine_done, &This->mst.engine_lock);
2640 pthread_mutex_unlock(&This->mst.engine_lock);
2642 FAudio_SetEngineProcedureEXT(This->faudio, &engine_cb, &This->mst);
2644 FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
2645 inputSampleRate, flags, deviceIndex, This->mst.effect_chain);
2647 This->mst.in_use = TRUE;
2649 LeaveCriticalSection(&This->mst.lock);
2651 return S_OK;
2654 static HRESULT WINAPI XA23_StartEngine(IXAudio23 *iface)
2656 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2657 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2660 static void WINAPI XA23_StopEngine(IXAudio23 *iface)
2662 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2663 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2666 static HRESULT WINAPI XA23_CommitChanges(IXAudio23 *iface, UINT32 operationSet)
2668 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2669 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2672 static void WINAPI XA23_GetPerformanceData(IXAudio23 *iface,
2673 XAUDIO2_PERFORMANCE_DATA *pPerfData)
2675 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2676 return IXAudio2_GetPerformanceData(&This->IXAudio2_iface, pPerfData);
2679 static void WINAPI XA23_SetDebugConfiguration(IXAudio23 *iface,
2680 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2681 void *pReserved)
2683 IXAudio2Impl *This = impl_from_IXAudio23(iface);
2684 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2685 pDebugConfiguration, pReserved);
2688 const IXAudio23Vtbl XAudio23_Vtbl = {
2689 XA23_QueryInterface,
2690 XA23_AddRef,
2691 XA23_Release,
2692 XA23_GetDeviceCount,
2693 XA23_GetDeviceDetails,
2694 XA23_Initialize,
2695 XA23_RegisterForCallbacks,
2696 XA23_UnregisterForCallbacks,
2697 XA23_CreateSourceVoice,
2698 XA23_CreateSubmixVoice,
2699 XA23_CreateMasteringVoice,
2700 XA23_StartEngine,
2701 XA23_StopEngine,
2702 XA23_CommitChanges,
2703 XA23_GetPerformanceData,
2704 XA23_SetDebugConfiguration
2707 #elif XAUDIO2_VER <= 7
2709 static inline IXAudio2Impl *impl_from_IXAudio27(IXAudio27 *iface)
2711 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio27_iface);
2714 static HRESULT WINAPI XA27_QueryInterface(IXAudio27 *iface, REFIID riid,
2715 void **ppvObject)
2717 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2718 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2721 static ULONG WINAPI XA27_AddRef(IXAudio27 *iface)
2723 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2724 return IXAudio2_AddRef(&This->IXAudio2_iface);
2727 static ULONG WINAPI XA27_Release(IXAudio27 *iface)
2729 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2730 return IXAudio2_Release(&This->IXAudio2_iface);
2733 static HRESULT WINAPI XA27_GetDeviceCount(IXAudio27 *iface, UINT32 *pCount)
2735 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2736 TRACE("%p, %p\n", This, pCount);
2737 return FAudio_GetDeviceCount(This->faudio, pCount);
2740 static HRESULT WINAPI XA27_GetDeviceDetails(IXAudio27 *iface, UINT32 index,
2741 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2743 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2744 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2745 return FAudio_GetDeviceDetails(This->faudio, index, (FAudioDeviceDetails *)pDeviceDetails);
2748 static HRESULT WINAPI XA27_Initialize(IXAudio27 *iface, UINT32 flags,
2749 XAUDIO2_PROCESSOR processor)
2751 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2752 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2753 return xaudio2_initialize(This, flags, processor);
2756 static HRESULT WINAPI XA27_RegisterForCallbacks(IXAudio27 *iface,
2757 IXAudio2EngineCallback *pCallback)
2759 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2760 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2763 static void WINAPI XA27_UnregisterForCallbacks(IXAudio27 *iface,
2764 IXAudio2EngineCallback *pCallback)
2766 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2767 IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2770 static HRESULT WINAPI XA27_CreateSourceVoice(IXAudio27 *iface,
2771 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2772 UINT32 flags, float maxFrequencyRatio,
2773 IXAudio2VoiceCallback *pCallback, const XAUDIO2_VOICE_SENDS *pSendList,
2774 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2776 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2777 return IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2778 pSourceFormat, flags, maxFrequencyRatio, pCallback, pSendList,
2779 pEffectChain);
2782 static HRESULT WINAPI XA27_CreateSubmixVoice(IXAudio27 *iface,
2783 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2784 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2785 const XAUDIO2_VOICE_SENDS *pSendList,
2786 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2788 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2789 return IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2790 inputChannels, inputSampleRate, flags, processingStage, pSendList,
2791 pEffectChain);
2794 static HRESULT WINAPI XA27_CreateMasteringVoice(IXAudio27 *iface,
2795 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2796 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2797 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2799 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2801 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2802 inputChannels, inputSampleRate, flags, deviceIndex,
2803 pEffectChain);
2805 EnterCriticalSection(&This->lock);
2807 /* 4 <= XAUDIO2_VER <= 7 */
2808 *ppMasteringVoice = (IXAudio2MasteringVoice*)&This->mst.IXAudio27MasteringVoice_iface;
2810 EnterCriticalSection(&This->mst.lock);
2812 if(This->mst.in_use){
2813 LeaveCriticalSection(&This->mst.lock);
2814 LeaveCriticalSection(&This->lock);
2815 return COMPAT_E_INVALID_CALL;
2818 LeaveCriticalSection(&This->lock);
2820 This->mst.effect_chain = wrap_effect_chain(pEffectChain);
2822 pthread_mutex_lock(&This->mst.engine_lock);
2824 This->mst.engine_thread = CreateThread(NULL, 0, &engine_thread, &This->mst, 0, NULL);
2826 pthread_cond_wait(&This->mst.engine_done, &This->mst.engine_lock);
2828 pthread_mutex_unlock(&This->mst.engine_lock);
2830 FAudio_SetEngineProcedureEXT(This->faudio, &engine_cb, &This->mst);
2832 FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
2833 inputSampleRate, flags, deviceIndex, This->mst.effect_chain);
2835 This->mst.in_use = TRUE;
2837 LeaveCriticalSection(&This->mst.lock);
2839 return S_OK;
2842 static HRESULT WINAPI XA27_StartEngine(IXAudio27 *iface)
2844 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2845 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2848 static void WINAPI XA27_StopEngine(IXAudio27 *iface)
2850 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2851 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2854 static HRESULT WINAPI XA27_CommitChanges(IXAudio27 *iface, UINT32 operationSet)
2856 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2857 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2860 static void WINAPI XA27_GetPerformanceData(IXAudio27 *iface,
2861 XAUDIO2_PERFORMANCE_DATA *pPerfData)
2863 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2864 return IXAudio2_GetPerformanceData(&This->IXAudio2_iface, pPerfData);
2867 static void WINAPI XA27_SetDebugConfiguration(IXAudio27 *iface,
2868 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2869 void *pReserved)
2871 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2872 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2873 pDebugConfiguration, pReserved);
2876 const IXAudio27Vtbl XAudio27_Vtbl = {
2877 XA27_QueryInterface,
2878 XA27_AddRef,
2879 XA27_Release,
2880 XA27_GetDeviceCount,
2881 XA27_GetDeviceDetails,
2882 XA27_Initialize,
2883 XA27_RegisterForCallbacks,
2884 XA27_UnregisterForCallbacks,
2885 XA27_CreateSourceVoice,
2886 XA27_CreateSubmixVoice,
2887 XA27_CreateMasteringVoice,
2888 XA27_StartEngine,
2889 XA27_StopEngine,
2890 XA27_CommitChanges,
2891 XA27_GetPerformanceData,
2892 XA27_SetDebugConfiguration
2894 #endif
2895 /* END IXAudio2 */