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

82 lines
2.8 KiB
Diff
Raw Normal View History

From dee460be6585aaf94221575e676745f4d7806aaf Mon Sep 17 00:00:00 2001
2019-09-18 18:54:33 -07:00
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 9 Sep 2019 11:06:11 +1000
Subject: [PATCH] dsdmo: Implement IDirectSoundFXGargle SetAllParameters.
2019-09-18 18:54:33 -07:00
---
dlls/dsdmo/gargle.c | 17 +++++++++++++++--
dlls/dsound/tests/dsound8.c | 28 ++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
2019-09-18 18:54:33 -07:00
diff --git a/dlls/dsdmo/gargle.c b/dlls/dsdmo/gargle.c
index 458ca8a3234..03358ec5352 100644
2019-09-18 18:54:33 -07:00
--- 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
2019-09-18 18:54:33 -07:00
--- 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);
2019-09-18 18:54:33 -07:00
+ 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);
+ }
+
2019-09-18 18:54:33 -07:00
+
IDirectSoundFXGargle_Release(gargle);
}
}
--
2.24.0.rc1
2019-09-18 18:54:33 -07:00