2 * Copyright 2019 Alistair Leslie-Hughes
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
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(dsdmo
);
35 IMediaObject IMediaObject_iface
;
36 IMediaObjectInPlace IMediaObjectInPlace_iface
;
37 IMediaParams IMediaParams_iface
;
38 IMediaParamInfo IMediaParamInfo_iface
;
39 IUnknown IUnknown_inner
;
46 const struct effect_ops
*ops
;
51 void *(*query_interface
)(struct effect
*effect
, REFIID iid
);
52 void (*destroy
)(struct effect
*effect
);
55 static struct effect
*impl_from_IUnknown(IUnknown
*iface
)
57 return CONTAINING_RECORD(iface
, struct effect
, IUnknown_inner
);
60 static HRESULT WINAPI
effect_inner_QueryInterface(IUnknown
*iface
, REFIID iid
, void **out
)
62 struct effect
*effect
= impl_from_IUnknown(iface
);
64 TRACE("effect %p, iid %s, out %p.\n", effect
, debugstr_guid(iid
), out
);
66 if (IsEqualGUID(iid
, &IID_IUnknown
))
68 else if (IsEqualGUID(iid
, &IID_IMediaObject
))
69 *out
= &effect
->IMediaObject_iface
;
70 else if (IsEqualGUID(iid
, &IID_IMediaObjectInPlace
))
71 *out
= &effect
->IMediaObjectInPlace_iface
;
72 else if (IsEqualGUID(iid
, &IID_IMediaParams
))
73 *out
= &effect
->IMediaParams_iface
;
74 else if (IsEqualGUID(iid
, &IID_IMediaParamInfo
))
75 *out
= &effect
->IMediaParamInfo_iface
;
76 else if (!(*out
= effect
->ops
->query_interface(effect
, iid
)))
78 WARN("%s not implemented; returning E_NOINTERFACE.\n", debugstr_guid(iid
));
82 IUnknown_AddRef((IUnknown
*)*out
);
86 static ULONG WINAPI
effect_inner_AddRef(IUnknown
*iface
)
88 struct effect
*effect
= impl_from_IUnknown(iface
);
89 ULONG refcount
= InterlockedIncrement(&effect
->refcount
);
91 TRACE("%p increasing refcount to %lu.\n", effect
, refcount
);
95 static ULONG WINAPI
effect_inner_Release(IUnknown
*iface
)
97 struct effect
*effect
= impl_from_IUnknown(iface
);
98 ULONG refcount
= InterlockedDecrement(&effect
->refcount
);
100 TRACE("%p decreasing refcount to %lu.\n", effect
, refcount
);
104 effect
->cs
.DebugInfo
->Spare
[0] = 0;
105 DeleteCriticalSection(&effect
->cs
);
106 effect
->ops
->destroy(effect
);
111 static const IUnknownVtbl effect_inner_vtbl
=
113 effect_inner_QueryInterface
,
115 effect_inner_Release
,
118 static struct effect
*impl_from_IMediaObject(IMediaObject
*iface
)
120 return CONTAINING_RECORD(iface
, struct effect
, IMediaObject_iface
);
123 static HRESULT WINAPI
effect_QueryInterface(IMediaObject
*iface
, REFIID iid
, void **out
)
125 struct effect
*effect
= impl_from_IMediaObject(iface
);
126 return IUnknown_QueryInterface(effect
->outer_unk
, iid
, out
);
129 static ULONG WINAPI
effect_AddRef(IMediaObject
*iface
)
131 struct effect
*effect
= impl_from_IMediaObject(iface
);
132 return IUnknown_AddRef(effect
->outer_unk
);
135 static ULONG WINAPI
effect_Release(IMediaObject
*iface
)
137 struct effect
*effect
= impl_from_IMediaObject(iface
);
138 return IUnknown_Release(effect
->outer_unk
);
141 static HRESULT WINAPI
effect_GetStreamCount(IMediaObject
*iface
, DWORD
*input
, DWORD
*output
)
143 FIXME("iface %p, input %p, output %p, stub!\n", iface
, input
, output
);
147 static HRESULT WINAPI
effect_GetInputStreamInfo(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
149 FIXME("iface %p, index %lu, flags %p, stub!\n", iface
, index
, flags
);
153 static HRESULT WINAPI
effect_GetOutputStreamInfo(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
155 FIXME("iface %p, index %lu, flags %p, stub!\n", iface
, index
, flags
);
159 static HRESULT WINAPI
effect_GetInputType(IMediaObject
*iface
, DWORD index
, DWORD type_index
, DMO_MEDIA_TYPE
*type
)
161 FIXME("iface %p, index %lu, type_index %lu, type %p, stub!\n", iface
, index
, type_index
, type
);
165 static HRESULT WINAPI
effect_GetOutputType(IMediaObject
*iface
, DWORD index
, DWORD type_index
, DMO_MEDIA_TYPE
*type
)
167 FIXME("iface %p, index %lu, type_index %lu, type %p, stub!\n", iface
, index
, type_index
, type
);
171 static HRESULT WINAPI
effect_SetInputType(IMediaObject
*iface
, DWORD index
, const DMO_MEDIA_TYPE
*type
, DWORD flags
)
173 struct effect
*effect
= impl_from_IMediaObject(iface
);
174 const WAVEFORMATEX
*format
;
176 TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface
, index
, type
, flags
);
178 if (flags
& DMO_SET_TYPEF_CLEAR
)
180 EnterCriticalSection(&effect
->cs
);
181 memset(&effect
->format
, 0, sizeof(effect
->format
));
182 LeaveCriticalSection(&effect
->cs
);
186 if (!IsEqualGUID(&type
->majortype
, &MEDIATYPE_Audio
))
187 return DMO_E_TYPE_NOT_ACCEPTED
;
189 if (!IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_PCM
)
190 && !IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_IEEE_FLOAT
))
191 return DMO_E_TYPE_NOT_ACCEPTED
;
193 if (!IsEqualGUID(&type
->formattype
, &FORMAT_WaveFormatEx
))
194 return DMO_E_TYPE_NOT_ACCEPTED
;
196 format
= (const WAVEFORMATEX
*)type
->pbFormat
;
197 if (format
->wFormatTag
== WAVE_FORMAT_PCM
)
199 if (format
->wBitsPerSample
!= 8 && format
->wBitsPerSample
!= 16)
201 WARN("Rejecting %u-bit integer PCM.\n", format
->wBitsPerSample
);
202 return DMO_E_TYPE_NOT_ACCEPTED
;
205 else if (format
->wFormatTag
== WAVE_FORMAT_IEEE_FLOAT
)
207 if (format
->wBitsPerSample
!= 32)
209 WARN("Rejecting %u-bit float PCM.\n", format
->wBitsPerSample
);
210 return DMO_E_TYPE_NOT_ACCEPTED
;
215 WARN("Rejecting tag %#x.\n", format
->wFormatTag
);
216 return DMO_E_TYPE_NOT_ACCEPTED
;
219 if (format
->nChannels
!= 1 && format
->nChannels
!= 2)
221 WARN("Rejecting %u channels.\n", format
->nChannels
);
222 return DMO_E_TYPE_NOT_ACCEPTED
;
225 EnterCriticalSection(&effect
->cs
);
226 effect
->format
= *format
;
227 LeaveCriticalSection(&effect
->cs
);
232 static HRESULT WINAPI
effect_SetOutputType(IMediaObject
*iface
, DWORD index
, const DMO_MEDIA_TYPE
*type
, DWORD flags
)
234 struct effect
*effect
= impl_from_IMediaObject(iface
);
237 TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface
, index
, type
, flags
);
239 if (flags
& DMO_SET_TYPEF_CLEAR
)
242 if (!IsEqualGUID(&type
->majortype
, &MEDIATYPE_Audio
))
243 return DMO_E_TYPE_NOT_ACCEPTED
;
245 if (!IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_PCM
)
246 && !IsEqualGUID(&type
->subtype
, &MEDIASUBTYPE_IEEE_FLOAT
))
247 return DMO_E_TYPE_NOT_ACCEPTED
;
249 if (!IsEqualGUID(&type
->formattype
, &FORMAT_WaveFormatEx
))
250 return DMO_E_TYPE_NOT_ACCEPTED
;
252 EnterCriticalSection(&effect
->cs
);
253 hr
= memcmp(type
->pbFormat
, &effect
->format
, sizeof(WAVEFORMATEX
)) ? DMO_E_TYPE_NOT_ACCEPTED
: S_OK
;
254 LeaveCriticalSection(&effect
->cs
);
259 static HRESULT WINAPI
effect_GetInputCurrentType(IMediaObject
*iface
, DWORD index
, DMO_MEDIA_TYPE
*type
)
261 FIXME("iface %p, index %lu, type %p, stub!\n", iface
, index
, type
);
265 static HRESULT WINAPI
effect_GetOutputCurrentType(IMediaObject
*iface
, DWORD index
, DMO_MEDIA_TYPE
*type
)
267 FIXME("iface %p, index %lu, type %p, stub!\n", iface
, index
, type
);
271 static HRESULT WINAPI
effect_GetInputSizeInfo(IMediaObject
*iface
, DWORD index
,
272 DWORD
*size
, DWORD
*lookahead
, DWORD
*alignment
)
274 FIXME("iface %p, index %lu, size %p, lookahead %p, alignment %p, stub!\n", iface
, index
, size
, lookahead
, alignment
);
278 static HRESULT WINAPI
effect_GetOutputSizeInfo(IMediaObject
*iface
, DWORD index
, DWORD
*size
, DWORD
*alignment
)
280 FIXME("iface %p, index %lu, size %p, alignment %p, stub!\n", iface
, index
, size
, alignment
);
284 static HRESULT WINAPI
effect_GetInputMaxLatency(IMediaObject
*iface
, DWORD index
, REFERENCE_TIME
*latency
)
286 FIXME("iface %p, index %lu, latency %p, stub!\n", iface
, index
, latency
);
290 static HRESULT WINAPI
effect_SetInputMaxLatency(IMediaObject
*iface
, DWORD index
, REFERENCE_TIME latency
)
292 FIXME("iface %p, index %lu, latency %s, stub!\n", iface
, index
, wine_dbgstr_longlong(latency
));
296 static HRESULT WINAPI
effect_Flush(IMediaObject
*iface
)
298 FIXME("iface %p, stub!\n", iface
);
302 static HRESULT WINAPI
effect_Discontinuity(IMediaObject
*iface
, DWORD index
)
304 FIXME("iface %p, index %lu, stub!\n", iface
, index
);
308 static HRESULT WINAPI
effect_AllocateStreamingResources(IMediaObject
*iface
)
310 FIXME("iface %p, stub!\n", iface
);
314 static HRESULT WINAPI
effect_FreeStreamingResources(IMediaObject
*iface
)
316 FIXME("iface %p, stub!\n", iface
);
320 static HRESULT WINAPI
effect_GetInputStatus(IMediaObject
*iface
, DWORD index
, DWORD
*flags
)
322 FIXME("iface %p, index %lu, flags %p, stub!\n", iface
, index
, flags
);
326 static HRESULT WINAPI
effect_ProcessInput(IMediaObject
*iface
, DWORD index
,
327 IMediaBuffer
*buffer
, DWORD flags
, REFERENCE_TIME timestamp
, REFERENCE_TIME timelength
)
329 FIXME("iface %p, index %lu, buffer %p, flags %#lx, timestamp %s, timelength %s, stub!\n",
330 iface
, index
, buffer
, flags
, wine_dbgstr_longlong(timestamp
), wine_dbgstr_longlong(timelength
));
334 static HRESULT WINAPI
effect_ProcessOutput(IMediaObject
*iface
, DWORD flags
,
335 DWORD count
, DMO_OUTPUT_DATA_BUFFER
*buffers
, DWORD
*status
)
337 FIXME("iface %p, flags %#lx, count %lu, buffers %p, status %p, stub!\n", iface
, flags
, count
, buffers
, status
);
341 static HRESULT WINAPI
effect_Lock(IMediaObject
*iface
, LONG lock
)
343 FIXME("iface %p, lock %ld, stub!\n", iface
, lock
);
347 static const IMediaObjectVtbl effect_vtbl
=
349 effect_QueryInterface
,
352 effect_GetStreamCount
,
353 effect_GetInputStreamInfo
,
354 effect_GetOutputStreamInfo
,
356 effect_GetOutputType
,
358 effect_SetOutputType
,
359 effect_GetInputCurrentType
,
360 effect_GetOutputCurrentType
,
361 effect_GetInputSizeInfo
,
362 effect_GetOutputSizeInfo
,
363 effect_GetInputMaxLatency
,
364 effect_SetInputMaxLatency
,
366 effect_Discontinuity
,
367 effect_AllocateStreamingResources
,
368 effect_FreeStreamingResources
,
369 effect_GetInputStatus
,
371 effect_ProcessOutput
,
375 static struct effect
*impl_from_IMediaObjectInPlace(IMediaObjectInPlace
*iface
)
377 return CONTAINING_RECORD(iface
, struct effect
, IMediaObjectInPlace_iface
);
380 static HRESULT WINAPI
effect_inplace_QueryInterface(IMediaObjectInPlace
*iface
, REFIID iid
, void **out
)
382 struct effect
*effect
= impl_from_IMediaObjectInPlace(iface
);
383 return IUnknown_QueryInterface(effect
->outer_unk
, iid
, out
);
386 static ULONG WINAPI
effect_inplace_AddRef(IMediaObjectInPlace
*iface
)
388 struct effect
*effect
= impl_from_IMediaObjectInPlace(iface
);
389 return IUnknown_AddRef(effect
->outer_unk
);
392 static ULONG WINAPI
effect_inplace_Release(IMediaObjectInPlace
*iface
)
394 struct effect
*effect
= impl_from_IMediaObjectInPlace(iface
);
395 return IUnknown_Release(effect
->outer_unk
);
398 static HRESULT WINAPI
effect_inplace_Process(IMediaObjectInPlace
*iface
, ULONG size
,
399 BYTE
*data
, REFERENCE_TIME start
, DWORD flags
)
401 FIXME("iface %p, size %lu, data %p, start %s, flags %#lx, stub!\n",
402 iface
, size
, data
, wine_dbgstr_longlong(start
), flags
);
406 static HRESULT WINAPI
effect_inplace_Clone(IMediaObjectInPlace
*iface
, IMediaObjectInPlace
**out
)
408 FIXME("iface %p, out %p, stub!\n", iface
, out
);
412 static HRESULT WINAPI
effect_inplace_GetLatency(IMediaObjectInPlace
*iface
, REFERENCE_TIME
*latency
)
414 FIXME("iface %p, latency %p, stub!\n", iface
, latency
);
418 static const IMediaObjectInPlaceVtbl effect_inplace_vtbl
=
420 effect_inplace_QueryInterface
,
421 effect_inplace_AddRef
,
422 effect_inplace_Release
,
423 effect_inplace_Process
,
424 effect_inplace_Clone
,
425 effect_inplace_GetLatency
,
428 static struct effect
*impl_from_IMediaParams(IMediaParams
*iface
)
430 return CONTAINING_RECORD(iface
, struct effect
, IMediaParams_iface
);
433 static HRESULT WINAPI
effect_media_params_QueryInterface(IMediaParams
*iface
, REFIID iid
, void **out
)
435 struct effect
*effect
= impl_from_IMediaParams(iface
);
436 return IUnknown_QueryInterface(effect
->outer_unk
, iid
, out
);
439 static ULONG WINAPI
effect_media_params_AddRef(IMediaParams
*iface
)
441 struct effect
*effect
= impl_from_IMediaParams(iface
);
442 return IUnknown_AddRef(effect
->outer_unk
);
445 static ULONG WINAPI
effect_media_params_Release(IMediaParams
*iface
)
447 struct effect
*effect
= impl_from_IMediaParams(iface
);
448 return IUnknown_Release(effect
->outer_unk
);
451 static HRESULT WINAPI
effect_media_params_GetParam(IMediaParams
*iface
, DWORD index
, MP_DATA
*data
)
453 FIXME("iface %p, index %lu, data %p, stub!\n", iface
, index
, data
);
457 static HRESULT WINAPI
effect_media_params_SetParam(IMediaParams
*iface
, DWORD index
, MP_DATA data
)
459 FIXME("iface %p, index %lu, data %f, stub!\n", iface
, index
, data
);
463 static HRESULT WINAPI
effect_media_params_AddEnvelope(IMediaParams
*iface
, DWORD index
, DWORD count
,
464 MP_ENVELOPE_SEGMENT
*segments
)
466 FIXME("iface %p, index %lu, count %lu, segments %p, stub!\n", iface
, index
, count
, segments
);
470 static HRESULT WINAPI
effect_media_params_FlushEnvelope(IMediaParams
*iface
, DWORD index
,
471 REFERENCE_TIME start
, REFERENCE_TIME end
)
473 FIXME("iface %p, index %lu, start %s, end %s, stub!\n", iface
, index
,
474 wine_dbgstr_longlong(start
), wine_dbgstr_longlong(end
));
478 static HRESULT WINAPI
effect_media_params_SetTimeFormat(IMediaParams
*iface
, GUID guid
,
479 MP_TIMEDATA time_data
)
481 FIXME("iface %p, guid %s, time_data %lx, stub!\n", iface
, wine_dbgstr_guid(&guid
), time_data
);
485 static const IMediaParamsVtbl effect_media_params_vtbl
=
487 effect_media_params_QueryInterface
,
488 effect_media_params_AddRef
,
489 effect_media_params_Release
,
490 effect_media_params_GetParam
,
491 effect_media_params_SetParam
,
492 effect_media_params_AddEnvelope
,
493 effect_media_params_FlushEnvelope
,
494 effect_media_params_SetTimeFormat
,
497 static struct effect
*impl_from_IMediaParamInfo(IMediaParamInfo
*iface
)
499 return CONTAINING_RECORD(iface
, struct effect
, IMediaParamInfo_iface
);
502 static HRESULT WINAPI
effect_media_param_info_QueryInterface(IMediaParamInfo
*iface
, REFIID iid
, void **out
)
504 struct effect
*effect
= impl_from_IMediaParamInfo(iface
);
505 return IUnknown_QueryInterface(effect
->outer_unk
, iid
, out
);
508 static ULONG WINAPI
effect_media_param_info_AddRef(IMediaParamInfo
*iface
)
510 struct effect
*effect
= impl_from_IMediaParamInfo(iface
);
511 return IUnknown_AddRef(effect
->outer_unk
);
514 static ULONG WINAPI
effect_media_param_info_Release(IMediaParamInfo
*iface
)
516 struct effect
*effect
= impl_from_IMediaParamInfo(iface
);
517 return IUnknown_Release(effect
->outer_unk
);
520 static HRESULT WINAPI
effect_media_param_info_GetParamCount(IMediaParamInfo
*iface
, DWORD
*count
)
522 FIXME("iface %p, count %p, stub!\n", iface
, count
);
526 static HRESULT WINAPI
effect_media_param_info_GetParamInfo(IMediaParamInfo
*iface
, DWORD index
, MP_PARAMINFO
*info
)
528 FIXME("iface %p, index %lu, info %p, stub!\n", iface
, index
, info
);
532 static HRESULT WINAPI
effect_media_param_info_GetParamText(IMediaParamInfo
*iface
, DWORD index
, WCHAR
**text
)
534 FIXME("iface %p, index %lu, text %p, stub!\n", iface
, index
, text
);
538 static HRESULT WINAPI
effect_media_param_info_GetNumTimeFormats(IMediaParamInfo
*iface
, DWORD
*count
)
540 FIXME("iface %p, count %p, stub!\n", iface
, count
);
544 static HRESULT WINAPI
effect_media_param_info_GetSupportedTimeFormat(IMediaParamInfo
*iface
, DWORD index
, GUID
*guid
)
546 FIXME("iface %p, index %lu, guid %p, stub!\n", iface
, index
, guid
);
550 static HRESULT WINAPI
effect_media_param_info_GetCurrentTimeFormat(IMediaParamInfo
*iface
, GUID
*guid
, MP_TIMEDATA
*time_data
)
552 FIXME("iface %p, guid %p, time_data %p, stub!\n", iface
, guid
, time_data
);
556 static const IMediaParamInfoVtbl effect_media_param_info_vtbl
=
558 effect_media_param_info_QueryInterface
,
559 effect_media_param_info_AddRef
,
560 effect_media_param_info_Release
,
561 effect_media_param_info_GetParamCount
,
562 effect_media_param_info_GetParamInfo
,
563 effect_media_param_info_GetParamText
,
564 effect_media_param_info_GetNumTimeFormats
,
565 effect_media_param_info_GetSupportedTimeFormat
,
566 effect_media_param_info_GetCurrentTimeFormat
,
569 static void effect_init(struct effect
*effect
, IUnknown
*outer
, const struct effect_ops
*ops
)
571 effect
->outer_unk
= outer
? outer
: &effect
->IUnknown_inner
;
572 effect
->refcount
= 1;
573 effect
->IUnknown_inner
.lpVtbl
= &effect_inner_vtbl
;
574 effect
->IMediaObject_iface
.lpVtbl
= &effect_vtbl
;
575 effect
->IMediaObjectInPlace_iface
.lpVtbl
= &effect_inplace_vtbl
;
576 effect
->IMediaParams_iface
.lpVtbl
= &effect_media_params_vtbl
;
577 effect
->IMediaParamInfo_iface
.lpVtbl
= &effect_media_param_info_vtbl
;
579 InitializeCriticalSection(&effect
->cs
);
580 effect
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": effect.cs");
587 struct effect effect
;
588 IDirectSoundFXParamEq IDirectSoundFXParamEq_iface
;
592 static struct eq
*impl_from_IDirectSoundFXParamEq(IDirectSoundFXParamEq
*iface
)
594 return CONTAINING_RECORD(iface
, struct eq
, IDirectSoundFXParamEq_iface
);
597 static HRESULT WINAPI
eq_params_QueryInterface(IDirectSoundFXParamEq
*iface
, REFIID iid
, void **out
)
599 struct eq
*effect
= impl_from_IDirectSoundFXParamEq(iface
);
600 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
603 static ULONG WINAPI
eq_params_AddRef(IDirectSoundFXParamEq
*iface
)
605 struct eq
*effect
= impl_from_IDirectSoundFXParamEq(iface
);
606 return IUnknown_AddRef(effect
->effect
.outer_unk
);
609 static ULONG WINAPI
eq_params_Release(IDirectSoundFXParamEq
*iface
)
611 struct eq
*effect
= impl_from_IDirectSoundFXParamEq(iface
);
612 return IUnknown_Release(effect
->effect
.outer_unk
);
615 static HRESULT WINAPI
eq_params_SetAllParameters(IDirectSoundFXParamEq
*iface
, const DSFXParamEq
*params
)
617 struct eq
*effect
= impl_from_IDirectSoundFXParamEq(iface
);
619 TRACE("effect %p, params %p.\n", effect
, params
);
621 EnterCriticalSection(&effect
->effect
.cs
);
622 effect
->params
= *params
;
623 LeaveCriticalSection(&effect
->effect
.cs
);
627 static HRESULT WINAPI
eq_params_GetAllParameters(IDirectSoundFXParamEq
*iface
, DSFXParamEq
*params
)
629 struct eq
*effect
= impl_from_IDirectSoundFXParamEq(iface
);
631 TRACE("effect %p, params %p.\n", effect
, params
);
633 EnterCriticalSection(&effect
->effect
.cs
);
634 *params
= effect
->params
;
635 LeaveCriticalSection(&effect
->effect
.cs
);
639 static const IDirectSoundFXParamEqVtbl eq_params_vtbl
=
641 eq_params_QueryInterface
,
644 eq_params_SetAllParameters
,
645 eq_params_GetAllParameters
,
648 static struct eq
*impl_eq_from_effect(struct effect
*iface
)
650 return CONTAINING_RECORD(iface
, struct eq
, effect
);
653 static void *eq_query_interface(struct effect
*iface
, REFIID iid
)
655 struct eq
*effect
= impl_eq_from_effect(iface
);
657 if (IsEqualGUID(iid
, &IID_IDirectSoundFXParamEq
))
658 return &effect
->IDirectSoundFXParamEq_iface
;
662 static void eq_destroy(struct effect
*iface
)
664 struct eq
*effect
= impl_eq_from_effect(iface
);
669 static const struct effect_ops eq_ops
=
671 .destroy
= eq_destroy
,
672 .query_interface
= eq_query_interface
,
675 static HRESULT
eq_create(IUnknown
*outer
, IUnknown
**out
)
679 if (!(object
= calloc(1, sizeof(*object
))))
680 return E_OUTOFMEMORY
;
682 effect_init(&object
->effect
, outer
, &eq_ops
);
683 object
->IDirectSoundFXParamEq_iface
.lpVtbl
= &eq_params_vtbl
;
685 object
->params
.fCenter
= 8000.0f
;
686 object
->params
.fBandwidth
= 12.0f
;
687 object
->params
.fGain
= 0.0f
;
689 TRACE("Created equalizer effect %p.\n", object
);
690 *out
= &object
->effect
.IUnknown_inner
;
696 struct effect effect
;
697 IDirectSoundFXI3DL2Reverb IDirectSoundFXI3DL2Reverb_iface
;
698 DSFXI3DL2Reverb params
;
701 static struct reverb
*impl_from_IDirectSoundFXI3DL2Reverb(IDirectSoundFXI3DL2Reverb
*iface
)
703 return CONTAINING_RECORD(iface
, struct reverb
, IDirectSoundFXI3DL2Reverb_iface
);
706 static HRESULT WINAPI
reverb_params_QueryInterface(IDirectSoundFXI3DL2Reverb
*iface
, REFIID iid
, void **out
)
708 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
709 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
712 static ULONG WINAPI
reverb_params_AddRef(IDirectSoundFXI3DL2Reverb
*iface
)
714 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
715 return IUnknown_AddRef(effect
->effect
.outer_unk
);
718 static ULONG WINAPI
reverb_params_Release(IDirectSoundFXI3DL2Reverb
*iface
)
720 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
721 return IUnknown_Release(effect
->effect
.outer_unk
);
724 static HRESULT WINAPI
reverb_params_SetAllParameters(IDirectSoundFXI3DL2Reverb
*iface
, const DSFXI3DL2Reverb
*params
)
726 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
728 TRACE("effect %p, params %p.\n", effect
, params
);
730 EnterCriticalSection(&effect
->effect
.cs
);
731 effect
->params
= *params
;
732 LeaveCriticalSection(&effect
->effect
.cs
);
736 static HRESULT WINAPI
reverb_params_GetAllParameters(IDirectSoundFXI3DL2Reverb
*iface
, DSFXI3DL2Reverb
*params
)
738 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
740 TRACE("effect %p, params %p.\n", effect
, params
);
742 EnterCriticalSection(&effect
->effect
.cs
);
743 *params
= effect
->params
;
744 LeaveCriticalSection(&effect
->effect
.cs
);
748 static HRESULT WINAPI
reverb_params_SetPreset(IDirectSoundFXI3DL2Reverb
*iface
, DWORD preset
)
750 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
752 FIXME("effect %p, preset %lu, stub!\n", effect
, preset
);
757 static HRESULT WINAPI
reverb_params_GetPreset(IDirectSoundFXI3DL2Reverb
*iface
, DWORD
*preset
)
759 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
761 FIXME("effect %p, preset %p, stub!\n", effect
, preset
);
766 static HRESULT WINAPI
reverb_params_SetQuality(IDirectSoundFXI3DL2Reverb
*iface
, LONG quality
)
768 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
770 FIXME("effect %p, quality %lu, stub!\n", effect
, quality
);
775 static HRESULT WINAPI
reverb_params_GetQuality(IDirectSoundFXI3DL2Reverb
*iface
, LONG
*quality
)
777 struct reverb
*effect
= impl_from_IDirectSoundFXI3DL2Reverb(iface
);
779 FIXME("effect %p, quality %p, stub!\n", effect
, quality
);
784 static const IDirectSoundFXI3DL2ReverbVtbl reverb_params_vtbl
=
786 reverb_params_QueryInterface
,
787 reverb_params_AddRef
,
788 reverb_params_Release
,
789 reverb_params_SetAllParameters
,
790 reverb_params_GetAllParameters
,
791 reverb_params_SetPreset
,
792 reverb_params_GetPreset
,
793 reverb_params_SetQuality
,
794 reverb_params_GetQuality
,
797 static struct reverb
*impl_reverb_from_effect(struct effect
*iface
)
799 return CONTAINING_RECORD(iface
, struct reverb
, effect
);
802 static void *reverb_query_interface(struct effect
*iface
, REFIID iid
)
804 struct reverb
*effect
= impl_reverb_from_effect(iface
);
806 if (IsEqualGUID(iid
, &IID_IDirectSoundFXI3DL2Reverb
))
807 return &effect
->IDirectSoundFXI3DL2Reverb_iface
;
811 static void reverb_destroy(struct effect
*iface
)
813 struct reverb
*effect
= impl_reverb_from_effect(iface
);
818 static const struct effect_ops reverb_ops
=
820 .destroy
= reverb_destroy
,
821 .query_interface
= reverb_query_interface
,
824 static HRESULT
reverb_create(IUnknown
*outer
, IUnknown
**out
)
826 struct reverb
*object
;
828 if (!(object
= calloc(1, sizeof(*object
))))
829 return E_OUTOFMEMORY
;
831 effect_init(&object
->effect
, outer
, &reverb_ops
);
832 object
->IDirectSoundFXI3DL2Reverb_iface
.lpVtbl
= &reverb_params_vtbl
;
834 object
->params
.lRoom
= DSFX_I3DL2REVERB_ROOM_DEFAULT
;
835 object
->params
.lRoomHF
= DSFX_I3DL2REVERB_ROOMHF_DEFAULT
;
836 object
->params
.flRoomRolloffFactor
= DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT
;
837 object
->params
.flDecayTime
= DSFX_I3DL2REVERB_DECAYTIME_DEFAULT
;
838 object
->params
.flDecayHFRatio
= DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT
;
839 object
->params
.lReflections
= DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT
;
840 object
->params
.flReflectionsDelay
= DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT
;
841 object
->params
.lReverb
= DSFX_I3DL2REVERB_REVERB_DEFAULT
;
842 object
->params
.flReverbDelay
= DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT
;
843 object
->params
.flDiffusion
= DSFX_I3DL2REVERB_DIFFUSION_DEFAULT
;
844 object
->params
.flDensity
= DSFX_I3DL2REVERB_DENSITY_DEFAULT
;
845 object
->params
.flHFReference
= DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT
;
847 TRACE("Created I3DL2 reverb effect %p.\n", object
);
848 *out
= &object
->effect
.IUnknown_inner
;
854 struct effect effect
;
855 IDirectSoundFXWavesReverb IDirectSoundFXWavesReverb_iface
;
858 static struct waves_reverb
*impl_from_IDirectSoundFXWavesReverb(IDirectSoundFXWavesReverb
*iface
)
860 return CONTAINING_RECORD(iface
, struct waves_reverb
, IDirectSoundFXWavesReverb_iface
);
863 static HRESULT WINAPI
waves_reverb_params_QueryInterface(IDirectSoundFXWavesReverb
*iface
, REFIID iid
, void **out
)
865 struct waves_reverb
*effect
= impl_from_IDirectSoundFXWavesReverb(iface
);
866 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
869 static ULONG WINAPI
waves_reverb_params_AddRef(IDirectSoundFXWavesReverb
*iface
)
871 struct waves_reverb
*effect
= impl_from_IDirectSoundFXWavesReverb(iface
);
872 return IUnknown_AddRef(effect
->effect
.outer_unk
);
875 static ULONG WINAPI
waves_reverb_params_Release(IDirectSoundFXWavesReverb
*iface
)
877 struct waves_reverb
*effect
= impl_from_IDirectSoundFXWavesReverb(iface
);
878 return IUnknown_Release(effect
->effect
.outer_unk
);
881 static HRESULT WINAPI
waves_reverb_params_SetAllParameters(IDirectSoundFXWavesReverb
*iface
, const DSFXWavesReverb
*params
)
883 struct waves_reverb
*effect
= impl_from_IDirectSoundFXWavesReverb(iface
);
885 FIXME("effect %p, params %p, stub!\n", effect
, params
);
890 static HRESULT WINAPI
waves_reverb_params_GetAllParameters(IDirectSoundFXWavesReverb
*iface
, DSFXWavesReverb
*params
)
892 struct waves_reverb
*effect
= impl_from_IDirectSoundFXWavesReverb(iface
);
894 FIXME("effect %p, params %p, stub!\n", effect
, params
);
899 static const IDirectSoundFXWavesReverbVtbl waves_reverb_params_vtbl
=
901 waves_reverb_params_QueryInterface
,
902 waves_reverb_params_AddRef
,
903 waves_reverb_params_Release
,
904 waves_reverb_params_SetAllParameters
,
905 waves_reverb_params_GetAllParameters
,
908 static struct waves_reverb
*impl_waves_reverb_from_effect(struct effect
*iface
)
910 return CONTAINING_RECORD(iface
, struct waves_reverb
, effect
);
913 static void *waves_reverb_query_interface(struct effect
*iface
, REFIID iid
)
915 struct waves_reverb
*effect
= impl_waves_reverb_from_effect(iface
);
917 if (IsEqualGUID(iid
, &IID_IDirectSoundFXWavesReverb
))
918 return &effect
->IDirectSoundFXWavesReverb_iface
;
922 static void waves_reverb_destroy(struct effect
*iface
)
924 struct waves_reverb
*effect
= impl_waves_reverb_from_effect(iface
);
929 static const struct effect_ops waves_reverb_ops
=
931 .destroy
= waves_reverb_destroy
,
932 .query_interface
= waves_reverb_query_interface
,
935 static HRESULT
waves_reverb_create(IUnknown
*outer
, IUnknown
**out
)
937 struct waves_reverb
*object
;
939 if (!(object
= calloc(1, sizeof(*object
))))
940 return E_OUTOFMEMORY
;
942 effect_init(&object
->effect
, outer
, &waves_reverb_ops
);
943 object
->IDirectSoundFXWavesReverb_iface
.lpVtbl
= &waves_reverb_params_vtbl
;
945 TRACE("Created waves reverb effect %p.\n", object
);
946 *out
= &object
->effect
.IUnknown_inner
;
952 struct effect effect
;
953 IDirectSoundFXEcho IDirectSoundFXEcho_iface
;
956 static inline struct dmo_echofx
*impl_from_IDirectSoundFXEcho(IDirectSoundFXEcho
*iface
)
958 return CONTAINING_RECORD(iface
, struct dmo_echofx
, IDirectSoundFXEcho_iface
);
961 static HRESULT WINAPI
echofx_QueryInterface(IDirectSoundFXEcho
*iface
, REFIID iid
, void **out
)
963 struct dmo_echofx
*effect
= impl_from_IDirectSoundFXEcho(iface
);
964 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
967 static ULONG WINAPI
echofx_AddRef(IDirectSoundFXEcho
*iface
)
969 struct dmo_echofx
*effect
= impl_from_IDirectSoundFXEcho(iface
);
970 return IUnknown_AddRef(effect
->effect
.outer_unk
);
973 static ULONG WINAPI
echofx_Release(IDirectSoundFXEcho
*iface
)
975 struct dmo_echofx
*effect
= impl_from_IDirectSoundFXEcho(iface
);
976 return IUnknown_Release(effect
->effect
.outer_unk
);
979 static HRESULT WINAPI
echofx_SetAllParameters(IDirectSoundFXEcho
*iface
, const DSFXEcho
*echo
)
981 struct dmo_echofx
*effect
= impl_from_IDirectSoundFXEcho(iface
);
982 FIXME("(%p) %p\n", effect
, echo
);
987 static HRESULT WINAPI
echofx_GetAllParameters(IDirectSoundFXEcho
*iface
, DSFXEcho
*echo
)
989 struct dmo_echofx
*effect
= impl_from_IDirectSoundFXEcho(iface
);
990 FIXME("(%p) %p\n", effect
, echo
);
995 static const struct IDirectSoundFXEchoVtbl echofx_vtbl
=
997 echofx_QueryInterface
,
1000 echofx_SetAllParameters
,
1001 echofx_GetAllParameters
1004 static struct dmo_echofx
*impl_echo_from_effect(struct effect
*iface
)
1006 return CONTAINING_RECORD(iface
, struct dmo_echofx
, effect
);
1009 static void *echo_query_interface(struct effect
*iface
, REFIID iid
)
1011 struct dmo_echofx
*effect
= impl_echo_from_effect(iface
);
1013 if (IsEqualGUID(iid
, &IID_IDirectSoundFXEcho
))
1014 return &effect
->IDirectSoundFXEcho_iface
;
1018 static void echo_destroy(struct effect
*iface
)
1020 struct dmo_echofx
*effect
= impl_echo_from_effect(iface
);
1025 static const struct effect_ops echo_ops
=
1027 .destroy
= echo_destroy
,
1028 .query_interface
= echo_query_interface
,
1031 static HRESULT
echo_create(IUnknown
*outer
, IUnknown
**out
)
1033 struct dmo_echofx
*object
;
1035 if (!(object
= calloc(1, sizeof(*object
))))
1036 return E_OUTOFMEMORY
;
1038 effect_init(&object
->effect
, outer
, &echo_ops
);
1039 object
->IDirectSoundFXEcho_iface
.lpVtbl
= &echofx_vtbl
;
1041 TRACE("Created echo effect %p.\n", object
);
1042 *out
= &object
->effect
.IUnknown_inner
;
1046 struct dmo_compressorfx
1048 struct effect effect
;
1049 IDirectSoundFXCompressor IDirectSoundFXCompressor_iface
;
1052 static inline struct dmo_compressorfx
*impl_from_IDirectSoundFXCompressor(IDirectSoundFXCompressor
*iface
)
1054 return CONTAINING_RECORD(iface
, struct dmo_compressorfx
, IDirectSoundFXCompressor_iface
);
1057 static HRESULT WINAPI
compressorfx_QueryInterface(IDirectSoundFXCompressor
*iface
, REFIID iid
, void **out
)
1059 struct dmo_compressorfx
*effect
= impl_from_IDirectSoundFXCompressor(iface
);
1060 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
1063 static ULONG WINAPI
compressorfx_AddRef(IDirectSoundFXCompressor
*iface
)
1065 struct dmo_compressorfx
*effect
= impl_from_IDirectSoundFXCompressor(iface
);
1066 return IUnknown_AddRef(effect
->effect
.outer_unk
);
1069 static ULONG WINAPI
compressorfx_Release(IDirectSoundFXCompressor
*iface
)
1071 struct dmo_compressorfx
*effect
= impl_from_IDirectSoundFXCompressor(iface
);
1072 return IUnknown_Release(effect
->effect
.outer_unk
);
1075 static HRESULT WINAPI
compressorfx_SetAllParameters(IDirectSoundFXCompressor
*iface
, const DSFXCompressor
*compressor
)
1077 struct dmo_compressorfx
*This
= impl_from_IDirectSoundFXCompressor(iface
);
1078 FIXME("(%p) %p\n", This
, compressor
);
1083 static HRESULT WINAPI
compressorfx_GetAllParameters(IDirectSoundFXCompressor
*iface
, DSFXCompressor
*compressor
)
1085 struct dmo_compressorfx
*This
= impl_from_IDirectSoundFXCompressor(iface
);
1086 FIXME("(%p) %p\n", This
, compressor
);
1091 static const struct IDirectSoundFXCompressorVtbl compressor_vtbl
=
1093 compressorfx_QueryInterface
,
1094 compressorfx_AddRef
,
1095 compressorfx_Release
,
1096 compressorfx_SetAllParameters
,
1097 compressorfx_GetAllParameters
1100 static struct dmo_compressorfx
*impl_compressor_from_effect(struct effect
*iface
)
1102 return CONTAINING_RECORD(iface
, struct dmo_compressorfx
, effect
);
1105 static void *compressor_query_interface(struct effect
*iface
, REFIID iid
)
1107 struct dmo_compressorfx
*effect
= impl_compressor_from_effect(iface
);
1109 if (IsEqualGUID(iid
, &IID_IDirectSoundFXCompressor
))
1110 return &effect
->IDirectSoundFXCompressor_iface
;
1114 static void compressor_destroy(struct effect
*iface
)
1116 struct dmo_compressorfx
*effect
= impl_compressor_from_effect(iface
);
1121 static const struct effect_ops compressor_ops
=
1123 .destroy
= compressor_destroy
,
1124 .query_interface
= compressor_query_interface
,
1127 static HRESULT
compressor_create(IUnknown
*outer
, IUnknown
**out
)
1129 struct dmo_compressorfx
*object
;
1131 if (!(object
= calloc(1, sizeof(*object
))))
1132 return E_OUTOFMEMORY
;
1134 effect_init(&object
->effect
, outer
, &compressor_ops
);
1135 object
->IDirectSoundFXCompressor_iface
.lpVtbl
= &compressor_vtbl
;
1137 TRACE("Created compressor effect %p.\n", object
);
1138 *out
= &object
->effect
.IUnknown_inner
;
1144 struct effect effect
;
1145 IDirectSoundFXChorus IDirectSoundFXChorus_iface
;
1148 static inline struct dmochorusfx
*impl_from_IDirectSoundFXChorus(IDirectSoundFXChorus
*iface
)
1150 return CONTAINING_RECORD(iface
, struct dmochorusfx
, IDirectSoundFXChorus_iface
);
1153 static HRESULT WINAPI
chorusfx_QueryInterface(IDirectSoundFXChorus
*iface
, REFIID iid
, void **out
)
1155 struct dmochorusfx
*effect
= impl_from_IDirectSoundFXChorus(iface
);
1156 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
1159 static ULONG WINAPI
chorusfx_AddRef(IDirectSoundFXChorus
*iface
)
1161 struct dmochorusfx
*effect
= impl_from_IDirectSoundFXChorus(iface
);
1162 return IUnknown_AddRef(effect
->effect
.outer_unk
);
1165 static ULONG WINAPI
chorusfx_Release(IDirectSoundFXChorus
*iface
)
1167 struct dmochorusfx
*effect
= impl_from_IDirectSoundFXChorus(iface
);
1168 return IUnknown_Release(effect
->effect
.outer_unk
);
1171 static HRESULT WINAPI
chorusfx_SetAllParameters(IDirectSoundFXChorus
*iface
, const DSFXChorus
*compressor
)
1173 struct dmochorusfx
*This
= impl_from_IDirectSoundFXChorus(iface
);
1174 FIXME("(%p) %p\n", This
, compressor
);
1178 static HRESULT WINAPI
chorusfx_GetAllParameters(IDirectSoundFXChorus
*iface
, DSFXChorus
*compressor
)
1180 struct dmochorusfx
*This
= impl_from_IDirectSoundFXChorus(iface
);
1181 FIXME("(%p) %p\n", This
, compressor
);
1185 static const struct IDirectSoundFXChorusVtbl chorus_vtbl
=
1187 chorusfx_QueryInterface
,
1190 chorusfx_SetAllParameters
,
1191 chorusfx_GetAllParameters
1194 static struct dmochorusfx
*implchorus_from_effect(struct effect
*iface
)
1196 return CONTAINING_RECORD(iface
, struct dmochorusfx
, effect
);
1199 static void *chorus_query_interface(struct effect
*iface
, REFIID iid
)
1201 struct dmochorusfx
*effect
= implchorus_from_effect(iface
);
1203 if (IsEqualGUID(iid
, &IID_IDirectSoundFXChorus
))
1204 return &effect
->IDirectSoundFXChorus_iface
;
1208 static void chorus_destroy(struct effect
*iface
)
1210 struct dmochorusfx
*effect
= implchorus_from_effect(iface
);
1215 static const struct effect_ops chorus_ops
=
1217 .destroy
= chorus_destroy
,
1218 .query_interface
= chorus_query_interface
,
1221 static HRESULT
chorus_create(IUnknown
*outer
, IUnknown
**out
)
1223 struct dmochorusfx
*object
;
1225 if (!(object
= calloc(1, sizeof(*object
))))
1226 return E_OUTOFMEMORY
;
1228 effect_init(&object
->effect
, outer
, &chorus_ops
);
1229 object
->IDirectSoundFXChorus_iface
.lpVtbl
= &chorus_vtbl
;
1231 TRACE("Created chorus effect %p.\n", object
);
1232 *out
= &object
->effect
.IUnknown_inner
;
1236 struct dmo_flangerfx
1238 struct effect effect
;
1239 IDirectSoundFXFlanger IDirectSoundFXFlanger_iface
;
1242 static inline struct dmo_flangerfx
*impl_from_IDirectSoundFXFlanger(IDirectSoundFXFlanger
*iface
)
1244 return CONTAINING_RECORD(iface
, struct dmo_flangerfx
, IDirectSoundFXFlanger_iface
);
1247 static HRESULT WINAPI
flangerfx_QueryInterface(IDirectSoundFXFlanger
*iface
, REFIID iid
, void **out
)
1249 struct dmo_flangerfx
*effect
= impl_from_IDirectSoundFXFlanger(iface
);
1250 return IUnknown_QueryInterface(effect
->effect
.outer_unk
, iid
, out
);
1253 static ULONG WINAPI
flangerfx_AddRef(IDirectSoundFXFlanger
*iface
)
1255 struct dmo_flangerfx
*effect
= impl_from_IDirectSoundFXFlanger(iface
);
1256 return IUnknown_AddRef(effect
->effect
.outer_unk
);
1259 static ULONG WINAPI
flangerfx_Release(IDirectSoundFXFlanger
*iface
)
1261 struct dmo_flangerfx
*effect
= impl_from_IDirectSoundFXFlanger(iface
);
1262 return IUnknown_Release(effect
->effect
.outer_unk
);
1265 static HRESULT WINAPI
flangerfx_SetAllParameters(IDirectSoundFXFlanger
*iface
, const DSFXFlanger
*flanger
)
1267 struct dmo_flangerfx
*This
= impl_from_IDirectSoundFXFlanger(iface
);
1268 FIXME("(%p) %p\n", This
, flanger
);
1272 static HRESULT WINAPI
flangerfx_GetAllParameters(IDirectSoundFXFlanger
*iface
, DSFXFlanger
*flanger
)
1274 struct dmo_flangerfx
*This
= impl_from_IDirectSoundFXFlanger(iface
);
1275 FIXME("(%p) %p\n", This
, flanger
);
1279 static const struct IDirectSoundFXFlangerVtbl flanger_vtbl
=
1281 flangerfx_QueryInterface
,
1284 flangerfx_SetAllParameters
,
1285 flangerfx_GetAllParameters
1288 static struct dmo_flangerfx
*impl_flanger_from_effect(struct effect
*iface
)
1290 return CONTAINING_RECORD(iface
, struct dmo_flangerfx
, effect
);
1293 static void *flanger_query_interface(struct effect
*iface
, REFIID iid
)
1295 struct dmo_flangerfx
*effect
= impl_flanger_from_effect(iface
);
1297 if (IsEqualGUID(iid
, &IID_IDirectSoundFXFlanger
))
1298 return &effect
->IDirectSoundFXFlanger_iface
;
1302 static void flanger_destroy(struct effect
*iface
)
1304 struct dmo_flangerfx
*effect
= impl_flanger_from_effect(iface
);
1309 static const struct effect_ops flanger_ops
=
1311 .destroy
= flanger_destroy
,
1312 .query_interface
= flanger_query_interface
,
1315 static HRESULT
flanger_create(IUnknown
*outer
, IUnknown
**out
)
1317 struct dmo_flangerfx
*object
;
1319 if (!(object
= calloc(1, sizeof(*object
))))
1320 return E_OUTOFMEMORY
;
1322 effect_init(&object
->effect
, outer
, &flanger_ops
);
1323 object
->IDirectSoundFXFlanger_iface
.lpVtbl
= &flanger_vtbl
;
1325 TRACE("Created flanger effect %p.\n", object
);
1326 *out
= &object
->effect
.IUnknown_inner
;
1330 struct class_factory
1332 IClassFactory IClassFactory_iface
;
1333 HRESULT (*create_instance
)(IUnknown
*outer
, IUnknown
**out
);
1336 static struct class_factory
*impl_from_IClassFactory(IClassFactory
*iface
)
1338 return CONTAINING_RECORD(iface
, struct class_factory
, IClassFactory_iface
);
1341 static HRESULT WINAPI
class_factory_QueryInterface(IClassFactory
*iface
, REFIID iid
, void **out
)
1343 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
1345 if (IsEqualGUID(iid
, &IID_IUnknown
) || IsEqualGUID(iid
, &IID_IClassFactory
))
1347 IClassFactory_AddRef(iface
);
1353 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid
));
1354 return E_NOINTERFACE
;
1357 static ULONG WINAPI
class_factory_AddRef(IClassFactory
*iface
)
1362 static ULONG WINAPI
class_factory_Release(IClassFactory
*iface
)
1367 static HRESULT WINAPI
class_factory_CreateInstance(IClassFactory
*iface
,
1368 IUnknown
*outer
, REFIID iid
, void **out
)
1370 struct class_factory
*factory
= impl_from_IClassFactory(iface
);
1374 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
1378 if (outer
&& !IsEqualGUID(iid
, &IID_IUnknown
))
1379 return E_NOINTERFACE
;
1381 if (SUCCEEDED(hr
= factory
->create_instance(outer
, &unk
)))
1383 hr
= IUnknown_QueryInterface(unk
, iid
, out
);
1384 IUnknown_Release(unk
);
1389 static HRESULT WINAPI
class_factory_LockServer(IClassFactory
*iface
, BOOL lock
)
1391 FIXME("lock %d, stub!\n", lock
);
1395 static const IClassFactoryVtbl class_factory_vtbl
=
1397 class_factory_QueryInterface
,
1398 class_factory_AddRef
,
1399 class_factory_Release
,
1400 class_factory_CreateInstance
,
1401 class_factory_LockServer
,
1407 struct class_factory factory
;
1411 {&GUID_DSFX_STANDARD_I3DL2REVERB
, {{&class_factory_vtbl
}, reverb_create
}},
1412 {&GUID_DSFX_STANDARD_PARAMEQ
, {{&class_factory_vtbl
}, eq_create
}},
1413 {&GUID_DSFX_WAVES_REVERB
, {{&class_factory_vtbl
}, waves_reverb_create
}},
1414 {&GUID_DSFX_STANDARD_ECHO
, {{&class_factory_vtbl
}, echo_create
}},
1415 {&GUID_DSFX_STANDARD_COMPRESSOR
, {{&class_factory_vtbl
}, compressor_create
}},
1416 {&GUID_DSFX_STANDARD_CHORUS
, {{&class_factory_vtbl
}, chorus_create
}},
1417 {&GUID_DSFX_STANDARD_FLANGER
, {{&class_factory_vtbl
}, flanger_create
}},
1420 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID iid
, void **out
)
1424 TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid
), debugstr_guid(iid
), out
);
1426 for (i
= 0; i
< ARRAY_SIZE(class_factories
); ++i
)
1428 if (IsEqualGUID(clsid
, class_factories
[i
].clsid
))
1429 return IClassFactory_QueryInterface(&class_factories
[i
].factory
.IClassFactory_iface
, iid
, out
);
1432 FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid
));
1433 return CLASS_E_CLASSNOTAVAILABLE
;