quartz/tests: Make testpin_{AddRef,Release}() static.
[wine.git] / dlls / xaudio2_7 / compat.c
blobb9f416654dd9e41982217f70b788d63b9a314b30
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 static XA2SourceImpl *impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice *iface)
129 return CONTAINING_RECORD(iface, XA2SourceImpl, IXAudio20SourceVoice_iface);
132 static void WINAPI XA20SRC_GetVoiceDetails(IXAudio20SourceVoice *iface,
133 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
135 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *This = impl_from_IXAudio20SourceVoice(iface);
308 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface,
309 pBuffer, pBufferWMA);
312 static HRESULT WINAPI XA20SRC_FlushSourceBuffers(IXAudio20SourceVoice *iface)
314 XA2SourceImpl *This = impl_from_IXAudio20SourceVoice(iface);
315 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
318 static HRESULT WINAPI XA20SRC_Discontinuity(IXAudio20SourceVoice *iface)
320 XA2SourceImpl *This = impl_from_IXAudio20SourceVoice(iface);
321 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
324 static HRESULT WINAPI XA20SRC_ExitLoop(IXAudio20SourceVoice *iface,
325 UINT32 OperationSet)
327 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 static XA2SourceImpl *impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice *iface)
386 return CONTAINING_RECORD(iface, XA2SourceImpl, IXAudio23SourceVoice_iface);
389 static void WINAPI XA23SRC_GetVoiceDetails(IXAudio23SourceVoice *iface,
390 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
392 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *This = impl_from_IXAudio23SourceVoice(iface);
564 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface,
565 pBuffer, pBufferWMA);
568 static HRESULT WINAPI XA23SRC_FlushSourceBuffers(IXAudio23SourceVoice *iface)
570 XA2SourceImpl *This = impl_from_IXAudio23SourceVoice(iface);
571 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
574 static HRESULT WINAPI XA23SRC_Discontinuity(IXAudio23SourceVoice *iface)
576 XA2SourceImpl *This = impl_from_IXAudio23SourceVoice(iface);
577 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
580 static HRESULT WINAPI XA23SRC_ExitLoop(IXAudio23SourceVoice *iface,
581 UINT32 OperationSet)
583 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 static XA2SourceImpl *impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice *iface)
642 return CONTAINING_RECORD(iface, XA2SourceImpl, IXAudio27SourceVoice_iface);
645 static void WINAPI XA27SRC_GetVoiceDetails(IXAudio27SourceVoice *iface,
646 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
648 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *This = impl_from_IXAudio27SourceVoice(iface);
817 return IXAudio2SourceVoice_SubmitSourceBuffer(&This->IXAudio2SourceVoice_iface, pBuffer,
818 pBufferWMA);
821 static HRESULT WINAPI XA27SRC_FlushSourceBuffers(IXAudio27SourceVoice *iface)
823 XA2SourceImpl *This = impl_from_IXAudio27SourceVoice(iface);
824 return IXAudio2SourceVoice_FlushSourceBuffers(&This->IXAudio2SourceVoice_iface);
827 static HRESULT WINAPI XA27SRC_Discontinuity(IXAudio27SourceVoice *iface)
829 XA2SourceImpl *This = impl_from_IXAudio27SourceVoice(iface);
830 return IXAudio2SourceVoice_Discontinuity(&This->IXAudio2SourceVoice_iface);
833 static HRESULT WINAPI XA27SRC_ExitLoop(IXAudio27SourceVoice *iface, UINT32 OperationSet)
835 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 XA2SourceImpl *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 static XA2SubmixImpl *impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice *iface)
906 return CONTAINING_RECORD(iface, XA2SubmixImpl, IXAudio20SubmixVoice_iface);
909 static void WINAPI XA20SUB_GetVoiceDetails(IXAudio20SubmixVoice *iface,
910 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
912 XA2SubmixImpl *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 XA2SubmixImpl *This = impl_from_IXAudio20SubmixVoice(iface);
926 XAUDIO2_VOICE_SENDS sends, *psends;
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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 static XA2SubmixImpl *impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice *iface)
1091 return CONTAINING_RECORD(iface, XA2SubmixImpl, IXAudio23SubmixVoice_iface);
1094 static void WINAPI XA23SUB_GetVoiceDetails(IXAudio23SubmixVoice *iface,
1095 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1097 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 static XA2SubmixImpl *impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice *iface)
1275 return CONTAINING_RECORD(iface, XA2SubmixImpl, IXAudio27SubmixVoice_iface);
1278 static void WINAPI XA27SUB_GetVoiceDetails(IXAudio27SubmixVoice *iface,
1279 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1281 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 XA2SubmixImpl *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 static IXAudio2Impl *impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice *iface)
1466 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio20MasteringVoice_iface);
1469 static void WINAPI XA20M_GetVoiceDetails(IXAudio20MasteringVoice *iface,
1470 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1472 IXAudio2Impl *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 IXAudio2Impl *This = impl_from_IXAudio20MasteringVoice(iface);
1486 XAUDIO2_VOICE_SENDS sends, *psends;
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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 static IXAudio2Impl *impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice *iface)
1651 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio23MasteringVoice_iface);
1654 static void WINAPI XA23M_GetVoiceDetails(IXAudio23MasteringVoice *iface,
1655 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1657 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 static IXAudio2Impl *impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice *iface)
1835 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio27MasteringVoice_iface);
1838 static void WINAPI XA27M_GetVoiceDetails(IXAudio27MasteringVoice *iface,
1839 XAUDIO27_VOICE_DETAILS *pVoiceDetails)
1841 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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 IXAudio2Impl *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);
2052 TRACE("%p, %p\n", This, pCount);
2054 *pCount = This->ndevs;
2056 return S_OK;
2059 static HRESULT WINAPI XA20_GetDeviceDetails(IXAudio20 *iface, UINT32 index,
2060 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2062 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2063 HRESULT hr;
2064 IMMDevice *dev;
2065 IAudioClient *client;
2066 IPropertyStore *ps;
2067 WAVEFORMATEX *wfx;
2068 PROPVARIANT var;
2070 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2072 if(index >= This->ndevs)
2073 return E_INVALIDARG;
2075 hr = IMMDeviceEnumerator_GetDevice(This->devenum, This->devids[index], &dev);
2076 if(FAILED(hr)){
2077 WARN("GetDevice failed: %08x\n", hr);
2078 return hr;
2081 hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
2082 NULL, (void**)&client);
2083 if(FAILED(hr)){
2084 WARN("Activate failed: %08x\n", hr);
2085 IMMDevice_Release(dev);
2086 return hr;
2089 hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &ps);
2090 if(FAILED(hr)){
2091 WARN("OpenPropertyStore failed: %08x\n", hr);
2092 IAudioClient_Release(client);
2093 IMMDevice_Release(dev);
2094 return hr;
2097 PropVariantInit(&var);
2099 hr = IPropertyStore_GetValue(ps, (PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &var);
2100 if(FAILED(hr)){
2101 WARN("GetValue failed: %08x\n", hr);
2102 goto done;
2105 lstrcpynW(pDeviceDetails->DisplayName, var.u.pwszVal, sizeof(pDeviceDetails->DisplayName)/sizeof(WCHAR));
2107 PropVariantClear(&var);
2109 hr = IAudioClient_GetMixFormat(client, &wfx);
2110 if(FAILED(hr)){
2111 WARN("GetMixFormat failed: %08x\n", hr);
2112 goto done;
2115 lstrcpyW(pDeviceDetails->DeviceID, This->devids[index]);
2117 if(index == 0)
2118 pDeviceDetails->Role = GlobalDefaultDevice;
2119 else
2120 pDeviceDetails->Role = NotDefaultDevice;
2122 if(sizeof(WAVEFORMATEX) + wfx->cbSize > sizeof(pDeviceDetails->OutputFormat)){
2123 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2124 CoTaskMemFree(wfx);
2125 hr = E_FAIL;
2126 goto done;
2128 memcpy(&pDeviceDetails->OutputFormat, wfx, sizeof(WAVEFORMATEX) + wfx->cbSize);
2130 CoTaskMemFree(wfx);
2132 done:
2133 IPropertyStore_Release(ps);
2134 IAudioClient_Release(client);
2135 IMMDevice_Release(dev);
2137 return hr;
2140 static HRESULT WINAPI XA20_Initialize(IXAudio20 *iface, UINT32 flags,
2141 XAUDIO2_PROCESSOR processor)
2143 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2144 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2145 return xaudio2_initialize(This, flags, processor);
2148 static HRESULT WINAPI XA20_RegisterForCallbacks(IXAudio20 *iface,
2149 IXAudio2EngineCallback *pCallback)
2151 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2152 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2155 static void WINAPI XA20_UnregisterForCallbacks(IXAudio20 *iface,
2156 IXAudio2EngineCallback *pCallback)
2158 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2159 return IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2162 static HRESULT WINAPI XA20_CreateSourceVoice(IXAudio20 *iface,
2163 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2164 UINT32 flags, float maxFrequencyRatio,
2165 IXAudio2VoiceCallback *pCallback, const XAUDIO23_VOICE_SENDS *pSendList,
2166 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2168 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2169 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2170 HRESULT hr;
2172 if(pSendList){
2173 sends.SendCount = pSendList->OutputCount;
2174 sends.pSends = convert_send_descriptors23(pSendList);
2175 psends = &sends;
2178 hr = IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2179 pSourceFormat, flags, maxFrequencyRatio, pCallback, psends,
2180 pEffectChain);
2182 if(pSendList)
2183 HeapFree(GetProcessHeap(), 0, sends.pSends);
2185 return hr;
2188 static HRESULT WINAPI XA20_CreateSubmixVoice(IXAudio20 *iface,
2189 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2190 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2191 const XAUDIO23_VOICE_SENDS *pSendList,
2192 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2194 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2195 XAUDIO2_VOICE_SENDS sends, *psends;
2196 HRESULT hr;
2198 if(pSendList){
2199 sends.SendCount = pSendList->OutputCount;
2200 sends.pSends = convert_send_descriptors23(pSendList);
2201 psends = &sends;
2204 hr = IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2205 inputChannels, inputSampleRate, flags, processingStage, psends,
2206 pEffectChain);
2208 if(pSendList)
2209 HeapFree(GetProcessHeap(), 0, sends.pSends);
2211 return hr;
2214 static HRESULT WINAPI XA20_CreateMasteringVoice(IXAudio20 *iface,
2215 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2216 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2217 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2219 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2221 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2222 inputChannels, inputSampleRate, flags, deviceIndex,
2223 pEffectChain);
2225 if(deviceIndex >= This->ndevs)
2226 return E_INVALIDARG;
2228 return IXAudio2_CreateMasteringVoice(&This->IXAudio2_iface, ppMasteringVoice,
2229 inputChannels, inputSampleRate, flags, This->devids[deviceIndex],
2230 pEffectChain, AudioCategory_GameEffects);
2233 static HRESULT WINAPI XA20_StartEngine(IXAudio20 *iface)
2235 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2236 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2239 static void WINAPI XA20_StopEngine(IXAudio20 *iface)
2241 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2242 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2245 static HRESULT WINAPI XA20_CommitChanges(IXAudio20 *iface, UINT32 operationSet)
2247 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2248 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2251 static void WINAPI XA20_GetPerformanceData(IXAudio20 *iface,
2252 XAUDIO20_PERFORMANCE_DATA *pPerfData)
2254 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2255 XAUDIO2_PERFORMANCE_DATA data;
2257 IXAudio2_GetPerformanceData(&This->IXAudio2_iface, &data);
2259 pPerfData->AudioCyclesSinceLastQuery = data.AudioCyclesSinceLastQuery;
2260 pPerfData->TotalCyclesSinceLastQuery = data.TotalCyclesSinceLastQuery;
2261 pPerfData->MinimumCyclesPerQuantum = data.MinimumCyclesPerQuantum;
2262 pPerfData->MaximumCyclesPerQuantum = data.MaximumCyclesPerQuantum;
2263 pPerfData->MemoryUsageInBytes = data.MemoryUsageInBytes;
2264 pPerfData->CurrentLatencyInSamples = data.CurrentLatencyInSamples;
2265 pPerfData->GlitchesSinceLastQuery = data.GlitchesSinceEngineStarted - This->last_query_glitches;
2266 This->last_query_glitches = data.GlitchesSinceEngineStarted;
2267 pPerfData->ActiveSourceVoiceCount = data.ActiveSourceVoiceCount;
2268 pPerfData->TotalSourceVoiceCount = data.TotalSourceVoiceCount;
2270 pPerfData->ActiveSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2271 pPerfData->TotalSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2273 pPerfData->ActiveXmaSourceVoices = data.ActiveXmaSourceVoices;
2274 pPerfData->ActiveXmaStreams = data.ActiveXmaStreams;
2277 static void WINAPI XA20_SetDebugConfiguration(IXAudio20 *iface,
2278 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2279 void *pReserved)
2281 IXAudio2Impl *This = impl_from_IXAudio20(iface);
2282 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2283 pDebugConfiguration, pReserved);
2286 const IXAudio20Vtbl XAudio20_Vtbl = {
2287 XA20_QueryInterface,
2288 XA20_AddRef,
2289 XA20_Release,
2290 XA20_GetDeviceCount,
2291 XA20_GetDeviceDetails,
2292 XA20_Initialize,
2293 XA20_RegisterForCallbacks,
2294 XA20_UnregisterForCallbacks,
2295 XA20_CreateSourceVoice,
2296 XA20_CreateSubmixVoice,
2297 XA20_CreateMasteringVoice,
2298 XA20_StartEngine,
2299 XA20_StopEngine,
2300 XA20_CommitChanges,
2301 XA20_GetPerformanceData,
2302 XA20_SetDebugConfiguration
2305 #elif XAUDIO2_VER <= 2
2307 static inline IXAudio2Impl *impl_from_IXAudio22(IXAudio22 *iface)
2309 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio22_iface);
2312 static HRESULT WINAPI XA22_QueryInterface(IXAudio22 *iface, REFIID riid,
2313 void **ppvObject)
2315 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2316 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2319 static ULONG WINAPI XA22_AddRef(IXAudio22 *iface)
2321 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2322 return IXAudio2_AddRef(&This->IXAudio2_iface);
2325 static ULONG WINAPI XA22_Release(IXAudio22 *iface)
2327 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2328 return IXAudio2_Release(&This->IXAudio2_iface);
2331 static HRESULT WINAPI XA22_GetDeviceCount(IXAudio22 *iface, UINT32 *pCount)
2333 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2335 TRACE("%p, %p\n", This, pCount);
2337 *pCount = This->ndevs;
2339 return S_OK;
2342 static HRESULT WINAPI XA22_GetDeviceDetails(IXAudio22 *iface, UINT32 index,
2343 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2345 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2346 HRESULT hr;
2347 IMMDevice *dev;
2348 IAudioClient *client;
2349 IPropertyStore *ps;
2350 WAVEFORMATEX *wfx;
2351 PROPVARIANT var;
2353 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2355 if(index >= This->ndevs)
2356 return E_INVALIDARG;
2358 hr = IMMDeviceEnumerator_GetDevice(This->devenum, This->devids[index], &dev);
2359 if(FAILED(hr)){
2360 WARN("GetDevice failed: %08x\n", hr);
2361 return hr;
2364 hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
2365 NULL, (void**)&client);
2366 if(FAILED(hr)){
2367 WARN("Activate failed: %08x\n", hr);
2368 IMMDevice_Release(dev);
2369 return hr;
2372 hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &ps);
2373 if(FAILED(hr)){
2374 WARN("OpenPropertyStore failed: %08x\n", hr);
2375 IAudioClient_Release(client);
2376 IMMDevice_Release(dev);
2377 return hr;
2380 PropVariantInit(&var);
2382 hr = IPropertyStore_GetValue(ps, (PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &var);
2383 if(FAILED(hr)){
2384 WARN("GetValue failed: %08x\n", hr);
2385 goto done;
2388 lstrcpynW(pDeviceDetails->DisplayName, var.u.pwszVal, sizeof(pDeviceDetails->DisplayName)/sizeof(WCHAR));
2390 PropVariantClear(&var);
2392 hr = IAudioClient_GetMixFormat(client, &wfx);
2393 if(FAILED(hr)){
2394 WARN("GetMixFormat failed: %08x\n", hr);
2395 goto done;
2398 lstrcpyW(pDeviceDetails->DeviceID, This->devids[index]);
2400 if(index == 0)
2401 pDeviceDetails->Role = GlobalDefaultDevice;
2402 else
2403 pDeviceDetails->Role = NotDefaultDevice;
2405 if(sizeof(WAVEFORMATEX) + wfx->cbSize > sizeof(pDeviceDetails->OutputFormat)){
2406 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2407 CoTaskMemFree(wfx);
2408 hr = E_FAIL;
2409 goto done;
2411 memcpy(&pDeviceDetails->OutputFormat, wfx, sizeof(WAVEFORMATEX) + wfx->cbSize);
2413 CoTaskMemFree(wfx);
2415 done:
2416 IPropertyStore_Release(ps);
2417 IAudioClient_Release(client);
2418 IMMDevice_Release(dev);
2420 return hr;
2423 static HRESULT WINAPI XA22_Initialize(IXAudio22 *iface, UINT32 flags,
2424 XAUDIO2_PROCESSOR processor)
2426 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2427 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2428 return xaudio2_initialize(This, flags, processor);
2431 static HRESULT WINAPI XA22_RegisterForCallbacks(IXAudio22 *iface,
2432 IXAudio2EngineCallback *pCallback)
2434 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2435 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2438 static void WINAPI XA22_UnregisterForCallbacks(IXAudio22 *iface,
2439 IXAudio2EngineCallback *pCallback)
2441 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2442 IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2445 static HRESULT WINAPI XA22_CreateSourceVoice(IXAudio22 *iface,
2446 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2447 UINT32 flags, float maxFrequencyRatio,
2448 IXAudio2VoiceCallback *pCallback, const XAUDIO23_VOICE_SENDS *pSendList,
2449 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2451 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2452 XAUDIO2_VOICE_SENDS sends, *psends = NULL;
2453 HRESULT hr;
2455 if(pSendList){
2456 sends.SendCount = pSendList->OutputCount;
2457 sends.pSends = convert_send_descriptors23(pSendList);
2458 psends = &sends;
2461 hr = IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2462 pSourceFormat, flags, maxFrequencyRatio, pCallback, psends,
2463 pEffectChain);
2465 if(pSendList)
2466 HeapFree(GetProcessHeap(), 0, sends.pSends);
2468 return hr;
2471 static HRESULT WINAPI XA22_CreateSubmixVoice(IXAudio22 *iface,
2472 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2473 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2474 const XAUDIO23_VOICE_SENDS *pSendList,
2475 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2477 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2478 XAUDIO2_VOICE_SENDS sends, *psends;
2479 HRESULT hr;
2481 if(pSendList){
2482 sends.SendCount = pSendList->OutputCount;
2483 sends.pSends = convert_send_descriptors23(pSendList);
2484 psends = &sends;
2487 hr = IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2488 inputChannels, inputSampleRate, flags, processingStage, psends,
2489 pEffectChain);
2491 if(pSendList)
2492 HeapFree(GetProcessHeap(), 0, sends.pSends);
2494 return hr;
2497 static HRESULT WINAPI XA22_CreateMasteringVoice(IXAudio22 *iface,
2498 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2499 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2500 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2502 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2504 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2505 inputChannels, inputSampleRate, flags, deviceIndex,
2506 pEffectChain);
2508 if(deviceIndex >= This->ndevs)
2509 return E_INVALIDARG;
2511 return IXAudio2_CreateMasteringVoice(&This->IXAudio2_iface, ppMasteringVoice,
2512 inputChannels, inputSampleRate, flags, This->devids[deviceIndex],
2513 pEffectChain, AudioCategory_GameEffects);
2516 static HRESULT WINAPI XA22_StartEngine(IXAudio22 *iface)
2518 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2519 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2522 static void WINAPI XA22_StopEngine(IXAudio22 *iface)
2524 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2525 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2528 static HRESULT WINAPI XA22_CommitChanges(IXAudio22 *iface, UINT32 operationSet)
2530 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2531 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2534 static void WINAPI XA22_GetPerformanceData(IXAudio22 *iface,
2535 XAUDIO22_PERFORMANCE_DATA *pPerfData)
2537 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2538 XAUDIO2_PERFORMANCE_DATA data;
2540 IXAudio2_GetPerformanceData(&This->IXAudio2_iface, &data);
2542 pPerfData->AudioCyclesSinceLastQuery = data.AudioCyclesSinceLastQuery;
2543 pPerfData->TotalCyclesSinceLastQuery = data.TotalCyclesSinceLastQuery;
2544 pPerfData->MinimumCyclesPerQuantum = data.MinimumCyclesPerQuantum;
2545 pPerfData->MaximumCyclesPerQuantum = data.MaximumCyclesPerQuantum;
2546 pPerfData->MemoryUsageInBytes = data.MemoryUsageInBytes;
2547 pPerfData->CurrentLatencyInSamples = data.CurrentLatencyInSamples;
2548 pPerfData->GlitchesSinceEngineStarted = data.GlitchesSinceEngineStarted;
2549 pPerfData->ActiveSourceVoiceCount = data.ActiveSourceVoiceCount;
2550 pPerfData->TotalSourceVoiceCount = data.TotalSourceVoiceCount;
2552 pPerfData->ActiveSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2553 pPerfData->TotalSubmixVoiceCount = data.ActiveSubmixVoiceCount;
2555 pPerfData->ActiveXmaSourceVoices = data.ActiveXmaSourceVoices;
2556 pPerfData->ActiveXmaStreams = data.ActiveXmaStreams;
2559 static void WINAPI XA22_SetDebugConfiguration(IXAudio22 *iface,
2560 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2561 void *pReserved)
2563 IXAudio2Impl *This = impl_from_IXAudio22(iface);
2564 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2565 pDebugConfiguration, pReserved);
2568 const IXAudio22Vtbl XAudio22_Vtbl = {
2569 XA22_QueryInterface,
2570 XA22_AddRef,
2571 XA22_Release,
2572 XA22_GetDeviceCount,
2573 XA22_GetDeviceDetails,
2574 XA22_Initialize,
2575 XA22_RegisterForCallbacks,
2576 XA22_UnregisterForCallbacks,
2577 XA22_CreateSourceVoice,
2578 XA22_CreateSubmixVoice,
2579 XA22_CreateMasteringVoice,
2580 XA22_StartEngine,
2581 XA22_StopEngine,
2582 XA22_CommitChanges,
2583 XA22_GetPerformanceData,
2584 XA22_SetDebugConfiguration
2587 #elif XAUDIO2_VER <= 7
2589 static inline IXAudio2Impl *impl_from_IXAudio27(IXAudio27 *iface)
2591 return CONTAINING_RECORD(iface, IXAudio2Impl, IXAudio27_iface);
2594 static HRESULT WINAPI XA27_QueryInterface(IXAudio27 *iface, REFIID riid,
2595 void **ppvObject)
2597 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2598 return IXAudio2_QueryInterface(&This->IXAudio2_iface, riid, ppvObject);
2601 static ULONG WINAPI XA27_AddRef(IXAudio27 *iface)
2603 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2604 return IXAudio2_AddRef(&This->IXAudio2_iface);
2607 static ULONG WINAPI XA27_Release(IXAudio27 *iface)
2609 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2610 return IXAudio2_Release(&This->IXAudio2_iface);
2613 static HRESULT WINAPI XA27_GetDeviceCount(IXAudio27 *iface, UINT32 *pCount)
2615 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2617 TRACE("%p, %p\n", This, pCount);
2619 *pCount = This->ndevs;
2621 return S_OK;
2624 static HRESULT WINAPI XA27_GetDeviceDetails(IXAudio27 *iface, UINT32 index,
2625 XAUDIO2_DEVICE_DETAILS *pDeviceDetails)
2627 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2628 HRESULT hr;
2629 IMMDevice *dev;
2630 IAudioClient *client;
2631 IPropertyStore *ps;
2632 WAVEFORMATEX *wfx;
2633 PROPVARIANT var;
2635 TRACE("%p, %u, %p\n", This, index, pDeviceDetails);
2637 if(index >= This->ndevs)
2638 return E_INVALIDARG;
2640 hr = IMMDeviceEnumerator_GetDevice(This->devenum, This->devids[index], &dev);
2641 if(FAILED(hr)){
2642 WARN("GetDevice failed: %08x\n", hr);
2643 return hr;
2646 hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
2647 NULL, (void**)&client);
2648 if(FAILED(hr)){
2649 WARN("Activate failed: %08x\n", hr);
2650 IMMDevice_Release(dev);
2651 return hr;
2654 hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &ps);
2655 if(FAILED(hr)){
2656 WARN("OpenPropertyStore failed: %08x\n", hr);
2657 IAudioClient_Release(client);
2658 IMMDevice_Release(dev);
2659 return hr;
2662 PropVariantInit(&var);
2664 hr = IPropertyStore_GetValue(ps, (PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &var);
2665 if(FAILED(hr)){
2666 WARN("GetValue failed: %08x\n", hr);
2667 goto done;
2670 lstrcpynW(pDeviceDetails->DisplayName, var.u.pwszVal, sizeof(pDeviceDetails->DisplayName)/sizeof(WCHAR));
2672 PropVariantClear(&var);
2674 hr = IAudioClient_GetMixFormat(client, &wfx);
2675 if(FAILED(hr)){
2676 WARN("GetMixFormat failed: %08x\n", hr);
2677 goto done;
2680 lstrcpyW(pDeviceDetails->DeviceID, This->devids[index]);
2682 if(index == 0)
2683 pDeviceDetails->Role = GlobalDefaultDevice;
2684 else
2685 pDeviceDetails->Role = NotDefaultDevice;
2687 if(sizeof(WAVEFORMATEX) + wfx->cbSize > sizeof(pDeviceDetails->OutputFormat)){
2688 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2689 CoTaskMemFree(wfx);
2690 hr = E_FAIL;
2691 goto done;
2693 memcpy(&pDeviceDetails->OutputFormat, wfx, sizeof(WAVEFORMATEX) + wfx->cbSize);
2695 CoTaskMemFree(wfx);
2697 done:
2698 IPropertyStore_Release(ps);
2699 IAudioClient_Release(client);
2700 IMMDevice_Release(dev);
2702 return hr;
2705 static HRESULT WINAPI XA27_Initialize(IXAudio27 *iface, UINT32 flags,
2706 XAUDIO2_PROCESSOR processor)
2708 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2709 TRACE("(%p)->(0x%x, 0x%x)\n", This, flags, processor);
2710 return xaudio2_initialize(This, flags, processor);
2713 static HRESULT WINAPI XA27_RegisterForCallbacks(IXAudio27 *iface,
2714 IXAudio2EngineCallback *pCallback)
2716 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2717 return IXAudio2_RegisterForCallbacks(&This->IXAudio2_iface, pCallback);
2720 static void WINAPI XA27_UnregisterForCallbacks(IXAudio27 *iface,
2721 IXAudio2EngineCallback *pCallback)
2723 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2724 IXAudio2_UnregisterForCallbacks(&This->IXAudio2_iface, pCallback);
2727 static HRESULT WINAPI XA27_CreateSourceVoice(IXAudio27 *iface,
2728 IXAudio2SourceVoice **ppSourceVoice, const WAVEFORMATEX *pSourceFormat,
2729 UINT32 flags, float maxFrequencyRatio,
2730 IXAudio2VoiceCallback *pCallback, const XAUDIO2_VOICE_SENDS *pSendList,
2731 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2733 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2734 return IXAudio2_CreateSourceVoice(&This->IXAudio2_iface, ppSourceVoice,
2735 pSourceFormat, flags, maxFrequencyRatio, pCallback, pSendList,
2736 pEffectChain);
2739 static HRESULT WINAPI XA27_CreateSubmixVoice(IXAudio27 *iface,
2740 IXAudio2SubmixVoice **ppSubmixVoice, UINT32 inputChannels,
2741 UINT32 inputSampleRate, UINT32 flags, UINT32 processingStage,
2742 const XAUDIO2_VOICE_SENDS *pSendList,
2743 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2745 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2746 return IXAudio2_CreateSubmixVoice(&This->IXAudio2_iface, ppSubmixVoice,
2747 inputChannels, inputSampleRate, flags, processingStage, pSendList,
2748 pEffectChain);
2751 static HRESULT WINAPI XA27_CreateMasteringVoice(IXAudio27 *iface,
2752 IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
2753 UINT32 inputSampleRate, UINT32 flags, UINT32 deviceIndex,
2754 const XAUDIO2_EFFECT_CHAIN *pEffectChain)
2756 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2758 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This, ppMasteringVoice,
2759 inputChannels, inputSampleRate, flags, deviceIndex,
2760 pEffectChain);
2762 if(deviceIndex >= This->ndevs)
2763 return E_INVALIDARG;
2765 return IXAudio2_CreateMasteringVoice(&This->IXAudio2_iface, ppMasteringVoice,
2766 inputChannels, inputSampleRate, flags, This->devids[deviceIndex],
2767 pEffectChain, AudioCategory_GameEffects);
2770 static HRESULT WINAPI XA27_StartEngine(IXAudio27 *iface)
2772 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2773 return IXAudio2_StartEngine(&This->IXAudio2_iface);
2776 static void WINAPI XA27_StopEngine(IXAudio27 *iface)
2778 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2779 return IXAudio2_StopEngine(&This->IXAudio2_iface);
2782 static HRESULT WINAPI XA27_CommitChanges(IXAudio27 *iface, UINT32 operationSet)
2784 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2785 return IXAudio2_CommitChanges(&This->IXAudio2_iface, operationSet);
2788 static void WINAPI XA27_GetPerformanceData(IXAudio27 *iface,
2789 XAUDIO2_PERFORMANCE_DATA *pPerfData)
2791 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2792 return IXAudio2_GetPerformanceData(&This->IXAudio2_iface, pPerfData);
2795 static void WINAPI XA27_SetDebugConfiguration(IXAudio27 *iface,
2796 const XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
2797 void *pReserved)
2799 IXAudio2Impl *This = impl_from_IXAudio27(iface);
2800 return IXAudio2_SetDebugConfiguration(&This->IXAudio2_iface,
2801 pDebugConfiguration, pReserved);
2804 const IXAudio27Vtbl XAudio27_Vtbl = {
2805 XA27_QueryInterface,
2806 XA27_AddRef,
2807 XA27_Release,
2808 XA27_GetDeviceCount,
2809 XA27_GetDeviceDetails,
2810 XA27_Initialize,
2811 XA27_RegisterForCallbacks,
2812 XA27_UnregisterForCallbacks,
2813 XA27_CreateSourceVoice,
2814 XA27_CreateSubmixVoice,
2815 XA27_CreateMasteringVoice,
2816 XA27_StartEngine,
2817 XA27_StopEngine,
2818 XA27_CommitChanges,
2819 XA27_GetPerformanceData,
2820 XA27_SetDebugConfiguration
2822 #endif
2823 /* END IXAudio2 */