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"
104 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
106 /* BEGIN IXAudio2SourceVoice */
108 static XA2SourceImpl
*impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice
*iface
)
110 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio20SourceVoice_iface
);
113 static void WINAPI
XA20SRC_GetVoiceDetails(IXAudio20SourceVoice
*iface
,
114 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
116 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
117 XAUDIO2_VOICE_DETAILS details
;
119 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
121 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
122 pVoiceDetails
->InputChannels
= details
.InputChannels
;
123 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
126 static HRESULT WINAPI
XA20SRC_SetOutputVoices(IXAudio20SourceVoice
*iface
,
127 const XAUDIO23_VOICE_SENDS
*pSendList
)
129 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
130 XAUDIO2_VOICE_SENDS sends
;
134 TRACE("%p, %p\n", This
, pSendList
);
136 sends
.SendCount
= pSendList
->OutputCount
;
137 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
138 for(i
= 0; i
< sends
.SendCount
; ++i
){
139 sends
.pSends
[i
].Flags
= 0;
140 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
143 hr
= IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, &sends
);
145 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
150 static HRESULT WINAPI
XA20SRC_SetEffectChain(IXAudio20SourceVoice
*iface
,
151 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
153 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
154 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
157 static HRESULT WINAPI
XA20SRC_EnableEffect(IXAudio20SourceVoice
*iface
,
158 UINT32 EffectIndex
, UINT32 OperationSet
)
160 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
161 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
,
162 EffectIndex
, OperationSet
);
165 static HRESULT WINAPI
XA20SRC_DisableEffect(IXAudio20SourceVoice
*iface
,
166 UINT32 EffectIndex
, UINT32 OperationSet
)
168 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
169 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
,
170 EffectIndex
, OperationSet
);
173 static void WINAPI
XA20SRC_GetEffectState(IXAudio20SourceVoice
*iface
,
174 UINT32 EffectIndex
, BOOL
*pEnabled
)
176 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
177 return IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
,
178 EffectIndex
, pEnabled
);
181 static HRESULT WINAPI
XA20SRC_SetEffectParameters(IXAudio20SourceVoice
*iface
,
182 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
185 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
186 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
187 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
190 static HRESULT WINAPI
XA20SRC_GetEffectParameters(IXAudio20SourceVoice
*iface
,
191 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
193 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
194 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
195 EffectIndex
, pParameters
, ParametersByteSize
);
198 static HRESULT WINAPI
XA20SRC_SetFilterParameters(IXAudio20SourceVoice
*iface
,
199 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
201 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
202 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
203 pParameters
, OperationSet
);
206 static void WINAPI
XA20SRC_GetFilterParameters(IXAudio20SourceVoice
*iface
,
207 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
209 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
210 return IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
213 static HRESULT WINAPI
XA20SRC_SetVolume(IXAudio20SourceVoice
*iface
,
214 float Volume
, UINT32 OperationSet
)
216 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
217 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
,
218 Volume
, OperationSet
);
221 static void WINAPI
XA20SRC_GetVolume(IXAudio20SourceVoice
*iface
,
224 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
225 return IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
228 static HRESULT WINAPI
XA20SRC_SetChannelVolumes(IXAudio20SourceVoice
*iface
,
229 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
231 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
232 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
233 Channels
, pVolumes
, OperationSet
);
236 static void WINAPI
XA20SRC_GetChannelVolumes(IXAudio20SourceVoice
*iface
,
237 UINT32 Channels
, float *pVolumes
)
239 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
240 return IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
244 static HRESULT WINAPI
XA20SRC_SetOutputMatrix(IXAudio20SourceVoice
*iface
,
245 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
246 UINT32 DestinationChannels
, const float *pLevelMatrix
,
249 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
250 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
251 pDestinationVoice
, SourceChannels
, DestinationChannels
,
252 pLevelMatrix
, OperationSet
);
255 static HRESULT WINAPI
XA20SRC_GetOutputMatrix(IXAudio20SourceVoice
*iface
,
256 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
257 UINT32 DestinationChannels
, float *pLevelMatrix
)
259 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
260 IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
261 pDestinationVoice
, SourceChannels
, DestinationChannels
,
266 static void WINAPI
XA20SRC_DestroyVoice(IXAudio20SourceVoice
*iface
)
268 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
269 return IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
272 static HRESULT WINAPI
XA20SRC_Start(IXAudio20SourceVoice
*iface
, UINT32 Flags
,
275 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
276 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
279 static HRESULT WINAPI
XA20SRC_Stop(IXAudio20SourceVoice
*iface
, UINT32 Flags
,
282 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
283 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
286 static HRESULT WINAPI
XA20SRC_SubmitSourceBuffer(IXAudio20SourceVoice
*iface
,
287 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
289 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
290 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
,
291 pBuffer
, pBufferWMA
);
294 static HRESULT WINAPI
XA20SRC_FlushSourceBuffers(IXAudio20SourceVoice
*iface
)
296 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
297 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
300 static HRESULT WINAPI
XA20SRC_Discontinuity(IXAudio20SourceVoice
*iface
)
302 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
303 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
306 static HRESULT WINAPI
XA20SRC_ExitLoop(IXAudio20SourceVoice
*iface
,
309 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
310 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
313 static void WINAPI
XA20SRC_GetState(IXAudio20SourceVoice
*iface
,
314 XAUDIO2_VOICE_STATE
*pVoiceState
)
316 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
317 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
320 static HRESULT WINAPI
XA20SRC_SetFrequencyRatio(IXAudio20SourceVoice
*iface
,
321 float Ratio
, UINT32 OperationSet
)
323 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
324 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
,
325 Ratio
, OperationSet
);
328 static void WINAPI
XA20SRC_GetFrequencyRatio(IXAudio20SourceVoice
*iface
,
331 XA2SourceImpl
*This
= impl_from_IXAudio20SourceVoice(iface
);
332 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
335 const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl
= {
336 XA20SRC_GetVoiceDetails
,
337 XA20SRC_SetOutputVoices
,
338 XA20SRC_SetEffectChain
,
339 XA20SRC_EnableEffect
,
340 XA20SRC_DisableEffect
,
341 XA20SRC_GetEffectState
,
342 XA20SRC_SetEffectParameters
,
343 XA20SRC_GetEffectParameters
,
344 XA20SRC_SetFilterParameters
,
345 XA20SRC_GetFilterParameters
,
348 XA20SRC_SetChannelVolumes
,
349 XA20SRC_GetChannelVolumes
,
350 XA20SRC_SetOutputMatrix
,
351 XA20SRC_GetOutputMatrix
,
352 XA20SRC_DestroyVoice
,
355 XA20SRC_SubmitSourceBuffer
,
356 XA20SRC_FlushSourceBuffers
,
357 XA20SRC_Discontinuity
,
360 XA20SRC_SetFrequencyRatio
,
361 XA20SRC_GetFrequencyRatio
,
364 #elif XAUDIO2_VER <= 3
366 static XA2SourceImpl
*impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice
*iface
)
368 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio23SourceVoice_iface
);
371 static void WINAPI
XA23SRC_GetVoiceDetails(IXAudio23SourceVoice
*iface
,
372 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
374 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
375 XAUDIO2_VOICE_DETAILS details
;
377 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
379 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
380 pVoiceDetails
->InputChannels
= details
.InputChannels
;
381 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
384 static HRESULT WINAPI
XA23SRC_SetOutputVoices(IXAudio23SourceVoice
*iface
,
385 const XAUDIO23_VOICE_SENDS
*pSendList
)
387 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
388 XAUDIO2_VOICE_SENDS sends
;
392 TRACE("%p, %p\n", This
, pSendList
);
394 sends
.SendCount
= pSendList
->OutputCount
;
395 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
396 for(i
= 0; i
< sends
.SendCount
; ++i
){
397 sends
.pSends
[i
].Flags
= 0;
398 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
401 hr
= IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, &sends
);
403 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
408 static HRESULT WINAPI
XA23SRC_SetEffectChain(IXAudio23SourceVoice
*iface
,
409 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
411 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
412 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
415 static HRESULT WINAPI
XA23SRC_EnableEffect(IXAudio23SourceVoice
*iface
,
416 UINT32 EffectIndex
, UINT32 OperationSet
)
418 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
419 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
,
420 EffectIndex
, OperationSet
);
423 static HRESULT WINAPI
XA23SRC_DisableEffect(IXAudio23SourceVoice
*iface
,
424 UINT32 EffectIndex
, UINT32 OperationSet
)
426 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
427 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
,
428 EffectIndex
, OperationSet
);
431 static void WINAPI
XA23SRC_GetEffectState(IXAudio23SourceVoice
*iface
,
432 UINT32 EffectIndex
, BOOL
*pEnabled
)
434 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
435 return IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
,
436 EffectIndex
, pEnabled
);
439 static HRESULT WINAPI
XA23SRC_SetEffectParameters(IXAudio23SourceVoice
*iface
,
440 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
443 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
444 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
445 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
448 static HRESULT WINAPI
XA23SRC_GetEffectParameters(IXAudio23SourceVoice
*iface
,
449 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
451 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
452 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
453 EffectIndex
, pParameters
, ParametersByteSize
);
456 static HRESULT WINAPI
XA23SRC_SetFilterParameters(IXAudio23SourceVoice
*iface
,
457 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
459 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
460 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
461 pParameters
, OperationSet
);
464 static void WINAPI
XA23SRC_GetFilterParameters(IXAudio23SourceVoice
*iface
,
465 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
467 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
468 return IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
471 static HRESULT WINAPI
XA23SRC_SetVolume(IXAudio23SourceVoice
*iface
,
472 float Volume
, UINT32 OperationSet
)
474 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
475 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
,
476 Volume
, OperationSet
);
479 static void WINAPI
XA23SRC_GetVolume(IXAudio23SourceVoice
*iface
,
482 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
483 return IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
486 static HRESULT WINAPI
XA23SRC_SetChannelVolumes(IXAudio23SourceVoice
*iface
,
487 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
489 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
490 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
491 Channels
, pVolumes
, OperationSet
);
494 static void WINAPI
XA23SRC_GetChannelVolumes(IXAudio23SourceVoice
*iface
,
495 UINT32 Channels
, float *pVolumes
)
497 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
498 return IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
,
502 static HRESULT WINAPI
XA23SRC_SetOutputMatrix(IXAudio23SourceVoice
*iface
,
503 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
504 UINT32 DestinationChannels
, const float *pLevelMatrix
,
507 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
508 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
509 pDestinationVoice
, SourceChannels
, DestinationChannels
,
510 pLevelMatrix
, OperationSet
);
513 static void WINAPI
XA23SRC_GetOutputMatrix(IXAudio23SourceVoice
*iface
,
514 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
515 UINT32 DestinationChannels
, float *pLevelMatrix
)
517 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
518 return IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
519 pDestinationVoice
, SourceChannels
, DestinationChannels
,
523 static void WINAPI
XA23SRC_DestroyVoice(IXAudio23SourceVoice
*iface
)
525 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
526 return IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
529 static HRESULT WINAPI
XA23SRC_Start(IXAudio23SourceVoice
*iface
, UINT32 Flags
,
532 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
533 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
536 static HRESULT WINAPI
XA23SRC_Stop(IXAudio23SourceVoice
*iface
, UINT32 Flags
,
539 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
540 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
543 static HRESULT WINAPI
XA23SRC_SubmitSourceBuffer(IXAudio23SourceVoice
*iface
,
544 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
546 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
547 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
,
548 pBuffer
, pBufferWMA
);
551 static HRESULT WINAPI
XA23SRC_FlushSourceBuffers(IXAudio23SourceVoice
*iface
)
553 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
554 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
557 static HRESULT WINAPI
XA23SRC_Discontinuity(IXAudio23SourceVoice
*iface
)
559 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
560 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
563 static HRESULT WINAPI
XA23SRC_ExitLoop(IXAudio23SourceVoice
*iface
,
566 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
567 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
570 static void WINAPI
XA23SRC_GetState(IXAudio23SourceVoice
*iface
,
571 XAUDIO2_VOICE_STATE
*pVoiceState
)
573 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
574 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
577 static HRESULT WINAPI
XA23SRC_SetFrequencyRatio(IXAudio23SourceVoice
*iface
,
578 float Ratio
, UINT32 OperationSet
)
580 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
581 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
,
582 Ratio
, OperationSet
);
585 static void WINAPI
XA23SRC_GetFrequencyRatio(IXAudio23SourceVoice
*iface
,
588 XA2SourceImpl
*This
= impl_from_IXAudio23SourceVoice(iface
);
589 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
592 const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl
= {
593 XA23SRC_GetVoiceDetails
,
594 XA23SRC_SetOutputVoices
,
595 XA23SRC_SetEffectChain
,
596 XA23SRC_EnableEffect
,
597 XA23SRC_DisableEffect
,
598 XA23SRC_GetEffectState
,
599 XA23SRC_SetEffectParameters
,
600 XA23SRC_GetEffectParameters
,
601 XA23SRC_SetFilterParameters
,
602 XA23SRC_GetFilterParameters
,
605 XA23SRC_SetChannelVolumes
,
606 XA23SRC_GetChannelVolumes
,
607 XA23SRC_SetOutputMatrix
,
608 XA23SRC_GetOutputMatrix
,
609 XA23SRC_DestroyVoice
,
612 XA23SRC_SubmitSourceBuffer
,
613 XA23SRC_FlushSourceBuffers
,
614 XA23SRC_Discontinuity
,
617 XA23SRC_SetFrequencyRatio
,
618 XA23SRC_GetFrequencyRatio
,
621 #elif XAUDIO2_VER <= 7
623 static XA2SourceImpl
*impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice
*iface
)
625 return CONTAINING_RECORD(iface
, XA2SourceImpl
, IXAudio27SourceVoice_iface
);
628 static void WINAPI
XA27SRC_GetVoiceDetails(IXAudio27SourceVoice
*iface
,
629 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
631 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
632 XAUDIO2_VOICE_DETAILS details
;
634 IXAudio2SourceVoice_GetVoiceDetails(&This
->IXAudio2SourceVoice_iface
, &details
);
636 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
637 pVoiceDetails
->InputChannels
= details
.InputChannels
;
638 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
641 static HRESULT WINAPI
XA27SRC_SetOutputVoices(IXAudio27SourceVoice
*iface
,
642 const XAUDIO2_VOICE_SENDS
*pSendList
)
644 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
645 return IXAudio2SourceVoice_SetOutputVoices(&This
->IXAudio2SourceVoice_iface
, pSendList
);
648 static HRESULT WINAPI
XA27SRC_SetEffectChain(IXAudio27SourceVoice
*iface
,
649 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
651 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
652 return IXAudio2SourceVoice_SetEffectChain(&This
->IXAudio2SourceVoice_iface
, pEffectChain
);
655 static HRESULT WINAPI
XA27SRC_EnableEffect(IXAudio27SourceVoice
*iface
,
656 UINT32 EffectIndex
, UINT32 OperationSet
)
658 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
659 return IXAudio2SourceVoice_EnableEffect(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, OperationSet
);
662 static HRESULT WINAPI
XA27SRC_DisableEffect(IXAudio27SourceVoice
*iface
,
663 UINT32 EffectIndex
, UINT32 OperationSet
)
665 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
666 return IXAudio2SourceVoice_DisableEffect(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, OperationSet
);
669 static void WINAPI
XA27SRC_GetEffectState(IXAudio27SourceVoice
*iface
,
670 UINT32 EffectIndex
, BOOL
*pEnabled
)
672 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
673 IXAudio2SourceVoice_GetEffectState(&This
->IXAudio2SourceVoice_iface
, EffectIndex
, pEnabled
);
676 static HRESULT WINAPI
XA27SRC_SetEffectParameters(IXAudio27SourceVoice
*iface
,
677 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
680 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
681 return IXAudio2SourceVoice_SetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
682 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
685 static HRESULT WINAPI
XA27SRC_GetEffectParameters(IXAudio27SourceVoice
*iface
,
686 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
688 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
689 return IXAudio2SourceVoice_GetEffectParameters(&This
->IXAudio2SourceVoice_iface
,
690 EffectIndex
, pParameters
, ParametersByteSize
);
693 static HRESULT WINAPI
XA27SRC_SetFilterParameters(IXAudio27SourceVoice
*iface
,
694 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
696 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
697 return IXAudio2SourceVoice_SetFilterParameters(&This
->IXAudio2SourceVoice_iface
,
698 pParameters
, OperationSet
);
701 static void WINAPI
XA27SRC_GetFilterParameters(IXAudio27SourceVoice
*iface
,
702 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
704 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
705 IXAudio2SourceVoice_GetFilterParameters(&This
->IXAudio2SourceVoice_iface
, pParameters
);
708 static HRESULT WINAPI
XA27SRC_SetOutputFilterParameters(IXAudio27SourceVoice
*iface
,
709 IXAudio2Voice
*pDestinationVoice
,
710 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
712 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
713 return IXAudio2SourceVoice_SetOutputFilterParameters(&This
->IXAudio2SourceVoice_iface
,
714 pDestinationVoice
, pParameters
, OperationSet
);
717 static void WINAPI
XA27SRC_GetOutputFilterParameters(IXAudio27SourceVoice
*iface
,
718 IXAudio2Voice
*pDestinationVoice
,
719 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
721 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
722 IXAudio2SourceVoice_GetOutputFilterParameters(&This
->IXAudio2SourceVoice_iface
,
723 pDestinationVoice
, pParameters
);
726 static HRESULT WINAPI
XA27SRC_SetVolume(IXAudio27SourceVoice
*iface
, float Volume
,
729 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
730 return IXAudio2SourceVoice_SetVolume(&This
->IXAudio2SourceVoice_iface
, Volume
,
734 static void WINAPI
XA27SRC_GetVolume(IXAudio27SourceVoice
*iface
, float *pVolume
)
736 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
737 IXAudio2SourceVoice_GetVolume(&This
->IXAudio2SourceVoice_iface
, pVolume
);
740 static HRESULT WINAPI
XA27SRC_SetChannelVolumes(IXAudio27SourceVoice
*iface
,
741 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
743 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
744 return IXAudio2SourceVoice_SetChannelVolumes(&This
->IXAudio2SourceVoice_iface
, Channels
,
745 pVolumes
, OperationSet
);
748 static void WINAPI
XA27SRC_GetChannelVolumes(IXAudio27SourceVoice
*iface
,
749 UINT32 Channels
, float *pVolumes
)
751 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
752 IXAudio2SourceVoice_GetChannelVolumes(&This
->IXAudio2SourceVoice_iface
, Channels
,
756 static HRESULT WINAPI
XA27SRC_SetOutputMatrix(IXAudio27SourceVoice
*iface
,
757 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
758 UINT32 DestinationChannels
, const float *pLevelMatrix
,
761 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
762 return IXAudio2SourceVoice_SetOutputMatrix(&This
->IXAudio2SourceVoice_iface
,
763 pDestinationVoice
, SourceChannels
, DestinationChannels
,
764 pLevelMatrix
, OperationSet
);
767 static void WINAPI
XA27SRC_GetOutputMatrix(IXAudio27SourceVoice
*iface
,
768 IXAudio2Voice
*pDestinationVoice
, UINT32 SourceChannels
,
769 UINT32 DestinationChannels
, float *pLevelMatrix
)
771 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
772 IXAudio2SourceVoice_GetOutputMatrix(&This
->IXAudio2SourceVoice_iface
, pDestinationVoice
,
773 SourceChannels
, DestinationChannels
, pLevelMatrix
);
776 static void WINAPI
XA27SRC_DestroyVoice(IXAudio27SourceVoice
*iface
)
778 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
779 IXAudio2SourceVoice_DestroyVoice(&This
->IXAudio2SourceVoice_iface
);
782 static HRESULT WINAPI
XA27SRC_Start(IXAudio27SourceVoice
*iface
, UINT32 Flags
,
785 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
786 return IXAudio2SourceVoice_Start(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
789 static HRESULT WINAPI
XA27SRC_Stop(IXAudio27SourceVoice
*iface
, UINT32 Flags
,
792 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
793 return IXAudio2SourceVoice_Stop(&This
->IXAudio2SourceVoice_iface
, Flags
, OperationSet
);
796 static HRESULT WINAPI
XA27SRC_SubmitSourceBuffer(IXAudio27SourceVoice
*iface
,
797 const XAUDIO2_BUFFER
*pBuffer
, const XAUDIO2_BUFFER_WMA
*pBufferWMA
)
799 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
800 return IXAudio2SourceVoice_SubmitSourceBuffer(&This
->IXAudio2SourceVoice_iface
, pBuffer
,
804 static HRESULT WINAPI
XA27SRC_FlushSourceBuffers(IXAudio27SourceVoice
*iface
)
806 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
807 return IXAudio2SourceVoice_FlushSourceBuffers(&This
->IXAudio2SourceVoice_iface
);
810 static HRESULT WINAPI
XA27SRC_Discontinuity(IXAudio27SourceVoice
*iface
)
812 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
813 return IXAudio2SourceVoice_Discontinuity(&This
->IXAudio2SourceVoice_iface
);
816 static HRESULT WINAPI
XA27SRC_ExitLoop(IXAudio27SourceVoice
*iface
, UINT32 OperationSet
)
818 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
819 return IXAudio2SourceVoice_ExitLoop(&This
->IXAudio2SourceVoice_iface
, OperationSet
);
822 static void WINAPI
XA27SRC_GetState(IXAudio27SourceVoice
*iface
,
823 XAUDIO2_VOICE_STATE
*pVoiceState
)
825 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
826 return IXAudio2SourceVoice_GetState(&This
->IXAudio2SourceVoice_iface
, pVoiceState
, 0);
829 static HRESULT WINAPI
XA27SRC_SetFrequencyRatio(IXAudio27SourceVoice
*iface
,
830 float Ratio
, UINT32 OperationSet
)
832 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
833 return IXAudio2SourceVoice_SetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, Ratio
, OperationSet
);
836 static void WINAPI
XA27SRC_GetFrequencyRatio(IXAudio27SourceVoice
*iface
, float *pRatio
)
838 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
839 return IXAudio2SourceVoice_GetFrequencyRatio(&This
->IXAudio2SourceVoice_iface
, pRatio
);
842 static HRESULT WINAPI
XA27SRC_SetSourceSampleRate(
843 IXAudio27SourceVoice
*iface
,
844 UINT32 NewSourceSampleRate
)
846 XA2SourceImpl
*This
= impl_from_IXAudio27SourceVoice(iface
);
847 return IXAudio2SourceVoice_SetSourceSampleRate(&This
->IXAudio2SourceVoice_iface
, NewSourceSampleRate
);
850 const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl
= {
851 XA27SRC_GetVoiceDetails
,
852 XA27SRC_SetOutputVoices
,
853 XA27SRC_SetEffectChain
,
854 XA27SRC_EnableEffect
,
855 XA27SRC_DisableEffect
,
856 XA27SRC_GetEffectState
,
857 XA27SRC_SetEffectParameters
,
858 XA27SRC_GetEffectParameters
,
859 XA27SRC_SetFilterParameters
,
860 XA27SRC_GetFilterParameters
,
861 XA27SRC_SetOutputFilterParameters
,
862 XA27SRC_GetOutputFilterParameters
,
865 XA27SRC_SetChannelVolumes
,
866 XA27SRC_GetChannelVolumes
,
867 XA27SRC_SetOutputMatrix
,
868 XA27SRC_GetOutputMatrix
,
869 XA27SRC_DestroyVoice
,
872 XA27SRC_SubmitSourceBuffer
,
873 XA27SRC_FlushSourceBuffers
,
874 XA27SRC_Discontinuity
,
877 XA27SRC_SetFrequencyRatio
,
878 XA27SRC_GetFrequencyRatio
,
879 XA27SRC_SetSourceSampleRate
882 /* END IXAudio2SourceVoice */
885 /* BEGIN IXAudio2SubmixVoice */
887 static XA2SubmixImpl
*impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice
*iface
)
889 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio20SubmixVoice_iface
);
892 static void WINAPI
XA20SUB_GetVoiceDetails(IXAudio20SubmixVoice
*iface
,
893 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
895 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
896 XAUDIO2_VOICE_DETAILS details
;
898 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
900 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
901 pVoiceDetails
->InputChannels
= details
.InputChannels
;
902 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
905 static HRESULT WINAPI
XA20SUB_SetOutputVoices(IXAudio20SubmixVoice
*iface
,
906 const XAUDIO23_VOICE_SENDS
*pSendList
)
908 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
909 XAUDIO2_VOICE_SENDS sends
;
913 TRACE("%p, %p\n", This
, pSendList
);
915 sends
.SendCount
= pSendList
->OutputCount
;
916 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
917 for(i
= 0; i
< sends
.SendCount
; ++i
){
918 sends
.pSends
[i
].Flags
= 0;
919 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
922 hr
= IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, &sends
);
924 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
929 static HRESULT WINAPI
XA20SUB_SetEffectChain(IXAudio20SubmixVoice
*iface
,
930 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
932 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
933 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
936 static HRESULT WINAPI
XA20SUB_EnableEffect(IXAudio20SubmixVoice
*iface
,
937 UINT32 EffectIndex
, UINT32 OperationSet
)
939 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
940 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
941 EffectIndex
, OperationSet
);
944 static HRESULT WINAPI
XA20SUB_DisableEffect(IXAudio20SubmixVoice
*iface
,
945 UINT32 EffectIndex
, UINT32 OperationSet
)
947 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
948 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
949 EffectIndex
, OperationSet
);
952 static void WINAPI
XA20SUB_GetEffectState(IXAudio20SubmixVoice
*iface
,
953 UINT32 EffectIndex
, BOOL
*pEnabled
)
955 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
956 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
957 EffectIndex
, pEnabled
);
960 static HRESULT WINAPI
XA20SUB_SetEffectParameters(IXAudio20SubmixVoice
*iface
,
961 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
964 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
965 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
966 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
969 static HRESULT WINAPI
XA20SUB_GetEffectParameters(IXAudio20SubmixVoice
*iface
,
970 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
972 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
973 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
974 EffectIndex
, pParameters
, ParametersByteSize
);
977 static HRESULT WINAPI
XA20SUB_SetFilterParameters(IXAudio20SubmixVoice
*iface
,
978 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
980 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
981 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
982 pParameters
, OperationSet
);
985 static void WINAPI
XA20SUB_GetFilterParameters(IXAudio20SubmixVoice
*iface
,
986 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
988 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
989 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
992 static HRESULT WINAPI
XA20SUB_SetVolume(IXAudio20SubmixVoice
*iface
,
993 float Volume
, UINT32 OperationSet
)
995 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
996 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
997 Volume
, OperationSet
);
1000 static void WINAPI
XA20SUB_GetVolume(IXAudio20SubmixVoice
*iface
,
1003 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1004 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1007 static HRESULT WINAPI
XA20SUB_SetChannelVolumes(IXAudio20SubmixVoice
*iface
,
1008 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1010 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1011 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1012 Channels
, pVolumes
, OperationSet
);
1015 static void WINAPI
XA20SUB_GetChannelVolumes(IXAudio20SubmixVoice
*iface
,
1016 UINT32 Channels
, float *pVolumes
)
1018 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1019 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1020 Channels
, pVolumes
);
1023 static HRESULT WINAPI
XA20SUB_SetOutputMatrix(IXAudio20SubmixVoice
*iface
,
1024 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1025 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1026 UINT32 OperationSet
)
1028 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1029 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1030 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1031 pLevelMatrix
, OperationSet
);
1034 static HRESULT WINAPI
XA20SUB_GetOutputMatrix(IXAudio20SubmixVoice
*iface
,
1035 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1036 UINT32 DestinationChannels
, float *pLevelMatrix
)
1038 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1039 IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1040 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1045 static void WINAPI
XA20SUB_DestroyVoice(IXAudio20SubmixVoice
*iface
)
1047 XA2SubmixImpl
*This
= impl_from_IXAudio20SubmixVoice(iface
);
1048 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1051 const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl
= {
1052 XA20SUB_GetVoiceDetails
,
1053 XA20SUB_SetOutputVoices
,
1054 XA20SUB_SetEffectChain
,
1055 XA20SUB_EnableEffect
,
1056 XA20SUB_DisableEffect
,
1057 XA20SUB_GetEffectState
,
1058 XA20SUB_SetEffectParameters
,
1059 XA20SUB_GetEffectParameters
,
1060 XA20SUB_SetFilterParameters
,
1061 XA20SUB_GetFilterParameters
,
1064 XA20SUB_SetChannelVolumes
,
1065 XA20SUB_GetChannelVolumes
,
1066 XA20SUB_SetOutputMatrix
,
1067 XA20SUB_GetOutputMatrix
,
1068 XA20SUB_DestroyVoice
1071 #elif XAUDIO2_VER <= 3
1073 static XA2SubmixImpl
*impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice
*iface
)
1075 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio23SubmixVoice_iface
);
1078 static void WINAPI
XA23SUB_GetVoiceDetails(IXAudio23SubmixVoice
*iface
,
1079 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1081 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1082 XAUDIO2_VOICE_DETAILS details
;
1084 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
1086 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1087 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1088 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1091 static HRESULT WINAPI
XA23SUB_SetOutputVoices(IXAudio23SubmixVoice
*iface
,
1092 const XAUDIO23_VOICE_SENDS
*pSendList
)
1094 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1095 XAUDIO2_VOICE_SENDS sends
;
1099 TRACE("%p, %p\n", This
, pSendList
);
1101 sends
.SendCount
= pSendList
->OutputCount
;
1102 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1103 for(i
= 0; i
< sends
.SendCount
; ++i
){
1104 sends
.pSends
[i
].Flags
= 0;
1105 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1108 hr
= IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, &sends
);
1110 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1115 static HRESULT WINAPI
XA23SUB_SetEffectChain(IXAudio23SubmixVoice
*iface
,
1116 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1118 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1119 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
1122 static HRESULT WINAPI
XA23SUB_EnableEffect(IXAudio23SubmixVoice
*iface
,
1123 UINT32 EffectIndex
, UINT32 OperationSet
)
1125 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1126 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
1127 EffectIndex
, OperationSet
);
1130 static HRESULT WINAPI
XA23SUB_DisableEffect(IXAudio23SubmixVoice
*iface
,
1131 UINT32 EffectIndex
, UINT32 OperationSet
)
1133 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1134 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
1135 EffectIndex
, OperationSet
);
1138 static void WINAPI
XA23SUB_GetEffectState(IXAudio23SubmixVoice
*iface
,
1139 UINT32 EffectIndex
, BOOL
*pEnabled
)
1141 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1142 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
1143 EffectIndex
, pEnabled
);
1146 static HRESULT WINAPI
XA23SUB_SetEffectParameters(IXAudio23SubmixVoice
*iface
,
1147 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1148 UINT32 OperationSet
)
1150 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1151 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1152 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1155 static HRESULT WINAPI
XA23SUB_GetEffectParameters(IXAudio23SubmixVoice
*iface
,
1156 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1158 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1159 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1160 EffectIndex
, pParameters
, ParametersByteSize
);
1163 static HRESULT WINAPI
XA23SUB_SetFilterParameters(IXAudio23SubmixVoice
*iface
,
1164 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1166 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1167 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1168 pParameters
, OperationSet
);
1171 static void WINAPI
XA23SUB_GetFilterParameters(IXAudio23SubmixVoice
*iface
,
1172 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1174 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1175 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
1178 static HRESULT WINAPI
XA23SUB_SetVolume(IXAudio23SubmixVoice
*iface
,
1179 float Volume
, UINT32 OperationSet
)
1181 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1182 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
1183 Volume
, OperationSet
);
1186 static void WINAPI
XA23SUB_GetVolume(IXAudio23SubmixVoice
*iface
,
1189 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1190 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1193 static HRESULT WINAPI
XA23SUB_SetChannelVolumes(IXAudio23SubmixVoice
*iface
,
1194 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1196 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1197 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1198 Channels
, pVolumes
, OperationSet
);
1201 static void WINAPI
XA23SUB_GetChannelVolumes(IXAudio23SubmixVoice
*iface
,
1202 UINT32 Channels
, float *pVolumes
)
1204 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1205 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1206 Channels
, pVolumes
);
1209 static HRESULT WINAPI
XA23SUB_SetOutputMatrix(IXAudio23SubmixVoice
*iface
,
1210 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1211 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1212 UINT32 OperationSet
)
1214 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1215 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1216 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1217 pLevelMatrix
, OperationSet
);
1220 static void WINAPI
XA23SUB_GetOutputMatrix(IXAudio23SubmixVoice
*iface
,
1221 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1222 UINT32 DestinationChannels
, float *pLevelMatrix
)
1224 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1225 return IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1226 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1230 static void WINAPI
XA23SUB_DestroyVoice(IXAudio23SubmixVoice
*iface
)
1232 XA2SubmixImpl
*This
= impl_from_IXAudio23SubmixVoice(iface
);
1233 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1236 const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl
= {
1237 XA23SUB_GetVoiceDetails
,
1238 XA23SUB_SetOutputVoices
,
1239 XA23SUB_SetEffectChain
,
1240 XA23SUB_EnableEffect
,
1241 XA23SUB_DisableEffect
,
1242 XA23SUB_GetEffectState
,
1243 XA23SUB_SetEffectParameters
,
1244 XA23SUB_GetEffectParameters
,
1245 XA23SUB_SetFilterParameters
,
1246 XA23SUB_GetFilterParameters
,
1249 XA23SUB_SetChannelVolumes
,
1250 XA23SUB_GetChannelVolumes
,
1251 XA23SUB_SetOutputMatrix
,
1252 XA23SUB_GetOutputMatrix
,
1253 XA23SUB_DestroyVoice
1256 #elif XAUDIO2_VER <= 7
1258 static XA2SubmixImpl
*impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice
*iface
)
1260 return CONTAINING_RECORD(iface
, XA2SubmixImpl
, IXAudio27SubmixVoice_iface
);
1263 static void WINAPI
XA27SUB_GetVoiceDetails(IXAudio27SubmixVoice
*iface
,
1264 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1266 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1267 XAUDIO2_VOICE_DETAILS details
;
1269 IXAudio2SubmixVoice_GetVoiceDetails(&This
->IXAudio2SubmixVoice_iface
, &details
);
1271 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1272 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1273 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1276 static HRESULT WINAPI
XA27SUB_SetOutputVoices(IXAudio27SubmixVoice
*iface
,
1277 const XAUDIO2_VOICE_SENDS
*pSendList
)
1279 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1280 return IXAudio2SubmixVoice_SetOutputVoices(&This
->IXAudio2SubmixVoice_iface
, pSendList
);
1283 static HRESULT WINAPI
XA27SUB_SetEffectChain(IXAudio27SubmixVoice
*iface
,
1284 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1286 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1287 return IXAudio2SubmixVoice_SetEffectChain(&This
->IXAudio2SubmixVoice_iface
, pEffectChain
);
1290 static HRESULT WINAPI
XA27SUB_EnableEffect(IXAudio27SubmixVoice
*iface
,
1291 UINT32 EffectIndex
, UINT32 OperationSet
)
1293 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1294 return IXAudio2SubmixVoice_EnableEffect(&This
->IXAudio2SubmixVoice_iface
,
1295 EffectIndex
, OperationSet
);
1298 static HRESULT WINAPI
XA27SUB_DisableEffect(IXAudio27SubmixVoice
*iface
,
1299 UINT32 EffectIndex
, UINT32 OperationSet
)
1301 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1302 return IXAudio2SubmixVoice_DisableEffect(&This
->IXAudio2SubmixVoice_iface
,
1303 EffectIndex
, OperationSet
);
1306 static void WINAPI
XA27SUB_GetEffectState(IXAudio27SubmixVoice
*iface
,
1307 UINT32 EffectIndex
, BOOL
*pEnabled
)
1309 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1310 return IXAudio2SubmixVoice_GetEffectState(&This
->IXAudio2SubmixVoice_iface
,
1311 EffectIndex
, pEnabled
);
1314 static HRESULT WINAPI
XA27SUB_SetEffectParameters(IXAudio27SubmixVoice
*iface
,
1315 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1316 UINT32 OperationSet
)
1318 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1319 return IXAudio2SubmixVoice_SetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1320 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1323 static HRESULT WINAPI
XA27SUB_GetEffectParameters(IXAudio27SubmixVoice
*iface
,
1324 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1326 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1327 return IXAudio2SubmixVoice_GetEffectParameters(&This
->IXAudio2SubmixVoice_iface
,
1328 EffectIndex
, pParameters
, ParametersByteSize
);
1331 static HRESULT WINAPI
XA27SUB_SetFilterParameters(IXAudio27SubmixVoice
*iface
,
1332 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1334 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1335 return IXAudio2SubmixVoice_SetFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1336 pParameters
, OperationSet
);
1339 static void WINAPI
XA27SUB_GetFilterParameters(IXAudio27SubmixVoice
*iface
,
1340 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1342 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1343 return IXAudio2SubmixVoice_GetFilterParameters(&This
->IXAudio2SubmixVoice_iface
, pParameters
);
1346 static HRESULT WINAPI
XA27SUB_SetOutputFilterParameters(IXAudio27SubmixVoice
*iface
,
1347 IXAudio2Voice
*pDestinationVoice
,
1348 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1350 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1351 return IXAudio2SubmixVoice_SetOutputFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1352 pDestinationVoice
, pParameters
, OperationSet
);
1355 static void WINAPI
XA27SUB_GetOutputFilterParameters(IXAudio27SubmixVoice
*iface
,
1356 IXAudio2Voice
*pDestinationVoice
,
1357 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1359 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1360 IXAudio2SubmixVoice_GetOutputFilterParameters(&This
->IXAudio2SubmixVoice_iface
,
1361 pDestinationVoice
, pParameters
);
1364 static HRESULT WINAPI
XA27SUB_SetVolume(IXAudio27SubmixVoice
*iface
,
1365 float Volume
, UINT32 OperationSet
)
1367 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1368 return IXAudio2SubmixVoice_SetVolume(&This
->IXAudio2SubmixVoice_iface
,
1369 Volume
, OperationSet
);
1372 static void WINAPI
XA27SUB_GetVolume(IXAudio27SubmixVoice
*iface
,
1375 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1376 return IXAudio2SubmixVoice_GetVolume(&This
->IXAudio2SubmixVoice_iface
, pVolume
);
1379 static HRESULT WINAPI
XA27SUB_SetChannelVolumes(IXAudio27SubmixVoice
*iface
,
1380 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1382 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1383 return IXAudio2SubmixVoice_SetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1384 Channels
, pVolumes
, OperationSet
);
1387 static void WINAPI
XA27SUB_GetChannelVolumes(IXAudio27SubmixVoice
*iface
,
1388 UINT32 Channels
, float *pVolumes
)
1390 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1391 return IXAudio2SubmixVoice_GetChannelVolumes(&This
->IXAudio2SubmixVoice_iface
,
1392 Channels
, pVolumes
);
1395 static HRESULT WINAPI
XA27SUB_SetOutputMatrix(IXAudio27SubmixVoice
*iface
,
1396 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1397 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1398 UINT32 OperationSet
)
1400 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1401 return IXAudio2SubmixVoice_SetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1402 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1403 pLevelMatrix
, OperationSet
);
1406 static void WINAPI
XA27SUB_GetOutputMatrix(IXAudio27SubmixVoice
*iface
,
1407 IXAudio2Voice
*pDestinationVoice
, UINT32 SubmixChannels
,
1408 UINT32 DestinationChannels
, float *pLevelMatrix
)
1410 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1411 return IXAudio2SubmixVoice_GetOutputMatrix(&This
->IXAudio2SubmixVoice_iface
,
1412 pDestinationVoice
, SubmixChannels
, DestinationChannels
,
1416 static void WINAPI
XA27SUB_DestroyVoice(IXAudio27SubmixVoice
*iface
)
1418 XA2SubmixImpl
*This
= impl_from_IXAudio27SubmixVoice(iface
);
1419 return IXAudio2SubmixVoice_DestroyVoice(&This
->IXAudio2SubmixVoice_iface
);
1422 const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl
= {
1423 XA27SUB_GetVoiceDetails
,
1424 XA27SUB_SetOutputVoices
,
1425 XA27SUB_SetEffectChain
,
1426 XA27SUB_EnableEffect
,
1427 XA27SUB_DisableEffect
,
1428 XA27SUB_GetEffectState
,
1429 XA27SUB_SetEffectParameters
,
1430 XA27SUB_GetEffectParameters
,
1431 XA27SUB_SetFilterParameters
,
1432 XA27SUB_GetFilterParameters
,
1433 XA27SUB_SetOutputFilterParameters
,
1434 XA27SUB_GetOutputFilterParameters
,
1437 XA27SUB_SetChannelVolumes
,
1438 XA27SUB_GetChannelVolumes
,
1439 XA27SUB_SetOutputMatrix
,
1440 XA27SUB_GetOutputMatrix
,
1441 XA27SUB_DestroyVoice
1444 /* END IXAudio2SubmixVoice */
1447 /* BEGIN IXAudio2MasteringVoice */
1448 #if XAUDIO2_VER == 0
1449 static IXAudio2Impl
*impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice
*iface
)
1451 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio20MasteringVoice_iface
);
1454 static void WINAPI
XA20M_GetVoiceDetails(IXAudio20MasteringVoice
*iface
,
1455 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1457 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1458 XAUDIO2_VOICE_DETAILS details
;
1460 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1462 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1463 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1464 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1467 static HRESULT WINAPI
XA20M_SetOutputVoices(IXAudio20MasteringVoice
*iface
,
1468 const XAUDIO23_VOICE_SENDS
*pSendList
)
1470 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1471 XAUDIO2_VOICE_SENDS sends
;
1475 TRACE("%p, %p\n", This
, pSendList
);
1477 sends
.SendCount
= pSendList
->OutputCount
;
1478 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1479 for(i
= 0; i
< sends
.SendCount
; ++i
){
1480 sends
.pSends
[i
].Flags
= 0;
1481 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1484 hr
= IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, &sends
);
1486 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1491 static HRESULT WINAPI
XA20M_SetEffectChain(IXAudio20MasteringVoice
*iface
,
1492 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1494 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1495 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1498 static HRESULT WINAPI
XA20M_EnableEffect(IXAudio20MasteringVoice
*iface
,
1499 UINT32 EffectIndex
, UINT32 OperationSet
)
1501 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1502 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1503 EffectIndex
, OperationSet
);
1506 static HRESULT WINAPI
XA20M_DisableEffect(IXAudio20MasteringVoice
*iface
,
1507 UINT32 EffectIndex
, UINT32 OperationSet
)
1509 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1510 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1511 EffectIndex
, OperationSet
);
1514 static void WINAPI
XA20M_GetEffectState(IXAudio20MasteringVoice
*iface
,
1515 UINT32 EffectIndex
, BOOL
*pEnabled
)
1517 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1518 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1519 EffectIndex
, pEnabled
);
1522 static HRESULT WINAPI
XA20M_SetEffectParameters(IXAudio20MasteringVoice
*iface
,
1523 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1524 UINT32 OperationSet
)
1526 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1527 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1528 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1531 static HRESULT WINAPI
XA20M_GetEffectParameters(IXAudio20MasteringVoice
*iface
,
1532 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1534 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1535 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1536 EffectIndex
, pParameters
, ParametersByteSize
);
1539 static HRESULT WINAPI
XA20M_SetFilterParameters(IXAudio20MasteringVoice
*iface
,
1540 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1542 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1543 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1544 pParameters
, OperationSet
);
1547 static void WINAPI
XA20M_GetFilterParameters(IXAudio20MasteringVoice
*iface
,
1548 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1550 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1551 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1554 static HRESULT WINAPI
XA20M_SetVolume(IXAudio20MasteringVoice
*iface
,
1555 float Volume
, UINT32 OperationSet
)
1557 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1558 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1559 Volume
, OperationSet
);
1562 static void WINAPI
XA20M_GetVolume(IXAudio20MasteringVoice
*iface
,
1565 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1566 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1569 static HRESULT WINAPI
XA20M_SetChannelVolumes(IXAudio20MasteringVoice
*iface
,
1570 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1572 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1573 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1574 Channels
, pVolumes
, OperationSet
);
1577 static void WINAPI
XA20M_GetChannelVolumes(IXAudio20MasteringVoice
*iface
,
1578 UINT32 Channels
, float *pVolumes
)
1580 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1581 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1582 Channels
, pVolumes
);
1585 static HRESULT WINAPI
XA20M_SetOutputMatrix(IXAudio20MasteringVoice
*iface
,
1586 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1587 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1588 UINT32 OperationSet
)
1590 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1591 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1592 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1593 pLevelMatrix
, OperationSet
);
1596 static HRESULT WINAPI
XA20M_GetOutputMatrix(IXAudio20MasteringVoice
*iface
,
1597 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1598 UINT32 DestinationChannels
, float *pLevelMatrix
)
1600 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1601 IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1602 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1607 static void WINAPI
XA20M_DestroyVoice(IXAudio20MasteringVoice
*iface
)
1609 IXAudio2Impl
*This
= impl_from_IXAudio20MasteringVoice(iface
);
1610 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1613 const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl
= {
1614 XA20M_GetVoiceDetails
,
1615 XA20M_SetOutputVoices
,
1616 XA20M_SetEffectChain
,
1618 XA20M_DisableEffect
,
1619 XA20M_GetEffectState
,
1620 XA20M_SetEffectParameters
,
1621 XA20M_GetEffectParameters
,
1622 XA20M_SetFilterParameters
,
1623 XA20M_GetFilterParameters
,
1626 XA20M_SetChannelVolumes
,
1627 XA20M_GetChannelVolumes
,
1628 XA20M_SetOutputMatrix
,
1629 XA20M_GetOutputMatrix
,
1633 #elif XAUDIO2_VER <= 3
1635 static IXAudio2Impl
*impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice
*iface
)
1637 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio23MasteringVoice_iface
);
1640 static void WINAPI
XA23M_GetVoiceDetails(IXAudio23MasteringVoice
*iface
,
1641 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1643 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1644 XAUDIO2_VOICE_DETAILS details
;
1646 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1648 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1649 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1650 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1653 static HRESULT WINAPI
XA23M_SetOutputVoices(IXAudio23MasteringVoice
*iface
,
1654 const XAUDIO23_VOICE_SENDS
*pSendList
)
1656 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1657 XAUDIO2_VOICE_SENDS sends
;
1661 TRACE("%p, %p\n", This
, pSendList
);
1663 sends
.SendCount
= pSendList
->OutputCount
;
1664 sends
.pSends
= HeapAlloc(GetProcessHeap(), 0, sends
.SendCount
* sizeof(*sends
.pSends
));
1665 for(i
= 0; i
< sends
.SendCount
; ++i
){
1666 sends
.pSends
[i
].Flags
= 0;
1667 sends
.pSends
[i
].pOutputVoice
= pSendList
->pOutputVoices
[i
];
1670 hr
= IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, &sends
);
1672 HeapFree(GetProcessHeap(), 0, sends
.pSends
);
1677 static HRESULT WINAPI
XA23M_SetEffectChain(IXAudio23MasteringVoice
*iface
,
1678 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1680 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1681 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1684 static HRESULT WINAPI
XA23M_EnableEffect(IXAudio23MasteringVoice
*iface
,
1685 UINT32 EffectIndex
, UINT32 OperationSet
)
1687 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1688 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1689 EffectIndex
, OperationSet
);
1692 static HRESULT WINAPI
XA23M_DisableEffect(IXAudio23MasteringVoice
*iface
,
1693 UINT32 EffectIndex
, UINT32 OperationSet
)
1695 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1696 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1697 EffectIndex
, OperationSet
);
1700 static void WINAPI
XA23M_GetEffectState(IXAudio23MasteringVoice
*iface
,
1701 UINT32 EffectIndex
, BOOL
*pEnabled
)
1703 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1704 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1705 EffectIndex
, pEnabled
);
1708 static HRESULT WINAPI
XA23M_SetEffectParameters(IXAudio23MasteringVoice
*iface
,
1709 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1710 UINT32 OperationSet
)
1712 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1713 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1714 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1717 static HRESULT WINAPI
XA23M_GetEffectParameters(IXAudio23MasteringVoice
*iface
,
1718 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1720 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1721 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1722 EffectIndex
, pParameters
, ParametersByteSize
);
1725 static HRESULT WINAPI
XA23M_SetFilterParameters(IXAudio23MasteringVoice
*iface
,
1726 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1728 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1729 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1730 pParameters
, OperationSet
);
1733 static void WINAPI
XA23M_GetFilterParameters(IXAudio23MasteringVoice
*iface
,
1734 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1736 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1737 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1740 static HRESULT WINAPI
XA23M_SetVolume(IXAudio23MasteringVoice
*iface
,
1741 float Volume
, UINT32 OperationSet
)
1743 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1744 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1745 Volume
, OperationSet
);
1748 static void WINAPI
XA23M_GetVolume(IXAudio23MasteringVoice
*iface
,
1751 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1752 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1755 static HRESULT WINAPI
XA23M_SetChannelVolumes(IXAudio23MasteringVoice
*iface
,
1756 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1758 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1759 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1760 Channels
, pVolumes
, OperationSet
);
1763 static void WINAPI
XA23M_GetChannelVolumes(IXAudio23MasteringVoice
*iface
,
1764 UINT32 Channels
, float *pVolumes
)
1766 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1767 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1768 Channels
, pVolumes
);
1771 static HRESULT WINAPI
XA23M_SetOutputMatrix(IXAudio23MasteringVoice
*iface
,
1772 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1773 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1774 UINT32 OperationSet
)
1776 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1777 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1778 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1779 pLevelMatrix
, OperationSet
);
1782 static void WINAPI
XA23M_GetOutputMatrix(IXAudio23MasteringVoice
*iface
,
1783 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1784 UINT32 DestinationChannels
, float *pLevelMatrix
)
1786 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1787 return IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1788 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1792 static void WINAPI
XA23M_DestroyVoice(IXAudio23MasteringVoice
*iface
)
1794 IXAudio2Impl
*This
= impl_from_IXAudio23MasteringVoice(iface
);
1795 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1798 const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl
= {
1799 XA23M_GetVoiceDetails
,
1800 XA23M_SetOutputVoices
,
1801 XA23M_SetEffectChain
,
1803 XA23M_DisableEffect
,
1804 XA23M_GetEffectState
,
1805 XA23M_SetEffectParameters
,
1806 XA23M_GetEffectParameters
,
1807 XA23M_SetFilterParameters
,
1808 XA23M_GetFilterParameters
,
1811 XA23M_SetChannelVolumes
,
1812 XA23M_GetChannelVolumes
,
1813 XA23M_SetOutputMatrix
,
1814 XA23M_GetOutputMatrix
,
1818 #elif XAUDIO2_VER <= 7
1820 static IXAudio2Impl
*impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice
*iface
)
1822 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio27MasteringVoice_iface
);
1825 static void WINAPI
XA27M_GetVoiceDetails(IXAudio27MasteringVoice
*iface
,
1826 XAUDIO27_VOICE_DETAILS
*pVoiceDetails
)
1828 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1829 XAUDIO2_VOICE_DETAILS details
;
1831 IXAudio2MasteringVoice_GetVoiceDetails(&This
->IXAudio2MasteringVoice_iface
, &details
);
1833 pVoiceDetails
->CreationFlags
= details
.CreationFlags
;
1834 pVoiceDetails
->InputChannels
= details
.InputChannels
;
1835 pVoiceDetails
->InputSampleRate
= details
.InputSampleRate
;
1838 static HRESULT WINAPI
XA27M_SetOutputVoices(IXAudio27MasteringVoice
*iface
,
1839 const XAUDIO2_VOICE_SENDS
*pSendList
)
1841 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1842 return IXAudio2MasteringVoice_SetOutputVoices(&This
->IXAudio2MasteringVoice_iface
, pSendList
);
1845 static HRESULT WINAPI
XA27M_SetEffectChain(IXAudio27MasteringVoice
*iface
,
1846 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
1848 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1849 return IXAudio2MasteringVoice_SetEffectChain(&This
->IXAudio2MasteringVoice_iface
, pEffectChain
);
1852 static HRESULT WINAPI
XA27M_EnableEffect(IXAudio27MasteringVoice
*iface
,
1853 UINT32 EffectIndex
, UINT32 OperationSet
)
1855 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1856 return IXAudio2MasteringVoice_EnableEffect(&This
->IXAudio2MasteringVoice_iface
,
1857 EffectIndex
, OperationSet
);
1860 static HRESULT WINAPI
XA27M_DisableEffect(IXAudio27MasteringVoice
*iface
,
1861 UINT32 EffectIndex
, UINT32 OperationSet
)
1863 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1864 return IXAudio2MasteringVoice_DisableEffect(&This
->IXAudio2MasteringVoice_iface
,
1865 EffectIndex
, OperationSet
);
1868 static void WINAPI
XA27M_GetEffectState(IXAudio27MasteringVoice
*iface
,
1869 UINT32 EffectIndex
, BOOL
*pEnabled
)
1871 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1872 return IXAudio2MasteringVoice_GetEffectState(&This
->IXAudio2MasteringVoice_iface
,
1873 EffectIndex
, pEnabled
);
1876 static HRESULT WINAPI
XA27M_SetEffectParameters(IXAudio27MasteringVoice
*iface
,
1877 UINT32 EffectIndex
, const void *pParameters
, UINT32 ParametersByteSize
,
1878 UINT32 OperationSet
)
1880 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1881 return IXAudio2MasteringVoice_SetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1882 EffectIndex
, pParameters
, ParametersByteSize
, OperationSet
);
1885 static HRESULT WINAPI
XA27M_GetEffectParameters(IXAudio27MasteringVoice
*iface
,
1886 UINT32 EffectIndex
, void *pParameters
, UINT32 ParametersByteSize
)
1888 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1889 return IXAudio2MasteringVoice_GetEffectParameters(&This
->IXAudio2MasteringVoice_iface
,
1890 EffectIndex
, pParameters
, ParametersByteSize
);
1893 static HRESULT WINAPI
XA27M_SetFilterParameters(IXAudio27MasteringVoice
*iface
,
1894 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1896 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1897 return IXAudio2MasteringVoice_SetFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1898 pParameters
, OperationSet
);
1901 static void WINAPI
XA27M_GetFilterParameters(IXAudio27MasteringVoice
*iface
,
1902 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1904 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1905 return IXAudio2MasteringVoice_GetFilterParameters(&This
->IXAudio2MasteringVoice_iface
, pParameters
);
1908 static HRESULT WINAPI
XA27M_SetOutputFilterParameters(IXAudio27MasteringVoice
*iface
,
1909 IXAudio2Voice
*pDestinationVoice
,
1910 const XAUDIO2_FILTER_PARAMETERS
*pParameters
, UINT32 OperationSet
)
1912 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1913 return IXAudio2MasteringVoice_SetOutputFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1914 pDestinationVoice
, pParameters
, OperationSet
);
1917 static void WINAPI
XA27M_GetOutputFilterParameters(IXAudio27MasteringVoice
*iface
,
1918 IXAudio2Voice
*pDestinationVoice
,
1919 XAUDIO2_FILTER_PARAMETERS
*pParameters
)
1921 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1922 IXAudio2MasteringVoice_GetOutputFilterParameters(&This
->IXAudio2MasteringVoice_iface
,
1923 pDestinationVoice
, pParameters
);
1926 static HRESULT WINAPI
XA27M_SetVolume(IXAudio27MasteringVoice
*iface
,
1927 float Volume
, UINT32 OperationSet
)
1929 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1930 return IXAudio2MasteringVoice_SetVolume(&This
->IXAudio2MasteringVoice_iface
,
1931 Volume
, OperationSet
);
1934 static void WINAPI
XA27M_GetVolume(IXAudio27MasteringVoice
*iface
,
1937 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1938 return IXAudio2MasteringVoice_GetVolume(&This
->IXAudio2MasteringVoice_iface
, pVolume
);
1941 static HRESULT WINAPI
XA27M_SetChannelVolumes(IXAudio27MasteringVoice
*iface
,
1942 UINT32 Channels
, const float *pVolumes
, UINT32 OperationSet
)
1944 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1945 return IXAudio2MasteringVoice_SetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1946 Channels
, pVolumes
, OperationSet
);
1949 static void WINAPI
XA27M_GetChannelVolumes(IXAudio27MasteringVoice
*iface
,
1950 UINT32 Channels
, float *pVolumes
)
1952 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1953 return IXAudio2MasteringVoice_GetChannelVolumes(&This
->IXAudio2MasteringVoice_iface
,
1954 Channels
, pVolumes
);
1957 static HRESULT WINAPI
XA27M_SetOutputMatrix(IXAudio27MasteringVoice
*iface
,
1958 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1959 UINT32 DestinationChannels
, const float *pLevelMatrix
,
1960 UINT32 OperationSet
)
1962 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1963 return IXAudio2MasteringVoice_SetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1964 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1965 pLevelMatrix
, OperationSet
);
1968 static void WINAPI
XA27M_GetOutputMatrix(IXAudio27MasteringVoice
*iface
,
1969 IXAudio2Voice
*pDestinationVoice
, UINT32 MasteringChannels
,
1970 UINT32 DestinationChannels
, float *pLevelMatrix
)
1972 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1973 return IXAudio2MasteringVoice_GetOutputMatrix(&This
->IXAudio2MasteringVoice_iface
,
1974 pDestinationVoice
, MasteringChannels
, DestinationChannels
,
1978 static void WINAPI
XA27M_DestroyVoice(IXAudio27MasteringVoice
*iface
)
1980 IXAudio2Impl
*This
= impl_from_IXAudio27MasteringVoice(iface
);
1981 return IXAudio2MasteringVoice_DestroyVoice(&This
->IXAudio2MasteringVoice_iface
);
1984 const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl
= {
1985 XA27M_GetVoiceDetails
,
1986 XA27M_SetOutputVoices
,
1987 XA27M_SetEffectChain
,
1989 XA27M_DisableEffect
,
1990 XA27M_GetEffectState
,
1991 XA27M_SetEffectParameters
,
1992 XA27M_GetEffectParameters
,
1993 XA27M_SetFilterParameters
,
1994 XA27M_GetFilterParameters
,
1995 XA27M_SetOutputFilterParameters
,
1996 XA27M_GetOutputFilterParameters
,
1999 XA27M_SetChannelVolumes
,
2000 XA27M_GetChannelVolumes
,
2001 XA27M_SetOutputMatrix
,
2002 XA27M_GetOutputMatrix
,
2006 /* END IXAudio2MasteringVoice */
2009 /* BEGIN IXAudio2 */
2010 #if XAUDIO2_VER == 0
2011 static inline IXAudio2Impl
*impl_from_IXAudio20(IXAudio20
*iface
)
2013 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio20_iface
);
2016 static HRESULT WINAPI
XA20_QueryInterface(IXAudio20
*iface
, REFIID riid
,
2019 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2020 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2023 static ULONG WINAPI
XA20_AddRef(IXAudio20
*iface
)
2025 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2026 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2029 static ULONG WINAPI
XA20_Release(IXAudio20
*iface
)
2031 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2032 return IXAudio2_Release(&This
->IXAudio2_iface
);
2035 static HRESULT WINAPI
XA20_GetDeviceCount(IXAudio20
*iface
, UINT32
*pCount
)
2037 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2039 TRACE("%p, %p\n", This
, pCount
);
2041 *pCount
= This
->ndevs
;
2046 static HRESULT WINAPI
XA20_GetDeviceDetails(IXAudio20
*iface
, UINT32 index
,
2047 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2049 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2052 IAudioClient
*client
;
2057 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2059 if(index
>= This
->ndevs
)
2060 return E_INVALIDARG
;
2062 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2064 WARN("GetDevice failed: %08x\n", hr
);
2068 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2069 NULL
, (void**)&client
);
2071 WARN("Activate failed: %08x\n", hr
);
2072 IMMDevice_Release(dev
);
2076 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2078 WARN("OpenPropertyStore failed: %08x\n", hr
);
2079 IAudioClient_Release(client
);
2080 IMMDevice_Release(dev
);
2084 PropVariantInit(&var
);
2086 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2088 WARN("GetValue failed: %08x\n", hr
);
2092 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2094 PropVariantClear(&var
);
2096 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2098 WARN("GetMixFormat failed: %08x\n", hr
);
2102 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2105 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2107 pDeviceDetails
->Role
= NotDefaultDevice
;
2109 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2110 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2115 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2120 IPropertyStore_Release(ps
);
2121 IAudioClient_Release(client
);
2122 IMMDevice_Release(dev
);
2127 static HRESULT WINAPI
XA20_Initialize(IXAudio20
*iface
, UINT32 flags
,
2128 XAUDIO2_PROCESSOR processor
)
2130 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2131 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2132 return xaudio2_initialize(This
, flags
, processor
);
2135 static HRESULT WINAPI
XA20_RegisterForCallbacks(IXAudio20
*iface
,
2136 IXAudio2EngineCallback
*pCallback
)
2138 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2139 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2142 static void WINAPI
XA20_UnregisterForCallbacks(IXAudio20
*iface
,
2143 IXAudio2EngineCallback
*pCallback
)
2145 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2146 return IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2149 static HRESULT WINAPI
XA20_CreateSourceVoice(IXAudio20
*iface
,
2150 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2151 UINT32 flags
, float maxFrequencyRatio
,
2152 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2153 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2155 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2156 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2157 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2161 static HRESULT WINAPI
XA20_CreateSubmixVoice(IXAudio20
*iface
,
2162 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2163 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2164 const XAUDIO2_VOICE_SENDS
*pSendList
,
2165 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2167 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2168 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2169 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2173 static HRESULT WINAPI
XA20_CreateMasteringVoice(IXAudio20
*iface
,
2174 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2175 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2176 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2178 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2180 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2181 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2184 if(deviceIndex
>= This
->ndevs
)
2185 return E_INVALIDARG
;
2187 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2188 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2189 pEffectChain
, AudioCategory_GameEffects
);
2192 static HRESULT WINAPI
XA20_StartEngine(IXAudio20
*iface
)
2194 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2195 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2198 static void WINAPI
XA20_StopEngine(IXAudio20
*iface
)
2200 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2201 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2204 static HRESULT WINAPI
XA20_CommitChanges(IXAudio20
*iface
, UINT32 operationSet
)
2206 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2207 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2210 static void WINAPI
XA20_GetPerformanceData(IXAudio20
*iface
,
2211 XAUDIO20_PERFORMANCE_DATA
*pPerfData
)
2213 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2214 XAUDIO2_PERFORMANCE_DATA data
;
2216 IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, &data
);
2218 pPerfData
->AudioCyclesSinceLastQuery
= data
.AudioCyclesSinceLastQuery
;
2219 pPerfData
->TotalCyclesSinceLastQuery
= data
.TotalCyclesSinceLastQuery
;
2220 pPerfData
->MinimumCyclesPerQuantum
= data
.MinimumCyclesPerQuantum
;
2221 pPerfData
->MaximumCyclesPerQuantum
= data
.MaximumCyclesPerQuantum
;
2222 pPerfData
->MemoryUsageInBytes
= data
.MemoryUsageInBytes
;
2223 pPerfData
->CurrentLatencyInSamples
= data
.CurrentLatencyInSamples
;
2224 pPerfData
->GlitchesSinceLastQuery
= data
.GlitchesSinceEngineStarted
- This
->last_query_glitches
;
2225 This
->last_query_glitches
= data
.GlitchesSinceEngineStarted
;
2226 pPerfData
->ActiveSourceVoiceCount
= data
.ActiveSourceVoiceCount
;
2227 pPerfData
->TotalSourceVoiceCount
= data
.TotalSourceVoiceCount
;
2229 pPerfData
->ActiveSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2230 pPerfData
->TotalSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2232 pPerfData
->ActiveXmaSourceVoices
= data
.ActiveXmaSourceVoices
;
2233 pPerfData
->ActiveXmaStreams
= data
.ActiveXmaStreams
;
2236 static void WINAPI
XA20_SetDebugConfiguration(IXAudio20
*iface
,
2237 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2240 IXAudio2Impl
*This
= impl_from_IXAudio20(iface
);
2241 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2242 pDebugConfiguration
, pReserved
);
2245 const IXAudio20Vtbl XAudio20_Vtbl
= {
2246 XA20_QueryInterface
,
2249 XA20_GetDeviceCount
,
2250 XA20_GetDeviceDetails
,
2252 XA20_RegisterForCallbacks
,
2253 XA20_UnregisterForCallbacks
,
2254 XA20_CreateSourceVoice
,
2255 XA20_CreateSubmixVoice
,
2256 XA20_CreateMasteringVoice
,
2260 XA20_GetPerformanceData
,
2261 XA20_SetDebugConfiguration
2264 #elif XAUDIO2_VER <= 2
2266 static inline IXAudio2Impl
*impl_from_IXAudio22(IXAudio22
*iface
)
2268 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio22_iface
);
2271 static HRESULT WINAPI
XA22_QueryInterface(IXAudio22
*iface
, REFIID riid
,
2274 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2275 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2278 static ULONG WINAPI
XA22_AddRef(IXAudio22
*iface
)
2280 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2281 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2284 static ULONG WINAPI
XA22_Release(IXAudio22
*iface
)
2286 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2287 return IXAudio2_Release(&This
->IXAudio2_iface
);
2290 static HRESULT WINAPI
XA22_GetDeviceCount(IXAudio22
*iface
, UINT32
*pCount
)
2292 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2294 TRACE("%p, %p\n", This
, pCount
);
2296 *pCount
= This
->ndevs
;
2301 static HRESULT WINAPI
XA22_GetDeviceDetails(IXAudio22
*iface
, UINT32 index
,
2302 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2304 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2307 IAudioClient
*client
;
2312 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2314 if(index
>= This
->ndevs
)
2315 return E_INVALIDARG
;
2317 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2319 WARN("GetDevice failed: %08x\n", hr
);
2323 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2324 NULL
, (void**)&client
);
2326 WARN("Activate failed: %08x\n", hr
);
2327 IMMDevice_Release(dev
);
2331 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2333 WARN("OpenPropertyStore failed: %08x\n", hr
);
2334 IAudioClient_Release(client
);
2335 IMMDevice_Release(dev
);
2339 PropVariantInit(&var
);
2341 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2343 WARN("GetValue failed: %08x\n", hr
);
2347 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2349 PropVariantClear(&var
);
2351 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2353 WARN("GetMixFormat failed: %08x\n", hr
);
2357 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2360 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2362 pDeviceDetails
->Role
= NotDefaultDevice
;
2364 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2365 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2370 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2375 IPropertyStore_Release(ps
);
2376 IAudioClient_Release(client
);
2377 IMMDevice_Release(dev
);
2382 static HRESULT WINAPI
XA22_Initialize(IXAudio22
*iface
, UINT32 flags
,
2383 XAUDIO2_PROCESSOR processor
)
2385 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2386 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2387 return xaudio2_initialize(This
, flags
, processor
);
2390 static HRESULT WINAPI
XA22_RegisterForCallbacks(IXAudio22
*iface
,
2391 IXAudio2EngineCallback
*pCallback
)
2393 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2394 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2397 static void WINAPI
XA22_UnregisterForCallbacks(IXAudio22
*iface
,
2398 IXAudio2EngineCallback
*pCallback
)
2400 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2401 IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2404 static HRESULT WINAPI
XA22_CreateSourceVoice(IXAudio22
*iface
,
2405 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2406 UINT32 flags
, float maxFrequencyRatio
,
2407 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2408 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2410 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2411 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2412 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2416 static HRESULT WINAPI
XA22_CreateSubmixVoice(IXAudio22
*iface
,
2417 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2418 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2419 const XAUDIO2_VOICE_SENDS
*pSendList
,
2420 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2422 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2423 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2424 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2428 static HRESULT WINAPI
XA22_CreateMasteringVoice(IXAudio22
*iface
,
2429 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2430 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2431 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2433 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2435 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2436 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2439 if(deviceIndex
>= This
->ndevs
)
2440 return E_INVALIDARG
;
2442 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2443 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2444 pEffectChain
, AudioCategory_GameEffects
);
2447 static HRESULT WINAPI
XA22_StartEngine(IXAudio22
*iface
)
2449 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2450 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2453 static void WINAPI
XA22_StopEngine(IXAudio22
*iface
)
2455 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2456 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2459 static HRESULT WINAPI
XA22_CommitChanges(IXAudio22
*iface
, UINT32 operationSet
)
2461 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2462 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2465 static void WINAPI
XA22_GetPerformanceData(IXAudio22
*iface
,
2466 XAUDIO22_PERFORMANCE_DATA
*pPerfData
)
2468 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2469 XAUDIO2_PERFORMANCE_DATA data
;
2471 IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, &data
);
2473 pPerfData
->AudioCyclesSinceLastQuery
= data
.AudioCyclesSinceLastQuery
;
2474 pPerfData
->TotalCyclesSinceLastQuery
= data
.TotalCyclesSinceLastQuery
;
2475 pPerfData
->MinimumCyclesPerQuantum
= data
.MinimumCyclesPerQuantum
;
2476 pPerfData
->MaximumCyclesPerQuantum
= data
.MaximumCyclesPerQuantum
;
2477 pPerfData
->MemoryUsageInBytes
= data
.MemoryUsageInBytes
;
2478 pPerfData
->CurrentLatencyInSamples
= data
.CurrentLatencyInSamples
;
2479 pPerfData
->GlitchesSinceEngineStarted
= data
.GlitchesSinceEngineStarted
;
2480 pPerfData
->ActiveSourceVoiceCount
= data
.ActiveSourceVoiceCount
;
2481 pPerfData
->TotalSourceVoiceCount
= data
.TotalSourceVoiceCount
;
2483 pPerfData
->ActiveSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2484 pPerfData
->TotalSubmixVoiceCount
= data
.ActiveSubmixVoiceCount
;
2486 pPerfData
->ActiveXmaSourceVoices
= data
.ActiveXmaSourceVoices
;
2487 pPerfData
->ActiveXmaStreams
= data
.ActiveXmaStreams
;
2490 static void WINAPI
XA22_SetDebugConfiguration(IXAudio22
*iface
,
2491 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2494 IXAudio2Impl
*This
= impl_from_IXAudio22(iface
);
2495 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2496 pDebugConfiguration
, pReserved
);
2499 const IXAudio22Vtbl XAudio22_Vtbl
= {
2500 XA22_QueryInterface
,
2503 XA22_GetDeviceCount
,
2504 XA22_GetDeviceDetails
,
2506 XA22_RegisterForCallbacks
,
2507 XA22_UnregisterForCallbacks
,
2508 XA22_CreateSourceVoice
,
2509 XA22_CreateSubmixVoice
,
2510 XA22_CreateMasteringVoice
,
2514 XA22_GetPerformanceData
,
2515 XA22_SetDebugConfiguration
2518 #elif XAUDIO2_VER <= 7
2520 static inline IXAudio2Impl
*impl_from_IXAudio27(IXAudio27
*iface
)
2522 return CONTAINING_RECORD(iface
, IXAudio2Impl
, IXAudio27_iface
);
2525 static HRESULT WINAPI
XA27_QueryInterface(IXAudio27
*iface
, REFIID riid
,
2528 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2529 return IXAudio2_QueryInterface(&This
->IXAudio2_iface
, riid
, ppvObject
);
2532 static ULONG WINAPI
XA27_AddRef(IXAudio27
*iface
)
2534 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2535 return IXAudio2_AddRef(&This
->IXAudio2_iface
);
2538 static ULONG WINAPI
XA27_Release(IXAudio27
*iface
)
2540 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2541 return IXAudio2_Release(&This
->IXAudio2_iface
);
2544 static HRESULT WINAPI
XA27_GetDeviceCount(IXAudio27
*iface
, UINT32
*pCount
)
2546 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2548 TRACE("%p, %p\n", This
, pCount
);
2550 *pCount
= This
->ndevs
;
2555 static HRESULT WINAPI
XA27_GetDeviceDetails(IXAudio27
*iface
, UINT32 index
,
2556 XAUDIO2_DEVICE_DETAILS
*pDeviceDetails
)
2558 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2561 IAudioClient
*client
;
2566 TRACE("%p, %u, %p\n", This
, index
, pDeviceDetails
);
2568 if(index
>= This
->ndevs
)
2569 return E_INVALIDARG
;
2571 hr
= IMMDeviceEnumerator_GetDevice(This
->devenum
, This
->devids
[index
], &dev
);
2573 WARN("GetDevice failed: %08x\n", hr
);
2577 hr
= IMMDevice_Activate(dev
, &IID_IAudioClient
, CLSCTX_INPROC_SERVER
,
2578 NULL
, (void**)&client
);
2580 WARN("Activate failed: %08x\n", hr
);
2581 IMMDevice_Release(dev
);
2585 hr
= IMMDevice_OpenPropertyStore(dev
, STGM_READ
, &ps
);
2587 WARN("OpenPropertyStore failed: %08x\n", hr
);
2588 IAudioClient_Release(client
);
2589 IMMDevice_Release(dev
);
2593 PropVariantInit(&var
);
2595 hr
= IPropertyStore_GetValue(ps
, (PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &var
);
2597 WARN("GetValue failed: %08x\n", hr
);
2601 lstrcpynW(pDeviceDetails
->DisplayName
, var
.u
.pwszVal
, sizeof(pDeviceDetails
->DisplayName
)/sizeof(WCHAR
));
2603 PropVariantClear(&var
);
2605 hr
= IAudioClient_GetMixFormat(client
, &wfx
);
2607 WARN("GetMixFormat failed: %08x\n", hr
);
2611 lstrcpyW(pDeviceDetails
->DeviceID
, This
->devids
[index
]);
2614 pDeviceDetails
->Role
= GlobalDefaultDevice
;
2616 pDeviceDetails
->Role
= NotDefaultDevice
;
2618 if(sizeof(WAVEFORMATEX
) + wfx
->cbSize
> sizeof(pDeviceDetails
->OutputFormat
)){
2619 FIXME("AudioClient format is too large to fit into WAVEFORMATEXTENSIBLE!\n");
2624 memcpy(&pDeviceDetails
->OutputFormat
, wfx
, sizeof(WAVEFORMATEX
) + wfx
->cbSize
);
2629 IPropertyStore_Release(ps
);
2630 IAudioClient_Release(client
);
2631 IMMDevice_Release(dev
);
2636 static HRESULT WINAPI
XA27_Initialize(IXAudio27
*iface
, UINT32 flags
,
2637 XAUDIO2_PROCESSOR processor
)
2639 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2640 TRACE("(%p)->(0x%x, 0x%x)\n", This
, flags
, processor
);
2641 return xaudio2_initialize(This
, flags
, processor
);
2644 static HRESULT WINAPI
XA27_RegisterForCallbacks(IXAudio27
*iface
,
2645 IXAudio2EngineCallback
*pCallback
)
2647 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2648 return IXAudio2_RegisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2651 static void WINAPI
XA27_UnregisterForCallbacks(IXAudio27
*iface
,
2652 IXAudio2EngineCallback
*pCallback
)
2654 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2655 IXAudio2_UnregisterForCallbacks(&This
->IXAudio2_iface
, pCallback
);
2658 static HRESULT WINAPI
XA27_CreateSourceVoice(IXAudio27
*iface
,
2659 IXAudio2SourceVoice
**ppSourceVoice
, const WAVEFORMATEX
*pSourceFormat
,
2660 UINT32 flags
, float maxFrequencyRatio
,
2661 IXAudio2VoiceCallback
*pCallback
, const XAUDIO2_VOICE_SENDS
*pSendList
,
2662 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2664 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2665 return IXAudio2_CreateSourceVoice(&This
->IXAudio2_iface
, ppSourceVoice
,
2666 pSourceFormat
, flags
, maxFrequencyRatio
, pCallback
, pSendList
,
2670 static HRESULT WINAPI
XA27_CreateSubmixVoice(IXAudio27
*iface
,
2671 IXAudio2SubmixVoice
**ppSubmixVoice
, UINT32 inputChannels
,
2672 UINT32 inputSampleRate
, UINT32 flags
, UINT32 processingStage
,
2673 const XAUDIO2_VOICE_SENDS
*pSendList
,
2674 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2676 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2677 return IXAudio2_CreateSubmixVoice(&This
->IXAudio2_iface
, ppSubmixVoice
,
2678 inputChannels
, inputSampleRate
, flags
, processingStage
, pSendList
,
2682 static HRESULT WINAPI
XA27_CreateMasteringVoice(IXAudio27
*iface
,
2683 IXAudio2MasteringVoice
**ppMasteringVoice
, UINT32 inputChannels
,
2684 UINT32 inputSampleRate
, UINT32 flags
, UINT32 deviceIndex
,
2685 const XAUDIO2_EFFECT_CHAIN
*pEffectChain
)
2687 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2689 TRACE("(%p)->(%p, %u, %u, 0x%x, %u, %p)\n", This
, ppMasteringVoice
,
2690 inputChannels
, inputSampleRate
, flags
, deviceIndex
,
2693 if(deviceIndex
>= This
->ndevs
)
2694 return E_INVALIDARG
;
2696 return IXAudio2_CreateMasteringVoice(&This
->IXAudio2_iface
, ppMasteringVoice
,
2697 inputChannels
, inputSampleRate
, flags
, This
->devids
[deviceIndex
],
2698 pEffectChain
, AudioCategory_GameEffects
);
2701 static HRESULT WINAPI
XA27_StartEngine(IXAudio27
*iface
)
2703 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2704 return IXAudio2_StartEngine(&This
->IXAudio2_iface
);
2707 static void WINAPI
XA27_StopEngine(IXAudio27
*iface
)
2709 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2710 return IXAudio2_StopEngine(&This
->IXAudio2_iface
);
2713 static HRESULT WINAPI
XA27_CommitChanges(IXAudio27
*iface
, UINT32 operationSet
)
2715 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2716 return IXAudio2_CommitChanges(&This
->IXAudio2_iface
, operationSet
);
2719 static void WINAPI
XA27_GetPerformanceData(IXAudio27
*iface
,
2720 XAUDIO2_PERFORMANCE_DATA
*pPerfData
)
2722 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2723 return IXAudio2_GetPerformanceData(&This
->IXAudio2_iface
, pPerfData
);
2726 static void WINAPI
XA27_SetDebugConfiguration(IXAudio27
*iface
,
2727 const XAUDIO2_DEBUG_CONFIGURATION
*pDebugConfiguration
,
2730 IXAudio2Impl
*This
= impl_from_IXAudio27(iface
);
2731 return IXAudio2_SetDebugConfiguration(&This
->IXAudio2_iface
,
2732 pDebugConfiguration
, pReserved
);
2735 const IXAudio27Vtbl XAudio27_Vtbl
= {
2736 XA27_QueryInterface
,
2739 XA27_GetDeviceCount
,
2740 XA27_GetDeviceDetails
,
2742 XA27_RegisterForCallbacks
,
2743 XA27_UnregisterForCallbacks
,
2744 XA27_CreateSourceVoice
,
2745 XA27_CreateSubmixVoice
,
2746 XA27_CreateMasteringVoice
,
2750 XA27_GetPerformanceData
,
2751 XA27_SetDebugConfiguration