wine-staging/patches/dsdmo-new-dll/0021-dsdmo-Implement-IDirectSoundFXGargle-SetAllParameter.patch

81 lines
2.8 KiB
Diff
Raw Normal View History

2019-09-18 18:54:33 -07:00
From b2270412e6ba81f561b70ca455444158a32303a6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 9 Sep 2019 11:06:11 +1000
Subject: [PATCH 21/27] dsdmo: Implement IDirectSoundFXGargle SetAllParameters.
---
dlls/dsdmo/gargle.c | 17 +++++++++++++++--
dlls/dsound/tests/dsound8.c | 27 +++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/dsdmo/gargle.c b/dlls/dsdmo/gargle.c
index 458ca8a323..03358ec535 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 fd5c5a5835..c634854532 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -1451,6 +1451,33 @@ static void test_gargle_parameters(IDirectSoundBuffer8 *secondary8)
ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "got %d\n", params.dwWaveShape);
}
+ rc = IDirectSoundFXGargle_SetAllParameters(gargle, NULL);
+ ok(rc == E_POINTER, "got: %08x\n", rc);
+
+ /* Out of range Min */
+ params.dwRateHz = 0;
+
+ rc = IDirectSoundFXGargle_SetAllParameters(gargle, &params);
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
+
+ /* Out of range Max */
+ params.dwRateHz = 1001;
+ rc = IDirectSoundFXGargle_SetAllParameters(gargle, &params);
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
+
+ params.dwRateHz = 800;
+ params.dwWaveShape = DSFXGARGLE_WAVE_SQUARE;
+ rc = IDirectSoundFXGargle_SetAllParameters(gargle, &params);
+ ok(rc == S_OK, "got: %08x\n", rc);
+
+ rc = IDirectSoundFXGargle_GetAllParameters(gargle, &params);
+ 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.17.1