[PATCH 6/6] dsdmo: Implement IDirectSoundFXParamEq parameters methods.
Zebediah Figura
z.figura12 at gmail.com
Mon Jul 27 20:26:05 CDT 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/dsdmo/main.c | 19 +++++++++++++++----
dlls/dsdmo/tests/dsdmo.c | 28 +++++++++++++++++++++-------
2 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c
index ff103be159e..57214b32752 100644
--- a/dlls/dsdmo/main.c
+++ b/dlls/dsdmo/main.c
@@ -438,6 +438,7 @@ struct eq
{
struct effect effect;
IDirectSoundFXParamEq IDirectSoundFXParamEq_iface;
+ DSFXParamEq params;
};
static struct eq *impl_from_IDirectSoundFXParamEq(IDirectSoundFXParamEq *iface)
@@ -467,18 +468,24 @@ static HRESULT WINAPI eq_params_SetAllParameters(IDirectSoundFXParamEq *iface, c
{
struct eq *effect = impl_from_IDirectSoundFXParamEq(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 eq_params_GetAllParameters(IDirectSoundFXParamEq *iface, DSFXParamEq *params)
{
struct eq *effect = impl_from_IDirectSoundFXParamEq(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 const IDirectSoundFXParamEqVtbl eq_params_vtbl =
@@ -527,6 +534,10 @@ static HRESULT eq_create(IUnknown *outer, IUnknown **out)
effect_init(&object->effect, outer, &eq_ops);
object->IDirectSoundFXParamEq_iface.lpVtbl = &eq_params_vtbl;
+ object->params.fCenter = 8000.0f;
+ object->params.fBandwidth = 12.0f;
+ object->params.fGain = 0.0f;
+
TRACE("Created equalizer 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 c59361e5fcf..1ecafeb7ceb 100644
--- a/dlls/dsdmo/tests/dsdmo.c
+++ b/dlls/dsdmo/tests/dsdmo.c
@@ -453,13 +453,27 @@ static void test_eq_parameters(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IDirectSoundFXParamEq_GetAllParameters(eq, ¶ms);
- todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
- if (hr == S_OK)
- {
- ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
- ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
- ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
- }
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
+ ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
+ ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
+
+ params.fCenter = 79.0f;
+ hr = IDirectSoundFXParamEq_SetAllParameters(eq, ¶ms);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ params.fCenter = 16001.0f;
+ hr = IDirectSoundFXParamEq_SetAllParameters(eq, ¶ms);
+ todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ params.fCenter = 738.0f;
+ hr = IDirectSoundFXParamEq_SetAllParameters(eq, ¶ms);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ memset(¶ms, 0xcc, sizeof(params));
+ hr = IDirectSoundFXParamEq_GetAllParameters(eq, ¶ms);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(params.fCenter == 738.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
+ ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
+ ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
ref = IDirectSoundFXParamEq_Release(eq);
ok(!ref, "Got outstanding refcount %d.\n", ref);
--
2.27.0
More information about the wine-devel
mailing list