From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/dsdmo/dsdmo.idl | 8 ++++ dlls/dsdmo/main.c | 96 ++++++++++++++++++++++++++++++++++++++++ dlls/dsdmo/tests/dsdmo.c | 5 ++- 3 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/dlls/dsdmo/dsdmo.idl b/dlls/dsdmo/dsdmo.idl index 3922b4d6778..2eba0a4936e 100644 --- a/dlls/dsdmo/dsdmo.idl +++ b/dlls/dsdmo/dsdmo.idl @@ -57,3 +57,11 @@ coclass DirectSoundEchoDMO {} vi_progid("Microsoft.DirectSoundCompressorDMO") ] coclass DirectSoundCompressorDMO {} + +[ + uuid(efe6629c-81f7-4281-bd91-c9d604a95af6), + threading(both), + progid("Microsoft.DirectSoundChorusDMO.1"), + vi_progid("Microsoft.DirectSoundChorusDMO") +] +coclass DirectSoundChorusDMO {} diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c index bb19b7b7e2e..0e0f5a444b8 100644 --- a/dlls/dsdmo/main.c +++ b/dlls/dsdmo/main.c @@ -1139,6 +1139,100 @@ static HRESULT compressor_create(IUnknown *outer, IUnknown **out) return S_OK; }
+struct dmo_chordfx +{ + struct effect effect; + IDirectSoundFXChorus IDirectSoundFXChorus_iface; +}; + +static inline struct dmo_chordfx *impl_from_IDirectSoundFXChorus(IDirectSoundFXChorus *iface) +{ + return CONTAINING_RECORD(iface, struct dmo_chordfx, IDirectSoundFXChorus_iface); +} + +static HRESULT WINAPI chordfx_QueryInterface(IDirectSoundFXChorus *iface, REFIID iid, void **out) +{ + struct dmo_chordfx *effect = impl_from_IDirectSoundFXChorus(iface); + return IUnknown_QueryInterface(effect->effect.outer_unk, iid, out); +} + +static ULONG WINAPI chordfx_AddRef(IDirectSoundFXChorus *iface) +{ + struct dmo_chordfx *effect = impl_from_IDirectSoundFXChorus(iface); + return IUnknown_AddRef(effect->effect.outer_unk); +} + +static ULONG WINAPI chordfx_Release(IDirectSoundFXChorus *iface) +{ + struct dmo_chordfx *effect = impl_from_IDirectSoundFXChorus(iface); + return IUnknown_Release(effect->effect.outer_unk); +} + +static HRESULT WINAPI chordfx_SetAllParameters(IDirectSoundFXChorus *iface, const DSFXChorus *compressor) +{ + struct dmo_chordfx *This = impl_from_IDirectSoundFXChorus(iface); + FIXME("(%p) %p\n", This, compressor); + return E_NOTIMPL; +} + +static HRESULT WINAPI chordfx_GetAllParameters(IDirectSoundFXChorus *iface, DSFXChorus *compressor) +{ + struct dmo_chordfx *This = impl_from_IDirectSoundFXChorus(iface); + FIXME("(%p) %p\n", This, compressor); + return E_NOTIMPL; +} + +static const struct IDirectSoundFXChorusVtbl chord_vtbl = +{ + chordfx_QueryInterface, + chordfx_AddRef, + chordfx_Release, + chordfx_SetAllParameters, + chordfx_GetAllParameters +}; + +static struct dmo_chordfx *impl_chord_from_effect(struct effect *iface) +{ + return CONTAINING_RECORD(iface, struct dmo_chordfx, effect); +} + +static void *chord_query_interface(struct effect *iface, REFIID iid) +{ + struct dmo_chordfx *effect = impl_chord_from_effect(iface); + + if (IsEqualGUID(iid, &IID_IDirectSoundFXChorus)) + return &effect->IDirectSoundFXChorus_iface; + return NULL; +} + +static void chord_destroy(struct effect *iface) +{ + struct dmo_chordfx *effect = impl_chord_from_effect(iface); + + free(effect); +} + +static const struct effect_ops chord_ops = +{ + .destroy = chord_destroy, + .query_interface = chord_query_interface, +}; + +static HRESULT chord_create(IUnknown *outer, IUnknown **out) +{ + struct dmo_chordfx *object; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + effect_init(&object->effect, outer, &chord_ops); + object->IDirectSoundFXChorus_iface.lpVtbl = &chord_vtbl; + + TRACE("Created chord effect %p.\n", object); + *out = &object->effect.IUnknown_inner; + return S_OK; +} + struct class_factory { IClassFactory IClassFactory_iface; @@ -1225,6 +1319,8 @@ class_factories[] = {&GUID_DSFX_WAVES_REVERB, {{&class_factory_vtbl}, waves_reverb_create}}, {&GUID_DSFX_STANDARD_ECHO, {{&class_factory_vtbl}, echo_create}}, {&GUID_DSFX_STANDARD_COMPRESSOR, {{&class_factory_vtbl}, compressor_create}}, + {&GUID_DSFX_STANDARD_CHORUS, {{&class_factory_vtbl}, chord_create}}, + };
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index 9296ad29168..4371221168a 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -308,11 +308,14 @@ static void test_chorus_parameters(void)
hr = CoCreateInstance(&GUID_DSFX_STANDARD_CHORUS, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSoundFXChorus, (void **)&chorus); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); if (hr != S_OK) return;
hr = IDirectSoundFXChorus_GetAllParameters(chorus, ¶ms); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + if (hr != S_OK) + return; ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(params.fWetDryMix == 50.0f, "Got wetness %.8e%%.\n", params.fWetDryMix); ok(params.fDepth == 10.0f, "Got depth %.8e.\n", params.fDepth);