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
26 #include "xaudio_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2
);
33 typedef struct _VUMeterImpl
{
35 IXAPOParameters IXAPOParameters_iface
;
42 static VUMeterImpl
*VUMeterImpl_from_IXAPO(IXAPO
*iface
)
44 return CONTAINING_RECORD(iface
, VUMeterImpl
, IXAPO_iface
);
47 static VUMeterImpl
*VUMeterImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
49 return CONTAINING_RECORD(iface
, VUMeterImpl
, IXAPOParameters_iface
);
52 static HRESULT WINAPI
VUMXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
,
55 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
57 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
59 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
60 IsEqualGUID(riid
, &IID_IXAPO
) ||
61 IsEqualGUID(riid
, &IID_IXAPO27
))
62 *ppvObject
= &This
->IXAPO_iface
;
63 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
64 *ppvObject
= &This
->IXAPOParameters_iface
;
69 IUnknown_AddRef((IUnknown
*)*ppvObject
);
76 static ULONG WINAPI
VUMXAPO_AddRef(IXAPO
*iface
)
78 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
79 ULONG ref
= InterlockedIncrement(&This
->ref
);
80 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
84 static ULONG WINAPI
VUMXAPO_Release(IXAPO
*iface
)
86 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
87 ULONG ref
= InterlockedDecrement(&This
->ref
);
89 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
92 HeapFree(GetProcessHeap(), 0, This
);
97 static HRESULT WINAPI
VUMXAPO_GetRegistrationProperties(IXAPO
*iface
,
98 XAPO_REGISTRATION_PROPERTIES
**props
)
100 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
101 TRACE("%p, %p\n", This
, props
);
102 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
106 static HRESULT WINAPI
VUMXAPO_IsInputFormatSupported(IXAPO
*iface
,
107 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
108 WAVEFORMATEX
**supported_fmt
)
110 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
111 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
115 static HRESULT WINAPI
VUMXAPO_IsOutputFormatSupported(IXAPO
*iface
,
116 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
117 WAVEFORMATEX
**supported_fmt
)
119 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
120 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
124 static HRESULT WINAPI
VUMXAPO_Initialize(IXAPO
*iface
, const void *data
,
127 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
128 TRACE("%p, %p, %u\n", This
, data
, data_len
);
132 static HRESULT WINAPI
VUMXAPO_Reset(IXAPO
*iface
)
134 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
139 static HRESULT WINAPI
VUMXAPO_LockForProcess(IXAPO
*iface
,
140 UINT32 in_params_count
,
141 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
142 UINT32 out_params_count
,
143 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
145 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
146 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
147 out_params_count
, out_params
);
151 static void WINAPI
VUMXAPO_UnlockForProcess(IXAPO
*iface
)
153 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
157 static void WINAPI
VUMXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
158 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
159 UINT32 out_params_count
,
160 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
162 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
163 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
164 out_params_count
, out_params
, enabled
);
167 static UINT32 WINAPI
VUMXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
169 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
170 TRACE("%p, %u\n", This
, output_frames
);
174 static UINT32 WINAPI
VUMXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
176 VUMeterImpl
*This
= VUMeterImpl_from_IXAPO(iface
);
177 TRACE("%p, %u\n", This
, input_frames
);
181 static const IXAPOVtbl VUMXAPO_Vtbl
= {
182 VUMXAPO_QueryInterface
,
185 VUMXAPO_GetRegistrationProperties
,
186 VUMXAPO_IsInputFormatSupported
,
187 VUMXAPO_IsOutputFormatSupported
,
190 VUMXAPO_LockForProcess
,
191 VUMXAPO_UnlockForProcess
,
193 VUMXAPO_CalcInputFrames
,
194 VUMXAPO_CalcOutputFrames
197 static HRESULT WINAPI
VUMXAPOParams_QueryInterface(IXAPOParameters
*iface
,
198 REFIID riid
, void **ppvObject
)
200 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
201 return VUMXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
204 static ULONG WINAPI
VUMXAPOParams_AddRef(IXAPOParameters
*iface
)
206 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
207 return VUMXAPO_AddRef(&This
->IXAPO_iface
);
210 static ULONG WINAPI
VUMXAPOParams_Release(IXAPOParameters
*iface
)
212 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
213 return VUMXAPO_Release(&This
->IXAPO_iface
);
216 static void WINAPI
VUMXAPOParams_SetParameters(IXAPOParameters
*iface
,
217 const void *params
, UINT32 params_len
)
219 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
220 TRACE("%p, %p, %u\n", This
, params
, params_len
);
223 static void WINAPI
VUMXAPOParams_GetParameters(IXAPOParameters
*iface
,
224 void *params
, UINT32 params_len
)
226 VUMeterImpl
*This
= VUMeterImpl_from_IXAPOParameters(iface
);
227 TRACE("%p, %p, %u\n", This
, params
, params_len
);
230 static const IXAPOParametersVtbl VUMXAPOParameters_Vtbl
= {
231 VUMXAPOParams_QueryInterface
,
232 VUMXAPOParams_AddRef
,
233 VUMXAPOParams_Release
,
234 VUMXAPOParams_SetParameters
,
235 VUMXAPOParams_GetParameters
238 typedef struct _ReverbImpl
{
240 IXAPOParameters IXAPOParameters_iface
;
247 static ReverbImpl
*ReverbImpl_from_IXAPO(IXAPO
*iface
)
249 return CONTAINING_RECORD(iface
, ReverbImpl
, IXAPO_iface
);
252 static ReverbImpl
*ReverbImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
254 return CONTAINING_RECORD(iface
, ReverbImpl
, IXAPOParameters_iface
);
257 static HRESULT WINAPI
RVBXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
, void **ppvObject
)
259 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
261 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
263 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
264 IsEqualGUID(riid
, &IID_IXAPO
) ||
265 IsEqualGUID(riid
, &IID_IXAPO27
))
266 *ppvObject
= &This
->IXAPO_iface
;
267 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
268 *ppvObject
= &This
->IXAPOParameters_iface
;
273 IUnknown_AddRef((IUnknown
*)*ppvObject
);
277 return E_NOINTERFACE
;
280 static ULONG WINAPI
RVBXAPO_AddRef(IXAPO
*iface
)
282 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
283 ULONG ref
= InterlockedIncrement(&This
->ref
);
284 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
288 static ULONG WINAPI
RVBXAPO_Release(IXAPO
*iface
)
290 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
291 ULONG ref
= InterlockedDecrement(&This
->ref
);
293 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
296 HeapFree(GetProcessHeap(), 0, This
);
301 static HRESULT WINAPI
RVBXAPO_GetRegistrationProperties(IXAPO
*iface
,
302 XAPO_REGISTRATION_PROPERTIES
**props
)
304 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
305 TRACE("%p, %p\n", This
, props
);
306 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
310 static HRESULT WINAPI
RVBXAPO_IsInputFormatSupported(IXAPO
*iface
,
311 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
312 WAVEFORMATEX
**supported_fmt
)
314 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
315 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
319 static HRESULT WINAPI
RVBXAPO_IsOutputFormatSupported(IXAPO
*iface
,
320 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
321 WAVEFORMATEX
**supported_fmt
)
323 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
324 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
328 static HRESULT WINAPI
RVBXAPO_Initialize(IXAPO
*iface
, const void *data
,
331 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
332 TRACE("%p, %p, %u\n", This
, data
, data_len
);
336 static HRESULT WINAPI
RVBXAPO_Reset(IXAPO
*iface
)
338 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
343 static HRESULT WINAPI
RVBXAPO_LockForProcess(IXAPO
*iface
, UINT32 in_params_count
,
344 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
345 UINT32 out_params_count
,
346 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
348 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
349 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
350 out_params_count
, out_params
);
354 static void WINAPI
RVBXAPO_UnlockForProcess(IXAPO
*iface
)
356 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
360 static void WINAPI
RVBXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
361 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
362 UINT32 out_params_count
,
363 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
365 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
366 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
367 out_params_count
, out_params
, enabled
);
370 static UINT32 WINAPI
RVBXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
372 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
373 TRACE("%p, %u\n", This
, output_frames
);
377 static UINT32 WINAPI
RVBXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
379 ReverbImpl
*This
= ReverbImpl_from_IXAPO(iface
);
380 TRACE("%p, %u\n", This
, input_frames
);
384 static const IXAPOVtbl RVBXAPO_Vtbl
= {
385 RVBXAPO_QueryInterface
,
388 RVBXAPO_GetRegistrationProperties
,
389 RVBXAPO_IsInputFormatSupported
,
390 RVBXAPO_IsOutputFormatSupported
,
393 RVBXAPO_LockForProcess
,
394 RVBXAPO_UnlockForProcess
,
396 RVBXAPO_CalcInputFrames
,
397 RVBXAPO_CalcOutputFrames
400 static HRESULT WINAPI
RVBXAPOParams_QueryInterface(IXAPOParameters
*iface
,
401 REFIID riid
, void **ppvObject
)
403 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
404 return RVBXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
407 static ULONG WINAPI
RVBXAPOParams_AddRef(IXAPOParameters
*iface
)
409 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
410 return RVBXAPO_AddRef(&This
->IXAPO_iface
);
413 static ULONG WINAPI
RVBXAPOParams_Release(IXAPOParameters
*iface
)
415 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
416 return RVBXAPO_Release(&This
->IXAPO_iface
);
419 static void WINAPI
RVBXAPOParams_SetParameters(IXAPOParameters
*iface
,
420 const void *params
, UINT32 params_len
)
422 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
423 TRACE("%p, %p, %u\n", This
, params
, params_len
);
426 static void WINAPI
RVBXAPOParams_GetParameters(IXAPOParameters
*iface
, void *params
,
429 ReverbImpl
*This
= ReverbImpl_from_IXAPOParameters(iface
);
430 TRACE("%p, %p, %u\n", This
, params
, params_len
);
433 static const IXAPOParametersVtbl RVBXAPOParameters_Vtbl
= {
434 RVBXAPOParams_QueryInterface
,
435 RVBXAPOParams_AddRef
,
436 RVBXAPOParams_Release
,
437 RVBXAPOParams_SetParameters
,
438 RVBXAPOParams_GetParameters
441 typedef struct _EQImpl
{
443 IXAPOParameters IXAPOParameters_iface
;
450 static EQImpl
*EQImpl_from_IXAPO(IXAPO
*iface
)
452 return CONTAINING_RECORD(iface
, EQImpl
, IXAPO_iface
);
455 static EQImpl
*EQImpl_from_IXAPOParameters(IXAPOParameters
*iface
)
457 return CONTAINING_RECORD(iface
, EQImpl
, IXAPOParameters_iface
);
460 static HRESULT WINAPI
EQXAPO_QueryInterface(IXAPO
*iface
, REFIID riid
, void **ppvObject
)
462 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
464 TRACE("%p, %s, %p\n", This
, wine_dbgstr_guid(riid
), ppvObject
);
466 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
467 IsEqualGUID(riid
, &IID_IXAPO
) ||
468 IsEqualGUID(riid
, &IID_IXAPO27
))
469 *ppvObject
= &This
->IXAPO_iface
;
470 else if(IsEqualGUID(riid
, &IID_IXAPOParameters
))
471 *ppvObject
= &This
->IXAPOParameters_iface
;
476 IUnknown_AddRef((IUnknown
*)*ppvObject
);
480 return E_NOINTERFACE
;
483 static ULONG WINAPI
EQXAPO_AddRef(IXAPO
*iface
)
485 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
486 ULONG ref
= InterlockedIncrement(&This
->ref
);
487 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
491 static ULONG WINAPI
EQXAPO_Release(IXAPO
*iface
)
493 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
494 ULONG ref
= InterlockedDecrement(&This
->ref
);
496 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
499 HeapFree(GetProcessHeap(), 0, This
);
504 static HRESULT WINAPI
EQXAPO_GetRegistrationProperties(IXAPO
*iface
,
505 XAPO_REGISTRATION_PROPERTIES
**props
)
507 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
508 TRACE("%p, %p\n", This
, props
);
509 /* TODO: check for version == 20 and use XAPO20_REGISTRATION_PROPERTIES */
513 static HRESULT WINAPI
EQXAPO_IsInputFormatSupported(IXAPO
*iface
,
514 const WAVEFORMATEX
*output_fmt
, const WAVEFORMATEX
*input_fmt
,
515 WAVEFORMATEX
**supported_fmt
)
517 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
518 TRACE("%p, %p, %p, %p\n", This
, output_fmt
, input_fmt
, supported_fmt
);
522 static HRESULT WINAPI
EQXAPO_IsOutputFormatSupported(IXAPO
*iface
,
523 const WAVEFORMATEX
*input_fmt
, const WAVEFORMATEX
*output_fmt
,
524 WAVEFORMATEX
**supported_fmt
)
526 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
527 TRACE("%p, %p, %p, %p\n", This
, input_fmt
, output_fmt
, supported_fmt
);
531 static HRESULT WINAPI
EQXAPO_Initialize(IXAPO
*iface
, const void *data
,
534 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
535 TRACE("%p, %p, %u\n", This
, data
, data_len
);
539 static HRESULT WINAPI
EQXAPO_Reset(IXAPO
*iface
)
541 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
546 static HRESULT WINAPI
EQXAPO_LockForProcess(IXAPO
*iface
, UINT32 in_params_count
,
547 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*in_params
,
548 UINT32 out_params_count
,
549 const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
*out_params
)
551 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
552 TRACE("%p, %u, %p, %u, %p\n", This
, in_params_count
, in_params
,
553 out_params_count
, out_params
);
557 static void WINAPI
EQXAPO_UnlockForProcess(IXAPO
*iface
)
559 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
563 static void WINAPI
EQXAPO_Process(IXAPO
*iface
, UINT32 in_params_count
,
564 const XAPO_PROCESS_BUFFER_PARAMETERS
*in_params
,
565 UINT32 out_params_count
,
566 const XAPO_PROCESS_BUFFER_PARAMETERS
*out_params
, BOOL enabled
)
568 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
569 TRACE("%p, %u, %p, %u, %p, %u\n", This
, in_params_count
, in_params
,
570 out_params_count
, out_params
, enabled
);
573 static UINT32 WINAPI
EQXAPO_CalcInputFrames(IXAPO
*iface
, UINT32 output_frames
)
575 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
576 TRACE("%p, %u\n", This
, output_frames
);
580 static UINT32 WINAPI
EQXAPO_CalcOutputFrames(IXAPO
*iface
, UINT32 input_frames
)
582 EQImpl
*This
= EQImpl_from_IXAPO(iface
);
583 TRACE("%p, %u\n", This
, input_frames
);
587 static const IXAPOVtbl EQXAPO_Vtbl
= {
588 EQXAPO_QueryInterface
,
591 EQXAPO_GetRegistrationProperties
,
592 EQXAPO_IsInputFormatSupported
,
593 EQXAPO_IsOutputFormatSupported
,
596 EQXAPO_LockForProcess
,
597 EQXAPO_UnlockForProcess
,
599 EQXAPO_CalcInputFrames
,
600 EQXAPO_CalcOutputFrames
603 static HRESULT WINAPI
EQXAPOParams_QueryInterface(IXAPOParameters
*iface
,
604 REFIID riid
, void **ppvObject
)
606 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
607 return EQXAPO_QueryInterface(&This
->IXAPO_iface
, riid
, ppvObject
);
610 static ULONG WINAPI
EQXAPOParams_AddRef(IXAPOParameters
*iface
)
612 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
613 return EQXAPO_AddRef(&This
->IXAPO_iface
);
616 static ULONG WINAPI
EQXAPOParams_Release(IXAPOParameters
*iface
)
618 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
619 return EQXAPO_Release(&This
->IXAPO_iface
);
622 static void WINAPI
EQXAPOParams_SetParameters(IXAPOParameters
*iface
,
623 const void *params
, UINT32 params_len
)
625 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
626 TRACE("%p, %p, %u\n", This
, params
, params_len
);
629 static void WINAPI
EQXAPOParams_GetParameters(IXAPOParameters
*iface
, void *params
,
632 EQImpl
*This
= EQImpl_from_IXAPOParameters(iface
);
633 TRACE("%p, %p, %u\n", This
, params
, params_len
);
636 static const IXAPOParametersVtbl EQXAPOParameters_Vtbl
= {
637 EQXAPOParams_QueryInterface
,
639 EQXAPOParams_Release
,
640 EQXAPOParams_SetParameters
,
641 EQXAPOParams_GetParameters
645 IClassFactory IClassFactory_iface
;
651 static struct xapo_cf
*xapo_impl_from_IClassFactory(IClassFactory
*iface
)
653 return CONTAINING_RECORD(iface
, struct xapo_cf
, IClassFactory_iface
);
656 static HRESULT WINAPI
xapocf_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppobj
)
658 if(IsEqualGUID(riid
, &IID_IUnknown
)
659 || IsEqualGUID(riid
, &IID_IClassFactory
))
661 IClassFactory_AddRef(iface
);
667 WARN("(%p)->(%s, %p): interface not found\n", iface
, debugstr_guid(riid
), ppobj
);
668 return E_NOINTERFACE
;
671 static ULONG WINAPI
xapocf_AddRef(IClassFactory
*iface
)
673 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
674 ULONG ref
= InterlockedIncrement(&This
->ref
);
675 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
679 static ULONG WINAPI
xapocf_Release(IClassFactory
*iface
)
681 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
682 ULONG ref
= InterlockedDecrement(&This
->ref
);
683 TRACE("(%p)->(): Refcount now %u\n", This
, ref
);
685 HeapFree(GetProcessHeap(), 0, This
);
689 static HRESULT WINAPI
xapocf_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
690 REFIID riid
, void **ppobj
)
692 struct xapo_cf
*This
= xapo_impl_from_IClassFactory(iface
);
695 TRACE("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
700 return CLASS_E_NOAGGREGATION
;
702 if(IsEqualGUID(This
->class, &CLSID_AudioVolumeMeter
)){
705 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
707 return E_OUTOFMEMORY
;
709 object
->IXAPO_iface
.lpVtbl
= &VUMXAPO_Vtbl
;
710 object
->IXAPOParameters_iface
.lpVtbl
= &VUMXAPOParameters_Vtbl
;
711 object
->version
= This
->version
;
713 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
715 HeapFree(GetProcessHeap(), 0, object
);
718 }else if(IsEqualGUID(This
->class, &CLSID_AudioReverb
)){
721 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
723 return E_OUTOFMEMORY
;
725 object
->IXAPO_iface
.lpVtbl
= &RVBXAPO_Vtbl
;
726 object
->IXAPOParameters_iface
.lpVtbl
= &RVBXAPOParameters_Vtbl
;
727 object
->version
= This
->version
;
729 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
731 HeapFree(GetProcessHeap(), 0, object
);
734 }else if(IsEqualGUID(This
->class, &CLSID_FXEQ
)){
737 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
739 return E_OUTOFMEMORY
;
741 object
->IXAPO_iface
.lpVtbl
= &EQXAPO_Vtbl
;
742 object
->IXAPOParameters_iface
.lpVtbl
= &EQXAPOParameters_Vtbl
;
743 object
->version
= This
->version
;
745 hr
= IXAPO_QueryInterface(&object
->IXAPO_iface
, riid
, ppobj
);
747 HeapFree(GetProcessHeap(), 0, object
);
756 static HRESULT WINAPI
xapocf_LockServer(IClassFactory
*iface
, BOOL dolock
)
758 FIXME("(static)->(%d): stub!\n", dolock
);
762 static const IClassFactoryVtbl xapo_Vtbl
=
764 xapocf_QueryInterface
,
767 xapocf_CreateInstance
,
771 IClassFactory
*make_xapo_factory(REFCLSID clsid
, DWORD version
)
773 struct xapo_cf
*ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(struct xapo_cf
));
774 ret
->IClassFactory_iface
.lpVtbl
= &xapo_Vtbl
;
775 ret
->version
= version
;
778 return &ret
->IClassFactory_iface
;