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
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.
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.
42 * Change CLSID_XAudio2
46 * Change CLSID_XAudio2
48 * Change struct XAUDIO2_PERFORMANCE_DATA
51 * Change CLSID_XAudio2
53 * Add IXAudio2Voice::SetOutputFilterParameters
54 * Add IXAudio2Voice::GetOutputFilterParameters
55 * Add IXAudio2SourceVoice::SetSourceSampleRate
56 * Change struct XAUDIO2_VOICE_SENDS
59 * Change CLSID_XAudio2
63 * Change CLSID_XAudio2
67 * Change CLSID_XAudio2
71 * Remove CLSID_XAudio2
73 * Add xaudio2_8.XAudio2Create
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
86 * New flags: XAUDIO2_STOP_ENGINE_WHEN_IDLE, XAUDIO2_1024_QUANTUM,
87 * XAUDIO2_NO_VIRTUAL_AUDIO_CLIENT
89 * Add SideDelay member to XAUDIO2FX_REVERB_PARAMETERS
94 #define NONAMELESSUNION
95 #define NONAMELESSSTRUCT
100 #include "xaudio_private.h"
102 #include "wine/debug.h"
105 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
108 /* BEGIN IXAudio2SourceVoice */
110 static XA2SourceImpl
*impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice
*iface
)
112 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio20SourceVoice_iface
);
115 static void WINAPI
XA20SRC_GetVoiceDetails(IXAudio20SourceVoice
*iface
,
116 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
118 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
119 XAUDIO2_VOICE_DETAILS details
;
121 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
123 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
124 pVoiceDetails
->InputChannels
= details
.InputChannels
;
125 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
128 static HRESULT WINAPI
XA20SRC_SetOutputVoices(IXAudio20SourceVoice
*iface
,
129 const XAUDIO23_VOICE_SENDS
*pSendList
)
131 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
132 XAUDIO2_VOICE_SENDS sends
;
136 TRACE("%p, %p\n", This
, pSendList
);
138 sends
.SendCount
= pSendList
->OutputCount
;
139 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
140 for(i
= 0; i
< sends
.SendCount
; ++i
){
141 sends
.pSends
[i
].Flags
= 0;
142 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
145 hr
= IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, &sends
);
147 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
152 static HRESULT WINAPI
XA20SRC_SetEffectChain(IXAudio20SourceVoice
*iface
,
153 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
155 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
156 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
159 static HRESULT WINAPI
XA20SRC_EnableEffect(IXAudio20SourceVoice
*iface
,
160 UINT32 EffectIndex
, UINT32 OperationSet
)
162 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
163 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
,
164 EffectIndex
, OperationSet
);
167 static HRESULT WINAPI
XA20SRC_DisableEffect(IXAudio20SourceVoice
*iface
,
168 UINT32 EffectIndex
, UINT32 OperationSet
)
170 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
171 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
,
172 EffectIndex
, OperationSet
);
175 static void WINAPI
XA20SRC_GetEffectState(IXAudio20SourceVoice
*iface
,
176 UINT32 EffectIndex
, BOOL
*pEnabled
)
178 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
179 return IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
,
180 EffectIndex
, pEnabled
);
183 static HRESULT WINAPI
XA20SRC_SetEffectParameters(IXAudio20SourceVoice
*iface
,
184 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
187 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
188 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
189 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
192 static HRESULT WINAPI
XA20SRC_GetEffectParameters(IXAudio20SourceVoice
*iface
,
193 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
195 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
196 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
197 EffectIndex
, pParameters
, ParametersByteSize
);
200 static HRESULT WINAPI
XA20SRC_SetFilterParameters(IXAudio20SourceVoice
*iface
,
201 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
203 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
204 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
205 pParameters
, OperationSet
);
208 static void WINAPI
XA20SRC_GetFilterParameters(IXAudio20SourceVoice
*iface
,
209 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
211 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
212 return IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
215 static HRESULT WINAPI
XA20SRC_SetVolume(IXAudio20SourceVoice
*iface
,
216 float Volume
, UINT32 OperationSet
)
218 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
219 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
,
220 Volume
, OperationSet
);
223 static void WINAPI
XA20SRC_GetVolume(IXAudio20SourceVoice
*iface
,
226 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
227 return IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
230 static HRESULT WINAPI
XA20SRC_SetChannelVolumes(IXAudio20SourceVoice
*iface
,
231 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
233 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
234 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
235 Channels
, pVolumes
, OperationSet
);
238 static void WINAPI
XA20SRC_GetChannelVolumes(IXAudio20SourceVoice
*iface
,
239 UINT32 Channels
, float *pVolumes
)
241 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
242 return IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
246 static HRESULT WINAPI
XA20SRC_SetOutputMatrix(IXAudio20SourceVoice
*iface
,
247 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
248 UINT32 DestinationChannels
, const float *pLevelMatrix
,
251 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
252 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
253 pDestinationVoice
, SourceChannels
, DestinationChannels
,
254 pLevelMatrix
, OperationSet
);
257 static HRESULT WINAPI
XA20SRC_GetOutputMatrix(IXAudio20SourceVoice
*iface
,
258 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
259 UINT32 DestinationChannels
, float *pLevelMatrix
)
261 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
262 IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
263 pDestinationVoice
, SourceChannels
, DestinationChannels
,
268 static void WINAPI
XA20SRC_DestroyVoice(IXAudio20SourceVoice
*iface
)
270 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
271 return IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
274 static HRESULT WINAPI
XA20SRC_Start(IXAudio20SourceVoice
*iface
, UINT32 Flags
,
277 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
278 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
281 static HRESULT WINAPI
XA20SRC_Stop(IXAudio20SourceVoice
*iface
, UINT32 Flags
,
284 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
285 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
288 static HRESULT WINAPI
XA20SRC_SubmitSourceBuffer(IXAudio20SourceVoice
*iface
,
289 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
291 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
292 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
,
293 pBuffer
, pBufferWMA
);
296 static HRESULT WINAPI
XA20SRC_FlushSourceBuffers(IXAudio20SourceVoice
*iface
)
298 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
299 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
302 static HRESULT WINAPI
XA20SRC_Discontinuity(IXAudio20SourceVoice
*iface
)
304 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
305 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
308 static HRESULT WINAPI
XA20SRC_ExitLoop(IXAudio20SourceVoice
*iface
,
311 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
312 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
315 static void WINAPI
XA20SRC_GetState(IXAudio20SourceVoice
*iface
,
316 XAUDIO2_VOICE_STATE
*pVoiceState
)
318 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
319 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
322 static HRESULT WINAPI
XA20SRC_SetFrequencyRatio(IXAudio20SourceVoice
*iface
,
323 float Ratio
, UINT32 OperationSet
)
325 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
326 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
,
327 Ratio
, OperationSet
);
330 static void WINAPI
XA20SRC_GetFrequencyRatio(IXAudio20SourceVoice
*iface
,
333 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
334 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
337 const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl
= {
338 XA20SRC_GetVoiceDetails
,
339 XA20SRC_SetOutputVoices
,
340 XA20SRC_SetEffectChain
,
341 XA20SRC_EnableEffect
,
342 XA20SRC_DisableEffect
,
343 XA20SRC_GetEffectState
,
344 XA20SRC_SetEffectParameters
,
345 XA20SRC_GetEffectParameters
,
346 XA20SRC_SetFilterParameters
,
347 XA20SRC_GetFilterParameters
,
350 XA20SRC_SetChannelVolumes
,
351 XA20SRC_GetChannelVolumes
,
352 XA20SRC_SetOutputMatrix
,
353 XA20SRC_GetOutputMatrix
,
354 XA20SRC_DestroyVoice
,
357 XA20SRC_SubmitSourceBuffer
,
358 XA20SRC_FlushSourceBuffers
,
359 XA20SRC_Discontinuity
,
362 XA20SRC_SetFrequencyRatio
,
363 XA20SRC_GetFrequencyRatio
,
366 #elif XAUDIO2_VER <= 3
368 static XA2SourceImpl
*impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice
*iface
)
370 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio23SourceVoice_iface
);
373 static void WINAPI
XA23SRC_GetVoiceDetails(IXAudio23SourceVoice
*iface
,
374 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
376 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
377 XAUDIO2_VOICE_DETAILS details
;
379 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
381 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
382 pVoiceDetails
->InputChannels
= details
.InputChannels
;
383 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
386 static HRESULT WINAPI
XA23SRC_SetOutputVoices(IXAudio23SourceVoice
*iface
,
387 const XAUDIO23_VOICE_SENDS
*pSendList
)
389 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
390 XAUDIO2_VOICE_SENDS sends
;
394 TRACE("%p, %p\n", This
, pSendList
);
396 sends
.SendCount
= pSendList
->OutputCount
;
397 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
398 for(i
= 0; i
< sends
.SendCount
; ++i
){
399 sends
.pSends
[i
].Flags
= 0;
400 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
403 hr
= IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, &sends
);
405 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
410 static HRESULT WINAPI
XA23SRC_SetEffectChain(IXAudio23SourceVoice
*iface
,
411 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
413 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
414 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
417 static HRESULT WINAPI
XA23SRC_EnableEffect(IXAudio23SourceVoice
*iface
,
418 UINT32 EffectIndex
, UINT32 OperationSet
)
420 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
421 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
,
422 EffectIndex
, OperationSet
);
425 static HRESULT WINAPI
XA23SRC_DisableEffect(IXAudio23SourceVoice
*iface
,
426 UINT32 EffectIndex
, UINT32 OperationSet
)
428 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
429 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
,
430 EffectIndex
, OperationSet
);
433 static void WINAPI
XA23SRC_GetEffectState(IXAudio23SourceVoice
*iface
,
434 UINT32 EffectIndex
, BOOL
*pEnabled
)
436 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
437 return IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
,
438 EffectIndex
, pEnabled
);
441 static HRESULT WINAPI
XA23SRC_SetEffectParameters(IXAudio23SourceVoice
*iface
,
442 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
445 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
446 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
447 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
450 static HRESULT WINAPI
XA23SRC_GetEffectParameters(IXAudio23SourceVoice
*iface
,
451 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
453 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
454 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
455 EffectIndex
, pParameters
, ParametersByteSize
);
458 static HRESULT WINAPI
XA23SRC_SetFilterParameters(IXAudio23SourceVoice
*iface
,
459 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
461 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
462 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
463 pParameters
, OperationSet
);
466 static void WINAPI
XA23SRC_GetFilterParameters(IXAudio23SourceVoice
*iface
,
467 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
469 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
470 return IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
473 static HRESULT WINAPI
XA23SRC_SetVolume(IXAudio23SourceVoice
*iface
,
474 float Volume
, UINT32 OperationSet
)
476 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
477 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
,
478 Volume
, OperationSet
);
481 static void WINAPI
XA23SRC_GetVolume(IXAudio23SourceVoice
*iface
,
484 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
485 return IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
488 static HRESULT WINAPI
XA23SRC_SetChannelVolumes(IXAudio23SourceVoice
*iface
,
489 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
491 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
492 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
493 Channels
, pVolumes
, OperationSet
);
496 static void WINAPI
XA23SRC_GetChannelVolumes(IXAudio23SourceVoice
*iface
,
497 UINT32 Channels
, float *pVolumes
)
499 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
500 return IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
504 static HRESULT WINAPI
XA23SRC_SetOutputMatrix(IXAudio23SourceVoice
*iface
,
505 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
506 UINT32 DestinationChannels
, const float *pLevelMatrix
,
509 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
510 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
511 pDestinationVoice
, SourceChannels
, DestinationChannels
,
512 pLevelMatrix
, OperationSet
);
515 static void WINAPI
XA23SRC_GetOutputMatrix(IXAudio23SourceVoice
*iface
,
516 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
517 UINT32 DestinationChannels
, float *pLevelMatrix
)
519 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
520 return IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
521 pDestinationVoice
, SourceChannels
, DestinationChannels
,
525 static void WINAPI
XA23SRC_DestroyVoice(IXAudio23SourceVoice
*iface
)
527 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
528 return IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
531 static HRESULT WINAPI
XA23SRC_Start(IXAudio23SourceVoice
*iface
, UINT32 Flags
,
534 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
535 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
538 static HRESULT WINAPI
XA23SRC_Stop(IXAudio23SourceVoice
*iface
, UINT32 Flags
,
541 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
542 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
545 static HRESULT WINAPI
XA23SRC_SubmitSourceBuffer(IXAudio23SourceVoice
*iface
,
546 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
548 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
549 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
,
550 pBuffer
, pBufferWMA
);
553 static HRESULT WINAPI
XA23SRC_FlushSourceBuffers(IXAudio23SourceVoice
*iface
)
555 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
556 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
559 static HRESULT WINAPI
XA23SRC_Discontinuity(IXAudio23SourceVoice
*iface
)
561 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
562 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
565 static HRESULT WINAPI
XA23SRC_ExitLoop(IXAudio23SourceVoice
*iface
,
568 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
569 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
572 static void WINAPI
XA23SRC_GetState(IXAudio23SourceVoice
*iface
,
573 XAUDIO2_VOICE_STATE
*pVoiceState
)
575 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
576 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
579 static HRESULT WINAPI
XA23SRC_SetFrequencyRatio(IXAudio23SourceVoice
*iface
,
580 float Ratio
, UINT32 OperationSet
)
582 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
583 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
,
584 Ratio
, OperationSet
);
587 static void WINAPI
XA23SRC_GetFrequencyRatio(IXAudio23SourceVoice
*iface
,
590 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
591 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
594 const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl
= {
595 XA23SRC_GetVoiceDetails
,
596 XA23SRC_SetOutputVoices
,
597 XA23SRC_SetEffectChain
,
598 XA23SRC_EnableEffect
,
599 XA23SRC_DisableEffect
,
600 XA23SRC_GetEffectState
,
601 XA23SRC_SetEffectParameters
,
602 XA23SRC_GetEffectParameters
,
603 XA23SRC_SetFilterParameters
,
604 XA23SRC_GetFilterParameters
,
607 XA23SRC_SetChannelVolumes
,
608 XA23SRC_GetChannelVolumes
,
609 XA23SRC_SetOutputMatrix
,
610 XA23SRC_GetOutputMatrix
,
611 XA23SRC_DestroyVoice
,
614 XA23SRC_SubmitSourceBuffer
,
615 XA23SRC_FlushSourceBuffers
,
616 XA23SRC_Discontinuity
,
619 XA23SRC_SetFrequencyRatio
,
620 XA23SRC_GetFrequencyRatio
,
623 #elif XAUDIO2_VER <= 7
625 static XA2SourceImpl
*impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice
*iface
)
627 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio27SourceVoice_iface
);
630 static void WINAPI
XA27SRC_GetVoiceDetails(IXAudio27SourceVoice
*iface
,
631 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
633 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
634 XAUDIO2_VOICE_DETAILS details
;
636 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
638 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
639 pVoiceDetails
->InputChannels
= details
.InputChannels
;
640 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
643 static HRESULT WINAPI
XA27SRC_SetOutputVoices(IXAudio27SourceVoice
*iface
,
644 const XAUDIO2_VOICE_SENDS
*pSendList
)
646 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
647 return IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, pSendList
);
650 static HRESULT WINAPI
XA27SRC_SetEffectChain(IXAudio27SourceVoice
*iface
,
651 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
653 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
654 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
657 static HRESULT WINAPI
XA27SRC_EnableEffect(IXAudio27SourceVoice
*iface
,
658 UINT32 EffectIndex
, UINT32 OperationSet
)
660 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
661 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, OperationSet
);
664 static HRESULT WINAPI
XA27SRC_DisableEffect(IXAudio27SourceVoice
*iface
,
665 UINT32 EffectIndex
, UINT32 OperationSet
)
667 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
668 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, OperationSet
);
671 static void WINAPI
XA27SRC_GetEffectState(IXAudio27SourceVoice
*iface
,
672 UINT32 EffectIndex
, BOOL
*pEnabled
)
674 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
675 IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, pEnabled
);
678 static HRESULT WINAPI
XA27SRC_SetEffectParameters(IXAudio27SourceVoice
*iface
,
679 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
682 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
683 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
684 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
687 static HRESULT WINAPI
XA27SRC_GetEffectParameters(IXAudio27SourceVoice
*iface
,
688 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
690 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
691 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
692 EffectIndex
, pParameters
, ParametersByteSize
);
695 static HRESULT WINAPI
XA27SRC_SetFilterParameters(IXAudio27SourceVoice
*iface
,
696 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
698 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
699 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
700 pParameters
, OperationSet
);
703 static void WINAPI
XA27SRC_GetFilterParameters(IXAudio27SourceVoice
*iface
,
704 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
706 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
707 IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
710 static HRESULT WINAPI
XA27SRC_SetOutputFilterParameters(IXAudio27SourceVoice
*iface
,
711 IXAudio2Voice
*pDestinationVoice
,
712 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
714 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
715 return IXAudio2SourceVoice_SetOutputFilterParameters(&This
->IXAudio2SourceVoice_iface
,
716 pDestinationVoice
, pParameters
, OperationSet
);
719 static void WINAPI
XA27SRC_GetOutputFilterParameters(IXAudio27SourceVoice
*iface
,
720 IXAudio2Voice
*pDestinationVoice
,
721 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
723 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
724 IXAudio2SourceVoice_GetOutputFilterParameters(&This
->IXAudio2SourceVoice_iface
,
725 pDestinationVoice
, pParameters
);
728 static HRESULT WINAPI
XA27SRC_SetVolume(IXAudio27SourceVoice
*iface
, float Volume
,
731 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
732 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
, Volume
,
736 static void WINAPI
XA27SRC_GetVolume(IXAudio27SourceVoice
*iface
, float *pVolume
)
738 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
739 IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
742 static HRESULT WINAPI
XA27SRC_SetChannelVolumes(IXAudio27SourceVoice
*iface
,
743 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
745 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
746 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
, Channels
,
747 pVolumes
, OperationSet
);
750 static void WINAPI
XA27SRC_GetChannelVolumes(IXAudio27SourceVoice
*iface
,
751 UINT32 Channels
, float *pVolumes
)
753 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
754 IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
, Channels
,
758 static HRESULT WINAPI
XA27SRC_SetOutputMatrix(IXAudio27SourceVoice
*iface
,
759 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
760 UINT32 DestinationChannels
, const float *pLevelMatrix
,
763 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
764 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
765 pDestinationVoice
, SourceChannels
, DestinationChannels
,
766 pLevelMatrix
, OperationSet
);
769 static void WINAPI
XA27SRC_GetOutputMatrix(IXAudio27SourceVoice
*iface
,
770 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
771 UINT32 DestinationChannels
, float *pLevelMatrix
)
773 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
774 IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
, pDestinationVoice
,
775 SourceChannels
, DestinationChannels
, pLevelMatrix
);
778 static void WINAPI
XA27SRC_DestroyVoice(IXAudio27SourceVoice
*iface
)
780 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
781 IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
784 static HRESULT WINAPI
XA27SRC_Start(IXAudio27SourceVoice
*iface
, UINT32 Flags
,
787 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
788 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
791 static HRESULT WINAPI
XA27SRC_Stop(IXAudio27SourceVoice
*iface
, UINT32 Flags
,
794 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
795 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
798 static HRESULT WINAPI
XA27SRC_SubmitSourceBuffer(IXAudio27SourceVoice
*iface
,
799 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
801 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
802 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
, pBuffer
,
806 static HRESULT WINAPI
XA27SRC_FlushSourceBuffers(IXAudio27SourceVoice
*iface
)
808 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
809 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
812 static HRESULT WINAPI
XA27SRC_Discontinuity(IXAudio27SourceVoice
*iface
)
814 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
815 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
818 static HRESULT WINAPI
XA27SRC_ExitLoop(IXAudio27SourceVoice
*iface
, UINT32 OperationSet
)
820 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
821 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
824 static void WINAPI
XA27SRC_GetState(IXAudio27SourceVoice
*iface
,
825 XAUDIO2_VOICE_STATE
*pVoiceState
)
827 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
828 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
831 static HRESULT WINAPI
XA27SRC_SetFrequencyRatio(IXAudio27SourceVoice
*iface
,
832 float Ratio
, UINT32 OperationSet
)
834 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
835 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, Ratio
, OperationSet
);
838 static void WINAPI
XA27SRC_GetFrequencyRatio(IXAudio27SourceVoice
*iface
, float *pRatio
)
840 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
841 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
844 static HRESULT WINAPI
XA27SRC_SetSourceSampleRate(
845 IXAudio27SourceVoice
*iface
,
846 UINT32 NewSourceSampleRate
)
848 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
849 return IXAudio2SourceVoice_SetSourceSampleRate(&This
->IXAudio2SourceVoice_iface
, NewSourceSampleRate
);
852 const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl
= {
853 XA27SRC_GetVoiceDetails
,
854 XA27SRC_SetOutputVoices
,
855 XA27SRC_SetEffectChain
,
856 XA27SRC_EnableEffect
,
857 XA27SRC_DisableEffect
,
858 XA27SRC_GetEffectState
,
859 XA27SRC_SetEffectParameters
,
860 XA27SRC_GetEffectParameters
,
861 XA27SRC_SetFilterParameters
,
862 XA27SRC_GetFilterParameters
,
863 XA27SRC_SetOutputFilterParameters
,
864 XA27SRC_GetOutputFilterParameters
,
867 XA27SRC_SetChannelVolumes
,
868 XA27SRC_GetChannelVolumes
,
869 XA27SRC_SetOutputMatrix
,
870 XA27SRC_GetOutputMatrix
,
871 XA27SRC_DestroyVoice
,
874 XA27SRC_SubmitSourceBuffer
,
875 XA27SRC_FlushSourceBuffers
,
876 XA27SRC_Discontinuity
,
879 XA27SRC_SetFrequencyRatio
,
880 XA27SRC_GetFrequencyRatio
,
881 XA27SRC_SetSourceSampleRate
884 /* END IXAudio2SourceVoice */
887 /* BEGIN IXAudio2SubmixVoice */
889 static XA2SubmixImpl
*impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice
*iface
)
891 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio20SubmixVoice_iface
);
894 static void WINAPI
XA20SUB_GetVoiceDetails(IXAudio20SubmixVoice
*iface
,
895 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
897 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
898 XAUDIO2_VOICE_DETAILS details
;
900 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
902 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
903 pVoiceDetails
->InputChannels
= details
.InputChannels
;
904 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
907 static HRESULT WINAPI
XA20SUB_SetOutputVoices(IXAudio20SubmixVoice
*iface
,
908 const XAUDIO23_VOICE_SENDS
*pSendList
)
910 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
911 XAUDIO2_VOICE_SENDS sends
;
915 TRACE("%p, %p\n", This
, pSendList
);
917 sends
.SendCount
= pSendList
->OutputCount
;
918 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
919 for(i
= 0; i
< sends
.SendCount
; ++i
){
920 sends
.pSends
[i
].Flags
= 0;
921 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
924 hr
= IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, &sends
);
926 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
931 static HRESULT WINAPI
XA20SUB_SetEffectChain(IXAudio20SubmixVoice
*iface
,
932 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
934 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
935 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
938 static HRESULT WINAPI
XA20SUB_EnableEffect(IXAudio20SubmixVoice
*iface
,
939 UINT32 EffectIndex
, UINT32 OperationSet
)
941 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
942 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
943 EffectIndex
, OperationSet
);
946 static HRESULT WINAPI
XA20SUB_DisableEffect(IXAudio20SubmixVoice
*iface
,
947 UINT32 EffectIndex
, UINT32 OperationSet
)
949 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
950 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
951 EffectIndex
, OperationSet
);
954 static void WINAPI
XA20SUB_GetEffectState(IXAudio20SubmixVoice
*iface
,
955 UINT32 EffectIndex
, BOOL
*pEnabled
)
957 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
958 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
959 EffectIndex
, pEnabled
);
962 static HRESULT WINAPI
XA20SUB_SetEffectParameters(IXAudio20SubmixVoice
*iface
,
963 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
966 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
967 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
968 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
971 static HRESULT WINAPI
XA20SUB_GetEffectParameters(IXAudio20SubmixVoice
*iface
,
972 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
974 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
975 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
976 EffectIndex
, pParameters
, ParametersByteSize
);
979 static HRESULT WINAPI
XA20SUB_SetFilterParameters(IXAudio20SubmixVoice
*iface
,
980 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
982 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
983 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
984 pParameters
, OperationSet
);
987 static void WINAPI
XA20SUB_GetFilterParameters(IXAudio20SubmixVoice
*iface
,
988 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
990 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
991 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
994 static HRESULT WINAPI
XA20SUB_SetVolume(IXAudio20SubmixVoice
*iface
,
995 float Volume
, UINT32 OperationSet
)
997 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
998 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
999 Volume
, OperationSet
);
1002 static void WINAPI
XA20SUB_GetVolume(IXAudio20SubmixVoice
*iface
,
1005 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1006 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1009 static HRESULT WINAPI
XA20SUB_SetChannelVolumes(IXAudio20SubmixVoice
*iface
,
1010 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1012 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1013 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1014 Channels
, pVolumes
, OperationSet
);
1017 static void WINAPI
XA20SUB_GetChannelVolumes(IXAudio20SubmixVoice
*iface
,
1018 UINT32 Channels
, float *pVolumes
)
1020 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1021 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1022 Channels
, pVolumes
);
1025 static HRESULT WINAPI
XA20SUB_SetOutputMatrix(IXAudio20SubmixVoice
*iface
,
1026 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1027 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1028 UINT32 OperationSet
)
1030 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1031 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1032 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1033 pLevelMatrix
, OperationSet
);
1036 static HRESULT WINAPI
XA20SUB_GetOutputMatrix(IXAudio20SubmixVoice
*iface
,
1037 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1038 UINT32 DestinationChannels
, float *pLevelMatrix
)
1040 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1041 IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1042 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1047 static void WINAPI
XA20SUB_DestroyVoice(IXAudio20SubmixVoice
*iface
)
1049 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1050 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1053 const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl
= {
1054 XA20SUB_GetVoiceDetails
,
1055 XA20SUB_SetOutputVoices
,
1056 XA20SUB_SetEffectChain
,
1057 XA20SUB_EnableEffect
,
1058 XA20SUB_DisableEffect
,
1059 XA20SUB_GetEffectState
,
1060 XA20SUB_SetEffectParameters
,
1061 XA20SUB_GetEffectParameters
,
1062 XA20SUB_SetFilterParameters
,
1063 XA20SUB_GetFilterParameters
,
1066 XA20SUB_SetChannelVolumes
,
1067 XA20SUB_GetChannelVolumes
,
1068 XA20SUB_SetOutputMatrix
,
1069 XA20SUB_GetOutputMatrix
,
1070 XA20SUB_DestroyVoice
1073 #elif XAUDIO2_VER <= 3
1075 static XA2SubmixImpl
*impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice
*iface
)
1077 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio23SubmixVoice_iface
);
1080 static void WINAPI
XA23SUB_GetVoiceDetails(IXAudio23SubmixVoice
*iface
,
1081 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1083 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1084 XAUDIO2_VOICE_DETAILS details
;
1086 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
1088 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1089 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1090 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1093 static HRESULT WINAPI
XA23SUB_SetOutputVoices(IXAudio23SubmixVoice
*iface
,
1094 const XAUDIO23_VOICE_SENDS
*pSendList
)
1096 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1097 XAUDIO2_VOICE_SENDS sends
;
1101 TRACE("%p, %p\n", This
, pSendList
);
1103 sends
.SendCount
= pSendList
->OutputCount
;
1104 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1105 for(i
= 0; i
< sends
.SendCount
; ++i
){
1106 sends
.pSends
[i
].Flags
= 0;
1107 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1110 hr
= IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, &sends
);
1112 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1117 static HRESULT WINAPI
XA23SUB_SetEffectChain(IXAudio23SubmixVoice
*iface
,
1118 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1120 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1121 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
1124 static HRESULT WINAPI
XA23SUB_EnableEffect(IXAudio23SubmixVoice
*iface
,
1125 UINT32 EffectIndex
, UINT32 OperationSet
)
1127 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1128 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
1129 EffectIndex
, OperationSet
);
1132 static HRESULT WINAPI
XA23SUB_DisableEffect(IXAudio23SubmixVoice
*iface
,
1133 UINT32 EffectIndex
, UINT32 OperationSet
)
1135 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1136 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
1137 EffectIndex
, OperationSet
);
1140 static void WINAPI
XA23SUB_GetEffectState(IXAudio23SubmixVoice
*iface
,
1141 UINT32 EffectIndex
, BOOL
*pEnabled
)
1143 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1144 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
1145 EffectIndex
, pEnabled
);
1148 static HRESULT WINAPI
XA23SUB_SetEffectParameters(IXAudio23SubmixVoice
*iface
,
1149 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1150 UINT32 OperationSet
)
1152 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1153 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1154 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1157 static HRESULT WINAPI
XA23SUB_GetEffectParameters(IXAudio23SubmixVoice
*iface
,
1158 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1160 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1161 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1162 EffectIndex
, pParameters
, ParametersByteSize
);
1165 static HRESULT WINAPI
XA23SUB_SetFilterParameters(IXAudio23SubmixVoice
*iface
,
1166 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1168 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1169 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1170 pParameters
, OperationSet
);
1173 static void WINAPI
XA23SUB_GetFilterParameters(IXAudio23SubmixVoice
*iface
,
1174 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1176 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1177 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
1180 static HRESULT WINAPI
XA23SUB_SetVolume(IXAudio23SubmixVoice
*iface
,
1181 float Volume
, UINT32 OperationSet
)
1183 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1184 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
1185 Volume
, OperationSet
);
1188 static void WINAPI
XA23SUB_GetVolume(IXAudio23SubmixVoice
*iface
,
1191 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1192 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1195 static HRESULT WINAPI
XA23SUB_SetChannelVolumes(IXAudio23SubmixVoice
*iface
,
1196 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1198 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1199 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1200 Channels
, pVolumes
, OperationSet
);
1203 static void WINAPI
XA23SUB_GetChannelVolumes(IXAudio23SubmixVoice
*iface
,
1204 UINT32 Channels
, float *pVolumes
)
1206 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1207 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1208 Channels
, pVolumes
);
1211 static HRESULT WINAPI
XA23SUB_SetOutputMatrix(IXAudio23SubmixVoice
*iface
,
1212 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1213 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1214 UINT32 OperationSet
)
1216 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1217 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1218 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1219 pLevelMatrix
, OperationSet
);
1222 static void WINAPI
XA23SUB_GetOutputMatrix(IXAudio23SubmixVoice
*iface
,
1223 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1224 UINT32 DestinationChannels
, float *pLevelMatrix
)
1226 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1227 return IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1228 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1232 static void WINAPI
XA23SUB_DestroyVoice(IXAudio23SubmixVoice
*iface
)
1234 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1235 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1238 const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl
= {
1239 XA23SUB_GetVoiceDetails
,
1240 XA23SUB_SetOutputVoices
,
1241 XA23SUB_SetEffectChain
,
1242 XA23SUB_EnableEffect
,
1243 XA23SUB_DisableEffect
,
1244 XA23SUB_GetEffectState
,
1245 XA23SUB_SetEffectParameters
,
1246 XA23SUB_GetEffectParameters
,
1247 XA23SUB_SetFilterParameters
,
1248 XA23SUB_GetFilterParameters
,
1251 XA23SUB_SetChannelVolumes
,
1252 XA23SUB_GetChannelVolumes
,
1253 XA23SUB_SetOutputMatrix
,
1254 XA23SUB_GetOutputMatrix
,
1255 XA23SUB_DestroyVoice
1258 #elif XAUDIO2_VER <= 7
1260 static XA2SubmixImpl
*impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice
*iface
)
1262 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio27SubmixVoice_iface
);
1265 static void WINAPI
XA27SUB_GetVoiceDetails(IXAudio27SubmixVoice
*iface
,
1266 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1268 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1269 XAUDIO2_VOICE_DETAILS details
;
1271 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
1273 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1274 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1275 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1278 static HRESULT WINAPI
XA27SUB_SetOutputVoices(IXAudio27SubmixVoice
*iface
,
1279 const XAUDIO2_VOICE_SENDS
*pSendList
)
1281 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1282 return IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, pSendList
);
1285 static HRESULT WINAPI
XA27SUB_SetEffectChain(IXAudio27SubmixVoice
*iface
,
1286 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1288 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1289 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
1292 static HRESULT WINAPI
XA27SUB_EnableEffect(IXAudio27SubmixVoice
*iface
,
1293 UINT32 EffectIndex
, UINT32 OperationSet
)
1295 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1296 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
1297 EffectIndex
, OperationSet
);
1300 static HRESULT WINAPI
XA27SUB_DisableEffect(IXAudio27SubmixVoice
*iface
,
1301 UINT32 EffectIndex
, UINT32 OperationSet
)
1303 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1304 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
1305 EffectIndex
, OperationSet
);
1308 static void WINAPI
XA27SUB_GetEffectState(IXAudio27SubmixVoice
*iface
,
1309 UINT32 EffectIndex
, BOOL
*pEnabled
)
1311 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1312 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
1313 EffectIndex
, pEnabled
);
1316 static HRESULT WINAPI
XA27SUB_SetEffectParameters(IXAudio27SubmixVoice
*iface
,
1317 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1318 UINT32 OperationSet
)
1320 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1321 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1322 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1325 static HRESULT WINAPI
XA27SUB_GetEffectParameters(IXAudio27SubmixVoice
*iface
,
1326 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1328 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1329 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1330 EffectIndex
, pParameters
, ParametersByteSize
);
1333 static HRESULT WINAPI
XA27SUB_SetFilterParameters(IXAudio27SubmixVoice
*iface
,
1334 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1336 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1337 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1338 pParameters
, OperationSet
);
1341 static void WINAPI
XA27SUB_GetFilterParameters(IXAudio27SubmixVoice
*iface
,
1342 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1344 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1345 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
1348 static HRESULT WINAPI
XA27SUB_SetOutputFilterParameters(IXAudio27SubmixVoice
*iface
,
1349 IXAudio2Voice
*pDestinationVoice
,
1350 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1352 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1353 return IXAudio2SubmixVoice_SetOutputFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1354 pDestinationVoice
, pParameters
, OperationSet
);
1357 static void WINAPI
XA27SUB_GetOutputFilterParameters(IXAudio27SubmixVoice
*iface
,
1358 IXAudio2Voice
*pDestinationVoice
,
1359 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1361 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1362 IXAudio2SubmixVoice_GetOutputFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1363 pDestinationVoice
, pParameters
);
1366 static HRESULT WINAPI
XA27SUB_SetVolume(IXAudio27SubmixVoice
*iface
,
1367 float Volume
, UINT32 OperationSet
)
1369 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1370 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
1371 Volume
, OperationSet
);
1374 static void WINAPI
XA27SUB_GetVolume(IXAudio27SubmixVoice
*iface
,
1377 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1378 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1381 static HRESULT WINAPI
XA27SUB_SetChannelVolumes(IXAudio27SubmixVoice
*iface
,
1382 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1384 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1385 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1386 Channels
, pVolumes
, OperationSet
);
1389 static void WINAPI
XA27SUB_GetChannelVolumes(IXAudio27SubmixVoice
*iface
,
1390 UINT32 Channels
, float *pVolumes
)
1392 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1393 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1394 Channels
, pVolumes
);
1397 static HRESULT WINAPI
XA27SUB_SetOutputMatrix(IXAudio27SubmixVoice
*iface
,
1398 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1399 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1400 UINT32 OperationSet
)
1402 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1403 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1404 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1405 pLevelMatrix
, OperationSet
);
1408 static void WINAPI
XA27SUB_GetOutputMatrix(IXAudio27SubmixVoice
*iface
,
1409 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1410 UINT32 DestinationChannels
, float *pLevelMatrix
)
1412 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1413 return IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1414 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1418 static void WINAPI
XA27SUB_DestroyVoice(IXAudio27SubmixVoice
*iface
)
1420 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1421 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1424 const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl
= {
1425 XA27SUB_GetVoiceDetails
,
1426 XA27SUB_SetOutputVoices
,
1427 XA27SUB_SetEffectChain
,
1428 XA27SUB_EnableEffect
,
1429 XA27SUB_DisableEffect
,
1430 XA27SUB_GetEffectState
,
1431 XA27SUB_SetEffectParameters
,
1432 XA27SUB_GetEffectParameters
,
1433 XA27SUB_SetFilterParameters
,
1434 XA27SUB_GetFilterParameters
,
1435 XA27SUB_SetOutputFilterParameters
,
1436 XA27SUB_GetOutputFilterParameters
,
1439 XA27SUB_SetChannelVolumes
,
1440 XA27SUB_GetChannelVolumes
,
1441 XA27SUB_SetOutputMatrix
,
1442 XA27SUB_GetOutputMatrix
,
1443 XA27SUB_DestroyVoice
1446 /* END IXAudio2SubmixVoice */
1449 /* BEGIN IXAudio2MasteringVoice */
1450 #if XAUDIO2_VER == 0
1451 static IXAudio2Impl
*impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice
*iface
)
1453 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio20MasteringVoice_iface
);
1456 static void WINAPI
XA20M_GetVoiceDetails(IXAudio20MasteringVoice
*iface
,
1457 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1459 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1460 XAUDIO2_VOICE_DETAILS details
;
1462 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1464 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1465 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1466 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1469 static HRESULT WINAPI
XA20M_SetOutputVoices(IXAudio20MasteringVoice
*iface
,
1470 const XAUDIO23_VOICE_SENDS
*pSendList
)
1472 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1473 XAUDIO2_VOICE_SENDS sends
;
1477 TRACE("%p, %p\n", This
, pSendList
);
1479 sends
.SendCount
= pSendList
->OutputCount
;
1480 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1481 for(i
= 0; i
< sends
.SendCount
; ++i
){
1482 sends
.pSends
[i
].Flags
= 0;
1483 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1486 hr
= IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, &sends
);
1488 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1493 static HRESULT WINAPI
XA20M_SetEffectChain(IXAudio20MasteringVoice
*iface
,
1494 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1496 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1497 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1500 static HRESULT WINAPI
XA20M_EnableEffect(IXAudio20MasteringVoice
*iface
,
1501 UINT32 EffectIndex
, UINT32 OperationSet
)
1503 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1504 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1505 EffectIndex
, OperationSet
);
1508 static HRESULT WINAPI
XA20M_DisableEffect(IXAudio20MasteringVoice
*iface
,
1509 UINT32 EffectIndex
, UINT32 OperationSet
)
1511 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1512 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1513 EffectIndex
, OperationSet
);
1516 static void WINAPI
XA20M_GetEffectState(IXAudio20MasteringVoice
*iface
,
1517 UINT32 EffectIndex
, BOOL
*pEnabled
)
1519 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1520 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1521 EffectIndex
, pEnabled
);
1524 static HRESULT WINAPI
XA20M_SetEffectParameters(IXAudio20MasteringVoice
*iface
,
1525 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1526 UINT32 OperationSet
)
1528 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1529 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1530 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1533 static HRESULT WINAPI
XA20M_GetEffectParameters(IXAudio20MasteringVoice
*iface
,
1534 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1536 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1537 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1538 EffectIndex
, pParameters
, ParametersByteSize
);
1541 static HRESULT WINAPI
XA20M_SetFilterParameters(IXAudio20MasteringVoice
*iface
,
1542 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1544 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1545 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1546 pParameters
, OperationSet
);
1549 static void WINAPI
XA20M_GetFilterParameters(IXAudio20MasteringVoice
*iface
,
1550 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1552 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1553 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1556 static HRESULT WINAPI
XA20M_SetVolume(IXAudio20MasteringVoice
*iface
,
1557 float Volume
, UINT32 OperationSet
)
1559 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1560 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1561 Volume
, OperationSet
);
1564 static void WINAPI
XA20M_GetVolume(IXAudio20MasteringVoice
*iface
,
1567 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1568 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1571 static HRESULT WINAPI
XA20M_SetChannelVolumes(IXAudio20MasteringVoice
*iface
,
1572 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1574 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1575 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1576 Channels
, pVolumes
, OperationSet
);
1579 static void WINAPI
XA20M_GetChannelVolumes(IXAudio20MasteringVoice
*iface
,
1580 UINT32 Channels
, float *pVolumes
)
1582 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1583 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1584 Channels
, pVolumes
);
1587 static HRESULT WINAPI
XA20M_SetOutputMatrix(IXAudio20MasteringVoice
*iface
,
1588 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1589 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1590 UINT32 OperationSet
)
1592 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1593 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1594 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1595 pLevelMatrix
, OperationSet
);
1598 static HRESULT WINAPI
XA20M_GetOutputMatrix(IXAudio20MasteringVoice
*iface
,
1599 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1600 UINT32 DestinationChannels
, float *pLevelMatrix
)
1602 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1603 IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1604 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1609 static void WINAPI
XA20M_DestroyVoice(IXAudio20MasteringVoice
*iface
)
1611 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1612 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1615 const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl
= {
1616 XA20M_GetVoiceDetails
,
1617 XA20M_SetOutputVoices
,
1618 XA20M_SetEffectChain
,
1620 XA20M_DisableEffect
,
1621 XA20M_GetEffectState
,
1622 XA20M_SetEffectParameters
,
1623 XA20M_GetEffectParameters
,
1624 XA20M_SetFilterParameters
,
1625 XA20M_GetFilterParameters
,
1628 XA20M_SetChannelVolumes
,
1629 XA20M_GetChannelVolumes
,
1630 XA20M_SetOutputMatrix
,
1631 XA20M_GetOutputMatrix
,
1635 #elif XAUDIO2_VER <= 3
1637 static IXAudio2Impl
*impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice
*iface
)
1639 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio23MasteringVoice_iface
);
1642 static void WINAPI
XA23M_GetVoiceDetails(IXAudio23MasteringVoice
*iface
,
1643 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1645 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1646 XAUDIO2_VOICE_DETAILS details
;
1648 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1650 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1651 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1652 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1655 static HRESULT WINAPI
XA23M_SetOutputVoices(IXAudio23MasteringVoice
*iface
,
1656 const XAUDIO23_VOICE_SENDS
*pSendList
)
1658 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1659 XAUDIO2_VOICE_SENDS sends
;
1663 TRACE("%p, %p\n", This
, pSendList
);
1665 sends
.SendCount
= pSendList
->OutputCount
;
1666 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1667 for(i
= 0; i
< sends
.SendCount
; ++i
){
1668 sends
.pSends
[i
].Flags
= 0;
1669 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1672 hr
= IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, &sends
);
1674 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1679 static HRESULT WINAPI
XA23M_SetEffectChain(IXAudio23MasteringVoice
*iface
,
1680 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1682 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1683 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1686 static HRESULT WINAPI
XA23M_EnableEffect(IXAudio23MasteringVoice
*iface
,
1687 UINT32 EffectIndex
, UINT32 OperationSet
)
1689 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1690 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1691 EffectIndex
, OperationSet
);
1694 static HRESULT WINAPI
XA23M_DisableEffect(IXAudio23MasteringVoice
*iface
,
1695 UINT32 EffectIndex
, UINT32 OperationSet
)
1697 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1698 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1699 EffectIndex
, OperationSet
);
1702 static void WINAPI
XA23M_GetEffectState(IXAudio23MasteringVoice
*iface
,
1703 UINT32 EffectIndex
, BOOL
*pEnabled
)
1705 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1706 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1707 EffectIndex
, pEnabled
);
1710 static HRESULT WINAPI
XA23M_SetEffectParameters(IXAudio23MasteringVoice
*iface
,
1711 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1712 UINT32 OperationSet
)
1714 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1715 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1716 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1719 static HRESULT WINAPI
XA23M_GetEffectParameters(IXAudio23MasteringVoice
*iface
,
1720 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1722 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1723 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1724 EffectIndex
, pParameters
, ParametersByteSize
);
1727 static HRESULT WINAPI
XA23M_SetFilterParameters(IXAudio23MasteringVoice
*iface
,
1728 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1730 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1731 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1732 pParameters
, OperationSet
);
1735 static void WINAPI
XA23M_GetFilterParameters(IXAudio23MasteringVoice
*iface
,
1736 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1738 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1739 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1742 static HRESULT WINAPI
XA23M_SetVolume(IXAudio23MasteringVoice
*iface
,
1743 float Volume
, UINT32 OperationSet
)
1745 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1746 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1747 Volume
, OperationSet
);
1750 static void WINAPI
XA23M_GetVolume(IXAudio23MasteringVoice
*iface
,
1753 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1754 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1757 static HRESULT WINAPI
XA23M_SetChannelVolumes(IXAudio23MasteringVoice
*iface
,
1758 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1760 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1761 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1762 Channels
, pVolumes
, OperationSet
);
1765 static void WINAPI
XA23M_GetChannelVolumes(IXAudio23MasteringVoice
*iface
,
1766 UINT32 Channels
, float *pVolumes
)
1768 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1769 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1770 Channels
, pVolumes
);
1773 static HRESULT WINAPI
XA23M_SetOutputMatrix(IXAudio23MasteringVoice
*iface
,
1774 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1775 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1776 UINT32 OperationSet
)
1778 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1779 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1780 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1781 pLevelMatrix
, OperationSet
);
1784 static void WINAPI
XA23M_GetOutputMatrix(IXAudio23MasteringVoice
*iface
,
1785 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1786 UINT32 DestinationChannels
, float *pLevelMatrix
)
1788 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1789 return IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1790 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1794 static void WINAPI
XA23M_DestroyVoice(IXAudio23MasteringVoice
*iface
)
1796 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1797 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1800 const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl
= {
1801 XA23M_GetVoiceDetails
,
1802 XA23M_SetOutputVoices
,
1803 XA23M_SetEffectChain
,
1805 XA23M_DisableEffect
,
1806 XA23M_GetEffectState
,
1807 XA23M_SetEffectParameters
,
1808 XA23M_GetEffectParameters
,
1809 XA23M_SetFilterParameters
,
1810 XA23M_GetFilterParameters
,
1813 XA23M_SetChannelVolumes
,
1814 XA23M_GetChannelVolumes
,
1815 XA23M_SetOutputMatrix
,
1816 XA23M_GetOutputMatrix
,
1820 #elif XAUDIO2_VER <= 7
1822 static IXAudio2Impl
*impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice
*iface
)
1824 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio27MasteringVoice_iface
);
1827 static void WINAPI
XA27M_GetVoiceDetails(IXAudio27MasteringVoice
*iface
,
1828 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1830 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1831 XAUDIO2_VOICE_DETAILS details
;
1833 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1835 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1836 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1837 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1840 static HRESULT WINAPI
XA27M_SetOutputVoices(IXAudio27MasteringVoice
*iface
,
1841 const XAUDIO2_VOICE_SENDS
*pSendList
)
1843 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1844 return IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, pSendList
);
1847 static HRESULT WINAPI
XA27M_SetEffectChain(IXAudio27MasteringVoice
*iface
,
1848 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1850 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1851 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1854 static HRESULT WINAPI
XA27M_EnableEffect(IXAudio27MasteringVoice
*iface
,
1855 UINT32 EffectIndex
, UINT32 OperationSet
)
1857 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1858 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1859 EffectIndex
, OperationSet
);
1862 static HRESULT WINAPI
XA27M_DisableEffect(IXAudio27MasteringVoice
*iface
,
1863 UINT32 EffectIndex
, UINT32 OperationSet
)
1865 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1866 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1867 EffectIndex
, OperationSet
);
1870 static void WINAPI
XA27M_GetEffectState(IXAudio27MasteringVoice
*iface
,
1871 UINT32 EffectIndex
, BOOL
*pEnabled
)
1873 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1874 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1875 EffectIndex
, pEnabled
);
1878 static HRESULT WINAPI
XA27M_SetEffectParameters(IXAudio27MasteringVoice
*iface
,
1879 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1880 UINT32 OperationSet
)
1882 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1883 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1884 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1887 static HRESULT WINAPI
XA27M_GetEffectParameters(IXAudio27MasteringVoice
*iface
,
1888 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1890 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1891 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1892 EffectIndex
, pParameters
, ParametersByteSize
);
1895 static HRESULT WINAPI
XA27M_SetFilterParameters(IXAudio27MasteringVoice
*iface
,
1896 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1898 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1899 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1900 pParameters
, OperationSet
);
1903 static void WINAPI
XA27M_GetFilterParameters(IXAudio27MasteringVoice
*iface
,
1904 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1906 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1907 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1910 static HRESULT WINAPI
XA27M_SetOutputFilterParameters(IXAudio27MasteringVoice
*iface
,
1911 IXAudio2Voice
*pDestinationVoice
,
1912 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1914 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1915 return IXAudio2MasteringVoice_SetOutputFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1916 pDestinationVoice
, pParameters
, OperationSet
);
1919 static void WINAPI
XA27M_GetOutputFilterParameters(IXAudio27MasteringVoice
*iface
,
1920 IXAudio2Voice
*pDestinationVoice
,
1921 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1923 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1924 IXAudio2MasteringVoice_GetOutputFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1925 pDestinationVoice
, pParameters
);
1928 static HRESULT WINAPI
XA27M_SetVolume(IXAudio27MasteringVoice
*iface
,
1929 float Volume
, UINT32 OperationSet
)
1931 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1932 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1933 Volume
, OperationSet
);
1936 static void WINAPI
XA27M_GetVolume(IXAudio27MasteringVoice
*iface
,
1939 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1940 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1943 static HRESULT WINAPI
XA27M_SetChannelVolumes(IXAudio27MasteringVoice
*iface
,
1944 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1946 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1947 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1948 Channels
, pVolumes
, OperationSet
);
1951 static void WINAPI
XA27M_GetChannelVolumes(IXAudio27MasteringVoice
*iface
,
1952 UINT32 Channels
, float *pVolumes
)
1954 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1955 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1956 Channels
, pVolumes
);
1959 static HRESULT WINAPI
XA27M_SetOutputMatrix(IXAudio27MasteringVoice
*iface
,
1960 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1961 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1962 UINT32 OperationSet
)
1964 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1965 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1966 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1967 pLevelMatrix
, OperationSet
);
1970 static void WINAPI
XA27M_GetOutputMatrix(IXAudio27MasteringVoice
*iface
,
1971 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1972 UINT32 DestinationChannels
, float *pLevelMatrix
)
1974 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1975 return IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1976 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1980 static void WINAPI
XA27M_DestroyVoice(IXAudio27MasteringVoice
*iface
)
1982 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1983 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1986 const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl
= {
1987 XA27M_GetVoiceDetails
,
1988 XA27M_SetOutputVoices
,
1989 XA27M_SetEffectChain
,
1991 XA27M_DisableEffect
,
1992 XA27M_GetEffectState
,
1993 XA27M_SetEffectParameters
,
1994 XA27M_GetEffectParameters
,
1995 XA27M_SetFilterParameters
,
1996 XA27M_GetFilterParameters
,
1997 XA27M_SetOutputFilterParameters
,
1998 XA27M_GetOutputFilterParameters
,
2001 XA27M_SetChannelVolumes
,
2002 XA27M_GetChannelVolumes
,
2003 XA27M_SetOutputMatrix
,
2004 XA27M_GetOutputMatrix
,
2008 /* END IXAudio2MasteringVoice */
2011 /* BEGIN IXAudio2 */
2012 #if XAUDIO2_VER == 0
2013 static inline IXAudio2Impl
*impl_from_IXAudio20(IXAudio20
*iface
)
2015 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio20_iface
);
2018 static HRESULT WINAPI
XA20_QueryInterface(IXAudio20
*iface
, REFIID riid
,
2021 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2022 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2025 static ULONG WINAPI
XA20_AddRef(IXAudio20
*iface
)
2027 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2028 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2031 static ULONG WINAPI
XA20_Release(IXAudio20
*iface
)
2033 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2034 return IXAudio2_Release(&This
->IXAudio2_iface
);
2037 static HRESULT WINAPI
XA20_GetDeviceCount(IXAudio20
*iface
, UINT32
*pCount
)
2039 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2041 TRACE("%p, %p\n", This
, pCount
);
2043 *pCount
= This
->ndevs
;
2048 static HRESULT WINAPI
XA20_GetDeviceDetails(IXAudio20
*iface
, UINT32 index
,
2049 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2051 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2054 IAudioClient
*client
;
2059 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2061 if(index
>= This
->ndevs
)
2062 return E_INVALIDARG
;
2064 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2066 WARN("GetDevice failed: %08x\n", hr
);
2070 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2071 NULL
, (void**)&client
);
2073 WARN("Activate failed: %08x\n", hr
);
2074 IMMDevice_Release(dev
);
2078 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2080 WARN("OpenPropertyStore failed: %08x\n", hr
);
2081 IAudioClient_Release(client
);
2082 IMMDevice_Release(dev
);
2086 PropVariantInit(&var
);
2088 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2090 WARN("GetValue failed: %08x\n", hr
);
2094 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2096 PropVariantClear(&var
);
2098 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2100 WARN("GetMixFormat failed: %08x\n", hr
);
2104 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2107 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2109 pDeviceDetails
->Role
= NotDefaultDevice
;
2111 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2112 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2117 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2122 IPropertyStore_Release(ps
);
2123 IAudioClient_Release(client
);
2124 IMMDevice_Release(dev
);
2129 static HRESULT WINAPI
XA20_Initialize(IXAudio20
*iface
, UINT32 flags
,
2130 XAUDIO2_PROCESSOR processor
)
2132 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2133 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2134 return xaudio2_initialize(This
, flags
, processor
);
2137 static HRESULT WINAPI
XA20_RegisterForCallbacks(IXAudio20
*iface
,
2138 IXAudio2EngineCallback
*pCallback
)
2140 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2141 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2144 static void WINAPI
XA20_UnregisterForCallbacks(IXAudio20
*iface
,
2145 IXAudio2EngineCallback
*pCallback
)
2147 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2148 return IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2151 static HRESULT WINAPI
XA20_CreateSourceVoice(IXAudio20
*iface
,
2152 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2153 UINT32 flags
, float maxFrequencyRatio
,
2154 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2155 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2157 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2158 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2159 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2163 static HRESULT WINAPI
XA20_CreateSubmixVoice(IXAudio20
*iface
,
2164 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2165 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2166 const XAUDIO2_VOICE_SENDS
*pSendList
,
2167 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2169 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2170 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2171 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2175 static HRESULT WINAPI
XA20_CreateMasteringVoice(IXAudio20
*iface
,
2176 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2177 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2178 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2180 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2182 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2183 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2186 if(deviceIndex
>= This
->ndevs
)
2187 return E_INVALIDARG
;
2189 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2190 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2191 pEffectChain
, AudioCategory_GameEffects
);
2194 static HRESULT WINAPI
XA20_StartEngine(IXAudio20
*iface
)
2196 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2197 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2200 static void WINAPI
XA20_StopEngine(IXAudio20
*iface
)
2202 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2203 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2206 static HRESULT WINAPI
XA20_CommitChanges(IXAudio20
*iface
, UINT32 operationSet
)
2208 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2209 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2212 static void WINAPI
XA20_GetPerformanceData(IXAudio20
*iface
,
2213 XAUDIO20_PERFORMANCE_DATA
*pPerfData
)
2215 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2216 XAUDIO2_PERFORMANCE_DATA data
;
2218 IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, &data
);
2220 pPerfData
->AudioCyclesSinceLastQuery
= data
.AudioCyclesSinceLastQuery
;
2221 pPerfData
->TotalCyclesSinceLastQuery
= data
.TotalCyclesSinceLastQuery
;
2222 pPerfData
->MinimumCyclesPerQuantum
= data
.MinimumCyclesPerQuantum
;
2223 pPerfData
->MaximumCyclesPerQuantum
= data
.MaximumCyclesPerQuantum
;
2224 pPerfData
->MemoryUsageInBytes
= data
.MemoryUsageInBytes
;
2225 pPerfData
->CurrentLatencyInSamples
= data
.CurrentLatencyInSamples
;
2226 pPerfData
->GlitchesSinceLastQuery
= data
.GlitchesSinceEngineStarted
- This
->last_query_glitches
;
2227 This
->last_query_glitches
= data
.GlitchesSinceEngineStarted
;
2228 pPerfData
->ActiveSourceVoiceCount
= data
.ActiveSourceVoiceCount
;
2229 pPerfData
->TotalSourceVoiceCount
= data
.TotalSourceVoiceCount
;
2231 pPerfData
->ActiveSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2232 pPerfData
->TotalSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2234 pPerfData
->ActiveXmaSourceVoices
= data
.ActiveXmaSourceVoices
;
2235 pPerfData
->ActiveXmaStreams
= data
.ActiveXmaStreams
;
2238 static void WINAPI
XA20_SetDebugConfiguration(IXAudio20
*iface
,
2239 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2242 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2243 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2244 pDebugConfiguration
, pReserved
);
2247 const IXAudio20Vtbl XAudio20_Vtbl
= {
2248 XA20_QueryInterface
,
2251 XA20_GetDeviceCount
,
2252 XA20_GetDeviceDetails
,
2254 XA20_RegisterForCallbacks
,
2255 XA20_UnregisterForCallbacks
,
2256 XA20_CreateSourceVoice
,
2257 XA20_CreateSubmixVoice
,
2258 XA20_CreateMasteringVoice
,
2262 XA20_GetPerformanceData
,
2263 XA20_SetDebugConfiguration
2266 #elif XAUDIO2_VER <= 2
2268 static inline IXAudio2Impl
*impl_from_IXAudio22(IXAudio22
*iface
)
2270 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio22_iface
);
2273 static HRESULT WINAPI
XA22_QueryInterface(IXAudio22
*iface
, REFIID riid
,
2276 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2277 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2280 static ULONG WINAPI
XA22_AddRef(IXAudio22
*iface
)
2282 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2283 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2286 static ULONG WINAPI
XA22_Release(IXAudio22
*iface
)
2288 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2289 return IXAudio2_Release(&This
->IXAudio2_iface
);
2292 static HRESULT WINAPI
XA22_GetDeviceCount(IXAudio22
*iface
, UINT32
*pCount
)
2294 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2296 TRACE("%p, %p\n", This
, pCount
);
2298 *pCount
= This
->ndevs
;
2303 static HRESULT WINAPI
XA22_GetDeviceDetails(IXAudio22
*iface
, UINT32 index
,
2304 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2306 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2309 IAudioClient
*client
;
2314 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2316 if(index
>= This
->ndevs
)
2317 return E_INVALIDARG
;
2319 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2321 WARN("GetDevice failed: %08x\n", hr
);
2325 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2326 NULL
, (void**)&client
);
2328 WARN("Activate failed: %08x\n", hr
);
2329 IMMDevice_Release(dev
);
2333 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2335 WARN("OpenPropertyStore failed: %08x\n", hr
);
2336 IAudioClient_Release(client
);
2337 IMMDevice_Release(dev
);
2341 PropVariantInit(&var
);
2343 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2345 WARN("GetValue failed: %08x\n", hr
);
2349 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2351 PropVariantClear(&var
);
2353 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2355 WARN("GetMixFormat failed: %08x\n", hr
);
2359 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2362 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2364 pDeviceDetails
->Role
= NotDefaultDevice
;
2366 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2367 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2372 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2377 IPropertyStore_Release(ps
);
2378 IAudioClient_Release(client
);
2379 IMMDevice_Release(dev
);
2384 static HRESULT WINAPI
XA22_Initialize(IXAudio22
*iface
, UINT32 flags
,
2385 XAUDIO2_PROCESSOR processor
)
2387 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2388 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2389 return xaudio2_initialize(This
, flags
, processor
);
2392 static HRESULT WINAPI
XA22_RegisterForCallbacks(IXAudio22
*iface
,
2393 IXAudio2EngineCallback
*pCallback
)
2395 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2396 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2399 static void WINAPI
XA22_UnregisterForCallbacks(IXAudio22
*iface
,
2400 IXAudio2EngineCallback
*pCallback
)
2402 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2403 IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2406 static HRESULT WINAPI
XA22_CreateSourceVoice(IXAudio22
*iface
,
2407 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2408 UINT32 flags
, float maxFrequencyRatio
,
2409 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2410 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2412 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2413 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2414 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2418 static HRESULT WINAPI
XA22_CreateSubmixVoice(IXAudio22
*iface
,
2419 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2420 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2421 const XAUDIO2_VOICE_SENDS
*pSendList
,
2422 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2424 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2425 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2426 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2430 static HRESULT WINAPI
XA22_CreateMasteringVoice(IXAudio22
*iface
,
2431 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2432 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2433 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2435 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2437 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2438 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2441 if(deviceIndex
>= This
->ndevs
)
2442 return E_INVALIDARG
;
2444 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2445 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2446 pEffectChain
, AudioCategory_GameEffects
);
2449 static HRESULT WINAPI
XA22_StartEngine(IXAudio22
*iface
)
2451 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2452 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2455 static void WINAPI
XA22_StopEngine(IXAudio22
*iface
)
2457 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2458 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2461 static HRESULT WINAPI
XA22_CommitChanges(IXAudio22
*iface
, UINT32 operationSet
)
2463 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2464 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2467 static void WINAPI
XA22_GetPerformanceData(IXAudio22
*iface
,
2468 XAUDIO22_PERFORMANCE_DATA
*pPerfData
)
2470 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2471 XAUDIO2_PERFORMANCE_DATA data
;
2473 IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, &data
);
2475 pPerfData
->AudioCyclesSinceLastQuery
= data
.AudioCyclesSinceLastQuery
;
2476 pPerfData
->TotalCyclesSinceLastQuery
= data
.TotalCyclesSinceLastQuery
;
2477 pPerfData
->MinimumCyclesPerQuantum
= data
.MinimumCyclesPerQuantum
;
2478 pPerfData
->MaximumCyclesPerQuantum
= data
.MaximumCyclesPerQuantum
;
2479 pPerfData
->MemoryUsageInBytes
= data
.MemoryUsageInBytes
;
2480 pPerfData
->CurrentLatencyInSamples
= data
.CurrentLatencyInSamples
;
2481 pPerfData
->GlitchesSinceEngineStarted
= data
.GlitchesSinceEngineStarted
;
2482 pPerfData
->ActiveSourceVoiceCount
= data
.ActiveSourceVoiceCount
;
2483 pPerfData
->TotalSourceVoiceCount
= data
.TotalSourceVoiceCount
;
2485 pPerfData
->ActiveSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2486 pPerfData
->TotalSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2488 pPerfData
->ActiveXmaSourceVoices
= data
.ActiveXmaSourceVoices
;
2489 pPerfData
->ActiveXmaStreams
= data
.ActiveXmaStreams
;
2492 static void WINAPI
XA22_SetDebugConfiguration(IXAudio22
*iface
,
2493 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2496 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2497 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2498 pDebugConfiguration
, pReserved
);
2501 const IXAudio22Vtbl XAudio22_Vtbl
= {
2502 XA22_QueryInterface
,
2505 XA22_GetDeviceCount
,
2506 XA22_GetDeviceDetails
,
2508 XA22_RegisterForCallbacks
,
2509 XA22_UnregisterForCallbacks
,
2510 XA22_CreateSourceVoice
,
2511 XA22_CreateSubmixVoice
,
2512 XA22_CreateMasteringVoice
,
2516 XA22_GetPerformanceData
,
2517 XA22_SetDebugConfiguration
2520 #elif XAUDIO2_VER <= 7
2522 static inline IXAudio2Impl
*impl_from_IXAudio27(IXAudio27
*iface
)
2524 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio27_iface
);
2527 static HRESULT WINAPI
XA27_QueryInterface(IXAudio27
*iface
, REFIID riid
,
2530 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2531 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2534 static ULONG WINAPI
XA27_AddRef(IXAudio27
*iface
)
2536 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2537 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2540 static ULONG WINAPI
XA27_Release(IXAudio27
*iface
)
2542 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2543 return IXAudio2_Release(&This
->IXAudio2_iface
);
2546 static HRESULT WINAPI
XA27_GetDeviceCount(IXAudio27
*iface
, UINT32
*pCount
)
2548 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2550 TRACE("%p, %p\n", This
, pCount
);
2552 *pCount
= This
->ndevs
;
2557 static HRESULT WINAPI
XA27_GetDeviceDetails(IXAudio27
*iface
, UINT32 index
,
2558 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2560 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2563 IAudioClient
*client
;
2568 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2570 if(index
>= This
->ndevs
)
2571 return E_INVALIDARG
;
2573 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2575 WARN("GetDevice failed: %08x\n", hr
);
2579 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2580 NULL
, (void**)&client
);
2582 WARN("Activate failed: %08x\n", hr
);
2583 IMMDevice_Release(dev
);
2587 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2589 WARN("OpenPropertyStore failed: %08x\n", hr
);
2590 IAudioClient_Release(client
);
2591 IMMDevice_Release(dev
);
2595 PropVariantInit(&var
);
2597 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2599 WARN("GetValue failed: %08x\n", hr
);
2603 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2605 PropVariantClear(&var
);
2607 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2609 WARN("GetMixFormat failed: %08x\n", hr
);
2613 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2616 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2618 pDeviceDetails
->Role
= NotDefaultDevice
;
2620 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2621 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2626 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2631 IPropertyStore_Release(ps
);
2632 IAudioClient_Release(client
);
2633 IMMDevice_Release(dev
);
2638 static HRESULT WINAPI
XA27_Initialize(IXAudio27
*iface
, UINT32 flags
,
2639 XAUDIO2_PROCESSOR processor
)
2641 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2642 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2643 return xaudio2_initialize(This
, flags
, processor
);
2646 static HRESULT WINAPI
XA27_RegisterForCallbacks(IXAudio27
*iface
,
2647 IXAudio2EngineCallback
*pCallback
)
2649 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2650 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2653 static void WINAPI
XA27_UnregisterForCallbacks(IXAudio27
*iface
,
2654 IXAudio2EngineCallback
*pCallback
)
2656 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2657 IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2660 static HRESULT WINAPI
XA27_CreateSourceVoice(IXAudio27
*iface
,
2661 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2662 UINT32 flags
, float maxFrequencyRatio
,
2663 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2664 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2666 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2667 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2668 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2672 static HRESULT WINAPI
XA27_CreateSubmixVoice(IXAudio27
*iface
,
2673 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2674 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2675 const XAUDIO2_VOICE_SENDS
*pSendList
,
2676 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2678 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2679 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2680 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2684 static HRESULT WINAPI
XA27_CreateMasteringVoice(IXAudio27
*iface
,
2685 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2686 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2687 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2689 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2691 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2692 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2695 if(deviceIndex
>= This
->ndevs
)
2696 return E_INVALIDARG
;
2698 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2699 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2700 pEffectChain
, AudioCategory_GameEffects
);
2703 static HRESULT WINAPI
XA27_StartEngine(IXAudio27
*iface
)
2705 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2706 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2709 static void WINAPI
XA27_StopEngine(IXAudio27
*iface
)
2711 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2712 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2715 static HRESULT WINAPI
XA27_CommitChanges(IXAudio27
*iface
, UINT32 operationSet
)
2717 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2718 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2721 static void WINAPI
XA27_GetPerformanceData(IXAudio27
*iface
,
2722 XAUDIO2_PERFORMANCE_DATA
*pPerfData
)
2724 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2725 return IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, pPerfData
);
2728 static void WINAPI
XA27_SetDebugConfiguration(IXAudio27
*iface
,
2729 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2732 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2733 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2734 pDebugConfiguration
, pReserved
);
2737 const IXAudio27Vtbl XAudio27_Vtbl
= {
2738 XA27_QueryInterface
,
2741 XA27_GetDeviceCount
,
2742 XA27_GetDeviceDetails
,
2744 XA27_RegisterForCallbacks
,
2745 XA27_UnregisterForCallbacks
,
2746 XA27_CreateSourceVoice
,
2747 XA27_CreateSubmixVoice
,
2748 XA27_CreateMasteringVoice
,
2752 XA27_GetPerformanceData
,
2753 XA27_SetDebugConfiguration