From ac528a492b719f6a8759d919710ca733f5acf167 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 27 Jul 2020 20:26:03 -0500 Subject: [PATCH] dsdmo: Add a stub equalizer effect. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/dsdmo/dsdmo.idl | 8 +++++ dlls/dsdmo/main.c | 43 ++++++++++++++++++++++ dlls/dsound/tests/dsound8.c | 71 +++++++++++++++---------------------- 3 files changed, 80 insertions(+), 42 deletions(-) diff --git a/dlls/dsdmo/dsdmo.idl b/dlls/dsdmo/dsdmo.idl index e5735b42f73..7f172084828 100644 --- a/dlls/dsdmo/dsdmo.idl +++ b/dlls/dsdmo/dsdmo.idl @@ -26,6 +26,14 @@ ] coclass DirectSoundI3DL2ReverbDMO {} +[ + threading(both), + progid("Microsoft.DirectSoundParamEqDMO.1"), + vi_progid("Microsoft.DirectSoundParamEqDMO"), + uuid(120ced89-3bf4-4173-a132-3cb406cf3231) +] +coclass DirectSoundParamEqDMO {} + [ threading(both), progid("Microsoft.DirectSoundWavesReverbDMO.1"), diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c index 5755c6f1444..482b8202db2 100644 --- a/dlls/dsdmo/main.c +++ b/dlls/dsdmo/main.c @@ -434,6 +434,48 @@ static void effect_init(struct effect *effect, IUnknown *outer, const struct eff effect->ops = ops; } +struct eq +{ + struct effect effect; +}; + +static struct eq *impl_eq_from_effect(struct effect *iface) +{ + return CONTAINING_RECORD(iface, struct eq, effect); +} + +static void *eq_query_interface(struct effect *iface, REFIID iid) +{ + return NULL; +} + +static void eq_destroy(struct effect *iface) +{ + struct eq *effect = impl_eq_from_effect(iface); + + free(effect); +} + +static const struct effect_ops eq_ops = +{ + .destroy = eq_destroy, + .query_interface = eq_query_interface, +}; + +static HRESULT eq_create(IUnknown *outer, IUnknown **out) +{ + struct eq *object; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + effect_init(&object->effect, outer, &eq_ops); + + TRACE("Created equalizer effect %p.\n", object); + *out = &object->effect.IUnknown_inner; + return S_OK; +} + struct reverb { struct effect effect; @@ -787,6 +829,7 @@ static struct class_factories[] = { {&GUID_DSFX_STANDARD_I3DL2REVERB, {{&class_factory_vtbl}, reverb_create}}, + {&GUID_DSFX_STANDARD_PARAMEQ, {{&class_factory_vtbl}, eq_create}}, {&GUID_DSFX_WAVES_REVERB, {{&class_factory_vtbl}, waves_reverb_create}}, }; diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 702cd4b2ba3..05dfabbd253 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1617,8 +1617,8 @@ static void test_effects(void) results[0] = 0xdeadbeef; hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); hr = IDirectSoundBuffer8_Lock(buffer8, 0, 0, &ptr1, &size1, &ptr2, &size2, DSBLOCK_ENTIREBUFFER); ok(hr == DS_OK, "Got hr %#x.\n", hr); @@ -1648,38 +1648,33 @@ static void test_effects(void) effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; results[0] = 0xdeadbeef; hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, NULL); - todo_wine ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); dmo = (IMediaObject *)0xdeadbeef; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &GUID_NULL, (void **)&dmo); - todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); - todo_wine ok(!dmo, "Got object %p.\n", dmo); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!dmo, "Got object %p.\n", dmo); dmo = (IMediaObject *)0xdeadbeef; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_NULL, 0, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo); dmo = NULL; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - { - ok(!!dmo, "Expected a non-NULL object.\n"); - IMediaObject_Release(dmo); - } + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); dmo = NULL; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); - if (hr == DS_OK) - { - ok(!!dmo, "Expected a non-NULL object.\n"); - IMediaObject_Release(dmo); - } + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); dmo = (IMediaObject *)0xdeadbeef; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); @@ -1691,7 +1686,7 @@ static void test_effects(void) results[0] = results[1] = 0xdeadbeef; hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr); - todo_wine ok(results[0] == DSFXR_PRESENT, "Got result %#x.\n", results[0]); + ok(results[0] == DSFXR_PRESENT, "Got result %#x.\n", results[0]); ok(results[1] == DSFXR_UNKNOWN, "Got result %#x.\n", results[1]); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); @@ -1701,14 +1696,13 @@ static void test_effects(void) effects[1].guidDSFXClass = GUID_DSFX_STANDARD_I3DL2REVERB; results[0] = results[1] = 0xdeadbeef; hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); - todo_wine ok(results[1] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[1]); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + ok(results[1] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[1]); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - echo = dmo; + ok(hr == DS_OK, "Got hr %#x.\n", hr); + echo = dmo; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IMediaObject, (void **)&dmo); todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); @@ -1716,20 +1710,14 @@ static void test_effects(void) reverb = dmo; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - { - ok(dmo == echo, "Expected %p, got %p.\n", echo, dmo); - IMediaObject_Release(dmo); - } + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(dmo == echo, "Expected %p, got %p.\n", echo, dmo); + IMediaObject_Release(dmo); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - { - ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); - IMediaObject_Release(dmo); - } + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); + IMediaObject_Release(dmo); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 1, &IID_IMediaObject, (void **)&dmo); @@ -1748,13 +1736,12 @@ static void test_effects(void) hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); - todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - IUnknown_Release(unk); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + IUnknown_Release(unk); hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk);