[PATCH 3/6] dsdmo: Implement IDirectSoundFXI3DL2Reverb parameters methods.

Zebediah Figura z.figura12 at gmail.com
Mon Jul 27 20:26:02 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/dsdmo/main.c        | 28 +++++++++++++++++++++----
 dlls/dsdmo/tests/dsdmo.c | 44 +++++++++++++++++++++++++---------------
 2 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c
index 8efef855b29..5755c6f1444 100644
--- a/dlls/dsdmo/main.c
+++ b/dlls/dsdmo/main.c
@@ -438,6 +438,7 @@ struct reverb
 {
     struct effect effect;
     IDirectSoundFXI3DL2Reverb IDirectSoundFXI3DL2Reverb_iface;
+    DSFXI3DL2Reverb params;
 };
 
 static struct reverb *impl_from_IDirectSoundFXI3DL2Reverb(IDirectSoundFXI3DL2Reverb *iface)
@@ -467,18 +468,24 @@ static HRESULT WINAPI reverb_params_SetAllParameters(IDirectSoundFXI3DL2Reverb *
 {
     struct reverb *effect = impl_from_IDirectSoundFXI3DL2Reverb(iface);
 
-    FIXME("effect %p, params %p, stub!\n", effect, params);
+    TRACE("effect %p, params %p.\n", effect, params);
 
-    return E_NOTIMPL;
+    EnterCriticalSection(&effect->effect.cs);
+    effect->params = *params;
+    LeaveCriticalSection(&effect->effect.cs);
+    return S_OK;
 }
 
 static HRESULT WINAPI reverb_params_GetAllParameters(IDirectSoundFXI3DL2Reverb *iface, DSFXI3DL2Reverb *params)
 {
     struct reverb *effect = impl_from_IDirectSoundFXI3DL2Reverb(iface);
 
-    FIXME("effect %p, params %p, stub!\n", effect, params);
+    TRACE("effect %p, params %p.\n", effect, params);
 
-    return E_NOTIMPL;
+    EnterCriticalSection(&effect->effect.cs);
+    *params = effect->params;
+    LeaveCriticalSection(&effect->effect.cs);
+    return S_OK;
 }
 
 static HRESULT WINAPI reverb_params_SetPreset(IDirectSoundFXI3DL2Reverb *iface, DWORD preset)
@@ -567,6 +574,19 @@ static HRESULT reverb_create(IUnknown *outer, IUnknown **out)
     effect_init(&object->effect, outer, &reverb_ops);
     object->IDirectSoundFXI3DL2Reverb_iface.lpVtbl = &reverb_params_vtbl;
 
+    object->params.lRoom                = DSFX_I3DL2REVERB_ROOM_DEFAULT;
+    object->params.lRoomHF              = DSFX_I3DL2REVERB_ROOMHF_DEFAULT;
+    object->params.flRoomRolloffFactor  = DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT;
+    object->params.flDecayTime          = DSFX_I3DL2REVERB_DECAYTIME_DEFAULT;
+    object->params.flDecayHFRatio       = DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT;
+    object->params.lReflections         = DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT;
+    object->params.flReflectionsDelay   = DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT;
+    object->params.lReverb              = DSFX_I3DL2REVERB_REVERB_DEFAULT;
+    object->params.flReverbDelay        = DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT;
+    object->params.flDiffusion          = DSFX_I3DL2REVERB_DIFFUSION_DEFAULT;
+    object->params.flDensity            = DSFX_I3DL2REVERB_DENSITY_DEFAULT;
+    object->params.flHFReference        = DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT;
+
     TRACE("Created I3DL2 reverb effect %p.\n", object);
     *out = &object->effect.IUnknown_inner;
     return S_OK;
diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c
index f949d02e882..349e300f02e 100644
--- a/dlls/dsdmo/tests/dsdmo.c
+++ b/dlls/dsdmo/tests/dsdmo.c
@@ -476,22 +476,34 @@ static void test_reverb_parameters(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, &params);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    if (hr == S_OK)
-    {
-        ok(params.lRoom == -1000, "Got room attenuation %d mB.\n", params.lRoom);
-        ok(params.lRoomHF == -100, "Got room high-frequency attenuation %d mB.\n", params.lRoomHF);
-        ok(params.flRoomRolloffFactor == 0.0f, "Got room rolloff factor %.8e.\n", params.flRoomRolloffFactor);
-        ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime);
-        ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio);
-        ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections);
-        ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay);
-        ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb);
-        ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay);
-        ok(params.flDiffusion == 100.0f, "Got diffusion %.8e%%.\n", params.flDiffusion);
-        ok(params.flDensity == 100.0f, "Got density %.8e%%.\n", params.flDensity);
-        ok(params.flHFReference == 5000.0f, "Got reference high frequency %.8e Hz.\n", params.flHFReference);
-    }
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(params.lRoom == -1000, "Got room attenuation %d mB.\n", params.lRoom);
+    ok(params.lRoomHF == -100, "Got room high-frequency attenuation %d mB.\n", params.lRoomHF);
+    ok(params.flRoomRolloffFactor == 0.0f, "Got room rolloff factor %.8e.\n", params.flRoomRolloffFactor);
+    ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime);
+    ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio);
+    ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections);
+    ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay);
+    ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb);
+    ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay);
+    ok(params.flDiffusion == 100.0f, "Got diffusion %.8e%%.\n", params.flDiffusion);
+    ok(params.flDensity == 100.0f, "Got density %.8e%%.\n", params.flDensity);
+    ok(params.flHFReference == 5000.0f, "Got reference high frequency %.8e Hz.\n", params.flHFReference);
+
+    params.lRoom = -10001;
+    hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
+    todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    params.lRoom = 1;
+    hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
+    todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    params.lRoom = -900;
+    hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    memset(&params, 0xcc, sizeof(params));
+    hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, &params);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(params.lRoom == -900, "Got room attenuation %d mB.\n", params.lRoom);
 
     ref = IDirectSoundFXI3DL2Reverb_Release(reverb);
     ok(!ref, "Got outstanding refcount %d.\n", ref);
-- 
2.27.0




More information about the wine-devel mailing list