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
23 #define NONAMELESSUNION
27 #include "xaudio_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
35 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD reason
, void *pReserved
)
37 TRACE("(%p, %d, %p)\n", hinstDLL
, reason
, pReserved
);
41 case DLL_WINE_PREATTACH
:
42 return FALSE
; /* prefer native version */
43 case DLL_PROCESS_ATTACH
:
44 DisableThreadLibraryCalls( hinstDLL
);
49 #endif /* XAPOFX1_VER */
51 typedef struct _VUMeterImpl
{
53 IXAPOParameters IXAPOParameters_iface
;
58 static VUMeterImpl
*VUMeterImpl_from_IXAPO(IXAPO
*iface
)
60 return CONTAINING_RECORD(iface
, VUMeterImpl
, IXAPO_iface
);
63 static VUMeterImpl
*VUMeterImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
65 return CONTAINING_RECORD(iface
, VUMeterImpl
, IXAPOParameters_iface
);
68 static HRESULT WINAPI
VUMXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
,
71 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
73 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
75 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
76 IsEqualGUID(riid
, &IID_IXAPO
) ||
77 IsEqualGUID(riid
, &IID_IXAPO27
))
78 *ppvObject
= &This
->IXAPO_iface
;
79 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
80 *ppvObject
= &This
->IXAPOParameters_iface
;
85 IUnknown_AddRef((IUnknown
*)*ppvObject
);
92 static ULONG WINAPI
VUMXAPO_AddRef(IXAPO
*iface
)
94 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
95 ULONG ref
= InterlockedIncrement(&This
->ref
);
96 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
100 static ULONG WINAPI
VUMXAPO_Release(IXAPO
*iface
)
102 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
103 ULONG ref
= InterlockedDecrement(&This
->ref
);
105 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
108 HeapFree(GetProcessHeap(), 0, This
);
113 static HRESULT WINAPI
VUMXAPO_GetRegistrationProperties(IXAPO
*iface
,
114 XAPO_REGISTRATION_PROPERTIES
**props
)
116 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
117 TRACE("%p, %p\n", This
, props
);
118 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
122 static HRESULT WINAPI
VUMXAPO_IsInputFormatSupported(IXAPO
*iface
,
123 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
124 WAVEFORMATEX
**supported_fmt
)
126 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
127 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
131 static HRESULT WINAPI
VUMXAPO_IsOutputFormatSupported(IXAPO
*iface
,
132 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
133 WAVEFORMATEX
**supported_fmt
)
135 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
136 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
140 static HRESULT WINAPI
VUMXAPO_Initialize(IXAPO
*iface
, const void *data
,
143 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
144 TRACE("%p, %p, %u\n", This
, data
, data_len
);
148 static HRESULT WINAPI
VUMXAPO_Reset(IXAPO
*iface
)
150 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
155 static HRESULT WINAPI
VUMXAPO_LockForProcess(IXAPO
*iface
,
156 UINT32 in_params_count
,
157 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
158 UINT32 out_params_count
,
159 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
161 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
162 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
163 out_params_count
, out_params
);
167 static void WINAPI
VUMXAPO_UnlockForProcess(IXAPO
*iface
)
169 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
173 static void WINAPI
VUMXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
174 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
175 UINT32 out_params_count
,
176 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
178 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
179 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
180 out_params_count
, out_params
, enabled
);
183 static UINT32 WINAPI
VUMXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
185 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
186 TRACE("%p, %u\n", This
, output_frames
);
190 static UINT32 WINAPI
VUMXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
192 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
193 TRACE("%p, %u\n", This
, input_frames
);
197 static const IXAPOVtbl VUMXAPO_Vtbl
= {
198 VUMXAPO_QueryInterface
,
201 VUMXAPO_GetRegistrationProperties
,
202 VUMXAPO_IsInputFormatSupported
,
203 VUMXAPO_IsOutputFormatSupported
,
206 VUMXAPO_LockForProcess
,
207 VUMXAPO_UnlockForProcess
,
209 VUMXAPO_CalcInputFrames
,
210 VUMXAPO_CalcOutputFrames
213 static HRESULT WINAPI
VUMXAPOParams_QueryInterface(IXAPOParameters
*iface
,
214 REFIID riid
, void **ppvObject
)
216 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
217 return VUMXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
220 static ULONG WINAPI
VUMXAPOParams_AddRef(IXAPOParameters
*iface
)
222 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
223 return VUMXAPO_AddRef(&This
->IXAPO_iface
);
226 static ULONG WINAPI
VUMXAPOParams_Release(IXAPOParameters
*iface
)
228 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
229 return VUMXAPO_Release(&This
->IXAPO_iface
);
232 static void WINAPI
VUMXAPOParams_SetParameters(IXAPOParameters
*iface
,
233 const void *params
, UINT32 params_len
)
235 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
236 TRACE("%p, %p, %u\n", This
, params
, params_len
);
239 static void WINAPI
VUMXAPOParams_GetParameters(IXAPOParameters
*iface
,
240 void *params
, UINT32 params_len
)
242 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
243 TRACE("%p, %p, %u\n", This
, params
, params_len
);
246 static const IXAPOParametersVtbl VUMXAPOParameters_Vtbl
= {
247 VUMXAPOParams_QueryInterface
,
248 VUMXAPOParams_AddRef
,
249 VUMXAPOParams_Release
,
250 VUMXAPOParams_SetParameters
,
251 VUMXAPOParams_GetParameters
254 typedef struct _ReverbImpl
{
256 IXAPOParameters IXAPOParameters_iface
;
261 static ReverbImpl
*ReverbImpl_from_IXAPO(IXAPO
*iface
)
263 return CONTAINING_RECORD(iface
, ReverbImpl
, IXAPO_iface
);
266 static ReverbImpl
*ReverbImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
268 return CONTAINING_RECORD(iface
, ReverbImpl
, IXAPOParameters_iface
);
271 static HRESULT WINAPI
RVBXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
, void **ppvObject
)
273 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
275 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
277 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
278 IsEqualGUID(riid
, &IID_IXAPO
) ||
279 IsEqualGUID(riid
, &IID_IXAPO27
))
280 *ppvObject
= &This
->IXAPO_iface
;
281 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
282 *ppvObject
= &This
->IXAPOParameters_iface
;
287 IUnknown_AddRef((IUnknown
*)*ppvObject
);
291 return E_NOINTERFACE
;
294 static ULONG WINAPI
RVBXAPO_AddRef(IXAPO
*iface
)
296 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
297 ULONG ref
= InterlockedIncrement(&This
->ref
);
298 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
302 static ULONG WINAPI
RVBXAPO_Release(IXAPO
*iface
)
304 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
305 ULONG ref
= InterlockedDecrement(&This
->ref
);
307 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
310 HeapFree(GetProcessHeap(), 0, This
);
315 static HRESULT WINAPI
RVBXAPO_GetRegistrationProperties(IXAPO
*iface
,
316 XAPO_REGISTRATION_PROPERTIES
**props
)
318 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
319 TRACE("%p, %p\n", This
, props
);
320 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
324 static HRESULT WINAPI
RVBXAPO_IsInputFormatSupported(IXAPO
*iface
,
325 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
326 WAVEFORMATEX
**supported_fmt
)
328 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
329 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
333 static HRESULT WINAPI
RVBXAPO_IsOutputFormatSupported(IXAPO
*iface
,
334 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
335 WAVEFORMATEX
**supported_fmt
)
337 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
338 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
342 static HRESULT WINAPI
RVBXAPO_Initialize(IXAPO
*iface
, const void *data
,
345 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
346 TRACE("%p, %p, %u\n", This
, data
, data_len
);
350 static HRESULT WINAPI
RVBXAPO_Reset(IXAPO
*iface
)
352 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
357 static HRESULT WINAPI
RVBXAPO_LockForProcess(IXAPO
*iface
, UINT32 in_params_count
,
358 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
359 UINT32 out_params_count
,
360 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
362 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
363 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
364 out_params_count
, out_params
);
368 static void WINAPI
RVBXAPO_UnlockForProcess(IXAPO
*iface
)
370 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
374 static void WINAPI
RVBXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
375 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
376 UINT32 out_params_count
,
377 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
379 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
380 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
381 out_params_count
, out_params
, enabled
);
384 static UINT32 WINAPI
RVBXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
386 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
387 TRACE("%p, %u\n", This
, output_frames
);
391 static UINT32 WINAPI
RVBXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
393 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
394 TRACE("%p, %u\n", This
, input_frames
);
398 static const IXAPOVtbl RVBXAPO_Vtbl
= {
399 RVBXAPO_QueryInterface
,
402 RVBXAPO_GetRegistrationProperties
,
403 RVBXAPO_IsInputFormatSupported
,
404 RVBXAPO_IsOutputFormatSupported
,
407 RVBXAPO_LockForProcess
,
408 RVBXAPO_UnlockForProcess
,
410 RVBXAPO_CalcInputFrames
,
411 RVBXAPO_CalcOutputFrames
414 static HRESULT WINAPI
RVBXAPOParams_QueryInterface(IXAPOParameters
*iface
,
415 REFIID riid
, void **ppvObject
)
417 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
418 return RVBXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
421 static ULONG WINAPI
RVBXAPOParams_AddRef(IXAPOParameters
*iface
)
423 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
424 return RVBXAPO_AddRef(&This
->IXAPO_iface
);
427 static ULONG WINAPI
RVBXAPOParams_Release(IXAPOParameters
*iface
)
429 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
430 return RVBXAPO_Release(&This
->IXAPO_iface
);
433 static void WINAPI
RVBXAPOParams_SetParameters(IXAPOParameters
*iface
,
434 const void *params
, UINT32 params_len
)
436 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
437 TRACE("%p, %p, %u\n", This
, params
, params_len
);
440 static void WINAPI
RVBXAPOParams_GetParameters(IXAPOParameters
*iface
, void *params
,
443 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
444 TRACE("%p, %p, %u\n", This
, params
, params_len
);
447 static const IXAPOParametersVtbl RVBXAPOParameters_Vtbl
= {
448 RVBXAPOParams_QueryInterface
,
449 RVBXAPOParams_AddRef
,
450 RVBXAPOParams_Release
,
451 RVBXAPOParams_SetParameters
,
452 RVBXAPOParams_GetParameters
455 typedef struct _EQImpl
{
457 IXAPOParameters IXAPOParameters_iface
;
462 static EQImpl
*EQImpl_from_IXAPO(IXAPO
*iface
)
464 return CONTAINING_RECORD(iface
, EQImpl
, IXAPO_iface
);
467 static EQImpl
*EQImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
469 return CONTAINING_RECORD(iface
, EQImpl
, IXAPOParameters_iface
);
472 static HRESULT WINAPI
EQXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
, void **ppvObject
)
474 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
476 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
478 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
479 IsEqualGUID(riid
, &IID_IXAPO
) ||
480 IsEqualGUID(riid
, &IID_IXAPO27
))
481 *ppvObject
= &This
->IXAPO_iface
;
482 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
483 *ppvObject
= &This
->IXAPOParameters_iface
;
488 IUnknown_AddRef((IUnknown
*)*ppvObject
);
492 return E_NOINTERFACE
;
495 static ULONG WINAPI
EQXAPO_AddRef(IXAPO
*iface
)
497 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
498 ULONG ref
= InterlockedIncrement(&This
->ref
);
499 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
503 static ULONG WINAPI
EQXAPO_Release(IXAPO
*iface
)
505 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
506 ULONG ref
= InterlockedDecrement(&This
->ref
);
508 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
511 HeapFree(GetProcessHeap(), 0, This
);
516 static HRESULT WINAPI
EQXAPO_GetRegistrationProperties(IXAPO
*iface
,
517 XAPO_REGISTRATION_PROPERTIES
**props
)
519 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
520 TRACE("%p, %p\n", This
, props
);
521 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
525 static HRESULT WINAPI
EQXAPO_IsInputFormatSupported(IXAPO
*iface
,
526 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
527 WAVEFORMATEX
**supported_fmt
)
529 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
530 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
534 static HRESULT WINAPI
EQXAPO_IsOutputFormatSupported(IXAPO
*iface
,
535 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
536 WAVEFORMATEX
**supported_fmt
)
538 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
539 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
543 static HRESULT WINAPI
EQXAPO_Initialize(IXAPO
*iface
, const void *data
,
546 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
547 TRACE("%p, %p, %u\n", This
, data
, data_len
);
551 static HRESULT WINAPI
EQXAPO_Reset(IXAPO
*iface
)
553 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
558 static HRESULT WINAPI
EQXAPO_LockForProcess(IXAPO
*iface
, UINT32 in_params_count
,
559 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
560 UINT32 out_params_count
,
561 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
563 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
564 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
565 out_params_count
, out_params
);
569 static void WINAPI
EQXAPO_UnlockForProcess(IXAPO
*iface
)
571 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
575 static void WINAPI
EQXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
576 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
577 UINT32 out_params_count
,
578 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
580 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
581 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
582 out_params_count
, out_params
, enabled
);
585 static UINT32 WINAPI
EQXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
587 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
588 TRACE("%p, %u\n", This
, output_frames
);
592 static UINT32 WINAPI
EQXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
594 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
595 TRACE("%p, %u\n", This
, input_frames
);
599 static const IXAPOVtbl EQXAPO_Vtbl
= {
600 EQXAPO_QueryInterface
,
603 EQXAPO_GetRegistrationProperties
,
604 EQXAPO_IsInputFormatSupported
,
605 EQXAPO_IsOutputFormatSupported
,
608 EQXAPO_LockForProcess
,
609 EQXAPO_UnlockForProcess
,
611 EQXAPO_CalcInputFrames
,
612 EQXAPO_CalcOutputFrames
615 static HRESULT WINAPI
EQXAPOParams_QueryInterface(IXAPOParameters
*iface
,
616 REFIID riid
, void **ppvObject
)
618 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
619 return EQXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
622 static ULONG WINAPI
EQXAPOParams_AddRef(IXAPOParameters
*iface
)
624 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
625 return EQXAPO_AddRef(&This
->IXAPO_iface
);
628 static ULONG WINAPI
EQXAPOParams_Release(IXAPOParameters
*iface
)
630 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
631 return EQXAPO_Release(&This
->IXAPO_iface
);
634 static void WINAPI
EQXAPOParams_SetParameters(IXAPOParameters
*iface
,
635 const void *params
, UINT32 params_len
)
637 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
638 TRACE("%p, %p, %u\n", This
, params
, params_len
);
641 static void WINAPI
EQXAPOParams_GetParameters(IXAPOParameters
*iface
, void *params
,
644 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
645 TRACE("%p, %p, %u\n", This
, params
, params_len
);
648 static const IXAPOParametersVtbl EQXAPOParameters_Vtbl
= {
649 EQXAPOParams_QueryInterface
,
651 EQXAPOParams_Release
,
652 EQXAPOParams_SetParameters
,
653 EQXAPOParams_GetParameters
657 IClassFactory IClassFactory_iface
;
662 static struct xapo_cf
*xapo_impl_from_IClassFactory(IClassFactory
*iface
)
664 return CONTAINING_RECORD(iface
, struct xapo_cf
, IClassFactory_iface
);
667 static HRESULT WINAPI
xapocf_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppobj
)
669 if(IsEqualGUID(riid
, &IID_IUnknown
)
670 || IsEqualGUID(riid
, &IID_IClassFactory
))
672 IClassFactory_AddRef(iface
);
678 WARN("(%p)->(%s, %p): interface not found\n", iface
, debugstr_guid(riid
), ppobj
);
679 return E_NOINTERFACE
;
682 static ULONG WINAPI
xapocf_AddRef(IClassFactory
*iface
)
684 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
685 ULONG ref
= InterlockedIncrement(&This
->ref
);
686 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
690 static ULONG WINAPI
xapocf_Release(IClassFactory
*iface
)
692 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
693 ULONG ref
= InterlockedDecrement(&This
->ref
);
694 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
696 HeapFree(GetProcessHeap(), 0, This
);
700 static HRESULT WINAPI
xapocf_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
701 REFIID riid
, void **ppobj
)
703 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
706 TRACE("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
711 return CLASS_E_NOAGGREGATION
;
713 if(IsEqualGUID(This
->class, &CLSID_AudioVolumeMeter27
)){
716 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
718 return E_OUTOFMEMORY
;
720 object
->IXAPO_iface
.lpVtbl
= &VUMXAPO_Vtbl
;
721 object
->IXAPOParameters_iface
.lpVtbl
= &VUMXAPOParameters_Vtbl
;
723 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
725 HeapFree(GetProcessHeap(), 0, object
);
728 }else if(IsEqualGUID(This
->class, &CLSID_FXReverb
)){
731 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
733 return E_OUTOFMEMORY
;
735 object
->IXAPO_iface
.lpVtbl
= &RVBXAPO_Vtbl
;
736 object
->IXAPOParameters_iface
.lpVtbl
= &RVBXAPOParameters_Vtbl
;
738 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
740 HeapFree(GetProcessHeap(), 0, object
);
743 }else if(IsEqualGUID(This
->class, &CLSID_FXEQ
)){
746 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
748 return E_OUTOFMEMORY
;
750 object
->IXAPO_iface
.lpVtbl
= &EQXAPO_Vtbl
;
751 object
->IXAPOParameters_iface
.lpVtbl
= &EQXAPOParameters_Vtbl
;
753 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
755 HeapFree(GetProcessHeap(), 0, object
);
759 /* TODO FXECHO, FXMasteringLimiter, */
765 static HRESULT WINAPI
xapocf_LockServer(IClassFactory
*iface
, BOOL dolock
)
767 FIXME("(static)->(%d): stub!\n", dolock
);
771 static const IClassFactoryVtbl xapo_Vtbl
=
773 xapocf_QueryInterface
,
776 xapocf_CreateInstance
,
780 IClassFactory
*make_xapo_factory(REFCLSID clsid
)
782 struct xapo_cf
*ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(struct xapo_cf
));
783 ret
->IClassFactory_iface
.lpVtbl
= &xapo_Vtbl
;
786 return &ret
->IClassFactory_iface
;
790 HRESULT WINAPI
CreateAudioVolumeMeter(IUnknown
**out
)
795 cf
= make_xapo_factory(&CLSID_AudioVolumeMeter27
);
797 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)out
);
799 IClassFactory_Release(cf
);
804 HRESULT WINAPI
CreateAudioReverb(IUnknown
**out
)
809 cf
= make_xapo_factory(&CLSID_FXReverb
);
811 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)out
);
813 IClassFactory_Release(cf
);
818 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
, void *initdata
, UINT32 initdata_bytes
)
822 const GUID
*class = NULL
;
827 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
828 IsEqualGUID(clsid
, &CLSID_FXReverb
))
829 class = &CLSID_FXReverb
;
830 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
831 IsEqualGUID(clsid
, &CLSID_FXEQ
))
835 cf
= make_xapo_factory(class);
837 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
838 IClassFactory_Release(cf
);
842 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
844 WARN("CoCreateInstance failed: %08x\n", hr
);
849 if(initdata
&& initdata_bytes
> 0){
852 hr
= IUnknown_QueryInterface(obj
, &IID_IXAPO
, (void**)&xapo
);
854 hr
= IXAPO_Initialize(xapo
, initdata
, initdata_bytes
);
859 WARN("Initialize failed: %08x\n", hr
);
860 IUnknown_Release(obj
);
870 #endif /* XAUDIO2_VER >= 8 */
873 HRESULT CDECL
CreateFX(REFCLSID clsid
, IUnknown
**out
)
877 const GUID
*class = NULL
;
880 TRACE("%s %p\n", debugstr_guid(clsid
), out
);
884 if(IsEqualGUID(clsid
, &CLSID_FXReverb27
) ||
885 IsEqualGUID(clsid
, &CLSID_FXReverb
))
886 class = &CLSID_FXReverb
;
887 else if(IsEqualGUID(clsid
, &CLSID_FXEQ27
) ||
888 IsEqualGUID(clsid
, &CLSID_FXEQ
))
890 /* TODO FXECHO, FXMasteringLimiter, */
893 cf
= make_xapo_factory(class);
895 hr
= IClassFactory_CreateInstance(cf
, NULL
, &IID_IUnknown
, (void**)&obj
);
896 IClassFactory_Release(cf
);
900 hr
= CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
, (void**)&obj
);
902 WARN("CoCreateInstance failed: %08x\n", hr
);
911 #endif /* XAPOFX1_VER */