From d8ede09bcd5f5e29e1ea1d6543e4cf1de9806835 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 9 Sep 2019 14:32:24 +1000 Subject: [PATCH] dsdmo: Implement IDirectSoundFXParamEq SetAllParameters. --- dlls/dsdmo/parameq.c | 17 +++++++++++++++-- dlls/dsound/tests/dsound8.c | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/dlls/dsdmo/parameq.c b/dlls/dsdmo/parameq.c index 5b6a066fd3c..b8e2addf9f4 100644 --- a/dlls/dsdmo/parameq.c +++ b/dlls/dsdmo/parameq.c @@ -352,9 +352,22 @@ static ULONG WINAPI parameqfx_Release(IDirectSoundFXParamEq *iface) static HRESULT WINAPI parameqfx_SetAllParameters(IDirectSoundFXParamEq *iface, const DSFXParamEq *param) { struct dmo_parameqfx *This = impl_from_IDirectSoundFXParamEq(iface); - FIXME("(%p) %p\n", This, param); - return E_NOTIMPL; + TRACE("(%p) %p\n", This, param); + + if(!param) + return E_POINTER; + + if( (param->fCenter < DSFXPARAMEQ_CENTER_MIN || param->fCenter > DSFXPARAMEQ_CENTER_MAX) || + (param->fBandwidth < DSFXPARAMEQ_BANDWIDTH_MIN || param->fBandwidth > DSFXPARAMEQ_BANDWIDTH_MAX) || + (param->fGain < DSFXPARAMEQ_GAIN_MIN || param->fGain > DSFXPARAMEQ_GAIN_MAX) ) + { + return E_INVALIDARG; + } + + This->params = *param; + + return S_OK; } static HRESULT WINAPI parameqfx_GetAllParameters(IDirectSoundFXParamEq *iface, DSFXParamEq *param) diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index aea2d3ba2a9..68a48dc285d 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1831,6 +1831,33 @@ static void test_parameq_parameters(IDirectSoundBuffer8 *secondary8) test_dsfx_interfaces("FXParamEq", (IUnknown *)parameq, &IID_IDirectSoundFXParamEq); + rc = IDirectSoundFXParamEq_SetAllParameters(parameq, NULL); + ok(rc == E_POINTER, "got: %08x\n", rc); + + /* Out of range Min */ + params.fGain = -61.0f; + rc = IDirectSoundFXParamEq_SetAllParameters(parameq, ¶ms); + ok(rc == E_INVALIDARG, "got: %08x\n", rc); + + /* Out of range Max */ + params.fGain = 61.1f; + rc = IDirectSoundFXParamEq_SetAllParameters(parameq, ¶ms); + ok(rc == E_INVALIDARG, "got: %08x\n", rc); + + params.fGain = -10.0f; + rc = IDirectSoundFXParamEq_SetAllParameters(parameq, ¶ms); + ok(rc == S_OK, "got: %08x\n", rc); + + rc = IDirectSoundFXParamEq_GetAllParameters(parameq, ¶ms); + ok(rc == DS_OK, "Failed: %08x\n", rc); + if (rc == DS_OK) + { + ok(params.fCenter == 3675.0f, "got %f\n", params.fCenter); + ok(params.fBandwidth == 12.0f, "got %f\n", params.fBandwidth); + ok(params.fGain == -10.0f, "got %f\n", params.fGain); + } + + IDirectSoundFXParamEq_Release(parameq); } } -- 2.24.0.rc1