TESTING -- override pthreads to fix gstreamer v5
[wine/multimedia.git] / dlls / xaudio2_7 / xapofx.c
blobe4e4bf88a7eacc8a2a75c77e2dffb1f4400868c5
1 /*
2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
23 #define NONAMELESSUNION
24 #define COBJMACROS
26 #include "xaudio_private.h"
27 #include "xapofx.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
33 typedef struct _VUMeterImpl {
34 IXAPO IXAPO_iface;
35 IXAPOParameters IXAPOParameters_iface;
37 LONG ref;
39 DWORD version;
40 } VUMeterImpl;
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,
53 void **ppvObject)
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;
65 else
66 *ppvObject = NULL;
68 if(*ppvObject){
69 IUnknown_AddRef((IUnknown*)*ppvObject);
70 return S_OK;
73 return E_NOINTERFACE;
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);
81 return 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);
91 if(!ref)
92 HeapFree(GetProcessHeap(), 0, This);
94 return ref;
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 */
103 return E_NOTIMPL;
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);
112 return E_NOTIMPL;
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);
121 return E_NOTIMPL;
124 static HRESULT WINAPI VUMXAPO_Initialize(IXAPO *iface, const void *data,
125 UINT32 data_len)
127 VUMeterImpl *This = VUMeterImpl_from_IXAPO(iface);
128 TRACE("%p, %p, %u\n", This, data, data_len);
129 return E_NOTIMPL;
132 static HRESULT WINAPI VUMXAPO_Reset(IXAPO *iface)
134 VUMeterImpl *This = VUMeterImpl_from_IXAPO(iface);
135 TRACE("%p\n", This);
136 return E_NOTIMPL;
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);
148 return E_NOTIMPL;
151 static void WINAPI VUMXAPO_UnlockForProcess(IXAPO *iface)
153 VUMeterImpl *This = VUMeterImpl_from_IXAPO(iface);
154 TRACE("%p\n", This);
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);
171 return 0;
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);
178 return 0;
181 static const IXAPOVtbl VUMXAPO_Vtbl = {
182 VUMXAPO_QueryInterface,
183 VUMXAPO_AddRef,
184 VUMXAPO_Release,
185 VUMXAPO_GetRegistrationProperties,
186 VUMXAPO_IsInputFormatSupported,
187 VUMXAPO_IsOutputFormatSupported,
188 VUMXAPO_Initialize,
189 VUMXAPO_Reset,
190 VUMXAPO_LockForProcess,
191 VUMXAPO_UnlockForProcess,
192 VUMXAPO_Process,
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 {
239 IXAPO IXAPO_iface;
240 IXAPOParameters IXAPOParameters_iface;
242 LONG ref;
244 DWORD version;
245 } ReverbImpl;
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;
269 else
270 *ppvObject = NULL;
272 if(*ppvObject){
273 IUnknown_AddRef((IUnknown*)*ppvObject);
274 return S_OK;
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);
285 return 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);
295 if(!ref)
296 HeapFree(GetProcessHeap(), 0, This);
298 return ref;
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 */
307 return E_NOTIMPL;
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);
316 return E_NOTIMPL;
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);
325 return E_NOTIMPL;
328 static HRESULT WINAPI RVBXAPO_Initialize(IXAPO *iface, const void *data,
329 UINT32 data_len)
331 ReverbImpl *This = ReverbImpl_from_IXAPO(iface);
332 TRACE("%p, %p, %u\n", This, data, data_len);
333 return E_NOTIMPL;
336 static HRESULT WINAPI RVBXAPO_Reset(IXAPO *iface)
338 ReverbImpl *This = ReverbImpl_from_IXAPO(iface);
339 TRACE("%p\n", This);
340 return E_NOTIMPL;
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);
351 return E_NOTIMPL;
354 static void WINAPI RVBXAPO_UnlockForProcess(IXAPO *iface)
356 ReverbImpl *This = ReverbImpl_from_IXAPO(iface);
357 TRACE("%p\n", This);
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);
374 return 0;
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);
381 return 0;
384 static const IXAPOVtbl RVBXAPO_Vtbl = {
385 RVBXAPO_QueryInterface,
386 RVBXAPO_AddRef,
387 RVBXAPO_Release,
388 RVBXAPO_GetRegistrationProperties,
389 RVBXAPO_IsInputFormatSupported,
390 RVBXAPO_IsOutputFormatSupported,
391 RVBXAPO_Initialize,
392 RVBXAPO_Reset,
393 RVBXAPO_LockForProcess,
394 RVBXAPO_UnlockForProcess,
395 RVBXAPO_Process,
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,
427 UINT32 params_len)
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 {
442 IXAPO IXAPO_iface;
443 IXAPOParameters IXAPOParameters_iface;
445 LONG ref;
447 DWORD version;
448 } EQImpl;
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;
472 else
473 *ppvObject = NULL;
475 if(*ppvObject){
476 IUnknown_AddRef((IUnknown*)*ppvObject);
477 return S_OK;
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);
488 return 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);
498 if(!ref)
499 HeapFree(GetProcessHeap(), 0, This);
501 return ref;
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 */
510 return E_NOTIMPL;
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);
519 return E_NOTIMPL;
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);
528 return E_NOTIMPL;
531 static HRESULT WINAPI EQXAPO_Initialize(IXAPO *iface, const void *data,
532 UINT32 data_len)
534 EQImpl *This = EQImpl_from_IXAPO(iface);
535 TRACE("%p, %p, %u\n", This, data, data_len);
536 return E_NOTIMPL;
539 static HRESULT WINAPI EQXAPO_Reset(IXAPO *iface)
541 EQImpl *This = EQImpl_from_IXAPO(iface);
542 TRACE("%p\n", This);
543 return E_NOTIMPL;
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);
554 return E_NOTIMPL;
557 static void WINAPI EQXAPO_UnlockForProcess(IXAPO *iface)
559 EQImpl *This = EQImpl_from_IXAPO(iface);
560 TRACE("%p\n", This);
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);
577 return 0;
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);
584 return 0;
587 static const IXAPOVtbl EQXAPO_Vtbl = {
588 EQXAPO_QueryInterface,
589 EQXAPO_AddRef,
590 EQXAPO_Release,
591 EQXAPO_GetRegistrationProperties,
592 EQXAPO_IsInputFormatSupported,
593 EQXAPO_IsOutputFormatSupported,
594 EQXAPO_Initialize,
595 EQXAPO_Reset,
596 EQXAPO_LockForProcess,
597 EQXAPO_UnlockForProcess,
598 EQXAPO_Process,
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,
630 UINT32 params_len)
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,
638 EQXAPOParams_AddRef,
639 EQXAPOParams_Release,
640 EQXAPOParams_SetParameters,
641 EQXAPOParams_GetParameters
644 struct xapo_cf {
645 IClassFactory IClassFactory_iface;
646 LONG ref;
647 DWORD version;
648 const CLSID *class;
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);
662 *ppobj = iface;
663 return S_OK;
666 *ppobj = NULL;
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);
676 return 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);
684 if (!ref)
685 HeapFree(GetProcessHeap(), 0, This);
686 return ref;
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);
693 HRESULT hr;
695 TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
697 *ppobj = NULL;
699 if(pOuter)
700 return CLASS_E_NOAGGREGATION;
702 if(IsEqualGUID(This->class, &CLSID_AudioVolumeMeter)){
703 VUMeterImpl *object;
705 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
706 if(!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);
714 if(FAILED(hr)){
715 HeapFree(GetProcessHeap(), 0, object);
716 return hr;
718 }else if(IsEqualGUID(This->class, &CLSID_AudioReverb)){
719 ReverbImpl *object;
721 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
722 if(!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);
730 if(FAILED(hr)){
731 HeapFree(GetProcessHeap(), 0, object);
732 return hr;
734 }else if(IsEqualGUID(This->class, &CLSID_FXEQ)){
735 EQImpl *object;
737 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
738 if(!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);
746 if(FAILED(hr)){
747 HeapFree(GetProcessHeap(), 0, object);
748 return hr;
750 }else
751 return E_INVALIDARG;
753 return S_OK;
756 static HRESULT WINAPI xapocf_LockServer(IClassFactory *iface, BOOL dolock)
758 FIXME("(static)->(%d): stub!\n", dolock);
759 return S_OK;
762 static const IClassFactoryVtbl xapo_Vtbl =
764 xapocf_QueryInterface,
765 xapocf_AddRef,
766 xapocf_Release,
767 xapocf_CreateInstance,
768 xapocf_LockServer
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;
776 ret->class = clsid;
777 ret->ref = 0;
778 return &ret->IClassFactory_iface;