From dee460be6585aaf94221575e676745f4d7806aaf Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 9 Sep 2019 11:06:11 +1000 Subject: [PATCH] dsdmo: Implement IDirectSoundFXGargle SetAllParameters. --- dlls/dsdmo/gargle.c | 17 +++++++++++++++-- dlls/dsound/tests/dsound8.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dlls/dsdmo/gargle.c b/dlls/dsdmo/gargle.c index 458ca8a3234..03358ec5352 100644 --- a/dlls/dsdmo/gargle.c +++ b/dlls/dsdmo/gargle.c @@ -352,9 +352,22 @@ static ULONG WINAPI garglefx_Release(IDirectSoundFXGargle *iface) static HRESULT WINAPI garglefx_SetAllParameters(IDirectSoundFXGargle *iface, const DSFXGargle *gargle) { struct dmo_garglefx *This = impl_from_IDirectSoundFXGargle(iface); - FIXME("(%p) %p\n", This, gargle); - return E_NOTIMPL; + TRACE("(%p) %p\n", This, gargle); + + if(!gargle) + return E_POINTER; + + /* Out of Range values */ + if( (gargle->dwRateHz < DSFXGARGLE_RATEHZ_MIN || gargle->dwRateHz > DSFXGARGLE_RATEHZ_MAX) || + (gargle->dwWaveShape != DSFXGARGLE_WAVE_SQUARE && gargle->dwWaveShape != DSFXGARGLE_WAVE_TRIANGLE) ) + { + return E_INVALIDARG; + } + + This->params = *gargle; + + return S_OK; } static HRESULT WINAPI garglefx_GetAllParameters(IDirectSoundFXGargle *iface, DSFXGargle *gargle) diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index b502f7598f7..cf77d2375e5 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1537,6 +1537,34 @@ static void test_gargle_parameters(IDirectSoundBuffer8 *secondary8) test_dsfx_interfaces("FXGargle", (IUnknown *)gargle, &IID_IDirectSoundFXGargle); + rc = IDirectSoundFXGargle_SetAllParameters(gargle, NULL); + ok(rc == E_POINTER, "got: %08x\n", rc); + + /* Out of range Min */ + params.dwRateHz = 0; + + rc = IDirectSoundFXGargle_SetAllParameters(gargle, ¶ms); + ok(rc == E_INVALIDARG, "got: %08x\n", rc); + + /* Out of range Max */ + params.dwRateHz = 1001; + rc = IDirectSoundFXGargle_SetAllParameters(gargle, ¶ms); + ok(rc == E_INVALIDARG, "got: %08x\n", rc); + + params.dwRateHz = 800; + params.dwWaveShape = DSFXGARGLE_WAVE_SQUARE; + rc = IDirectSoundFXGargle_SetAllParameters(gargle, ¶ms); + ok(rc == S_OK, "got: %08x\n", rc); + + rc = IDirectSoundFXGargle_GetAllParameters(gargle, ¶ms); + ok(rc == DS_OK, "Failed: %08x\n", rc); + if (rc == DS_OK) + { + ok(params.dwRateHz == 800, "got %d\n", params.dwRateHz); + ok(params.dwWaveShape == DSFXGARGLE_WAVE_SQUARE, "got %d\n", params.dwWaveShape); + } + + IDirectSoundFXGargle_Release(gargle); } } -- 2.24.0.rc1