wine-staging/patches/dsdmo-new-dll/0023-dsdmo-Implement-IDirectSoundFXFlanger-SetAllParamete.patch
2019-11-09 15:13:58 +11:00

90 lines
3.6 KiB
Diff

From 00e59f2589dc4a44b990c6455b0bdc6e38b97db1 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 9 Sep 2019 13:44:41 +1000
Subject: [PATCH] dsdmo: Implement IDirectSoundFXFlanger SetAllParameters.
---
dlls/dsdmo/flanger.c | 21 +++++++++++++++++++--
dlls/dsound/tests/dsound8.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/dsdmo/flanger.c b/dlls/dsdmo/flanger.c
index a647c862fa9..e1012b8d1ce 100644
--- a/dlls/dsdmo/flanger.c
+++ b/dlls/dsdmo/flanger.c
@@ -352,9 +352,26 @@ static ULONG WINAPI flangerfx_Release(IDirectSoundFXFlanger *iface)
static HRESULT WINAPI flangerfx_SetAllParameters(IDirectSoundFXFlanger *iface, const DSFXFlanger *flanger)
{
struct dmo_flangerfx *This = impl_from_IDirectSoundFXFlanger(iface);
- FIXME("(%p) %p\n", This, flanger);
- return E_NOTIMPL;
+ TRACE("(%p) %p\n", This, flanger);
+
+ if(!flanger)
+ return E_POINTER;
+
+ if( (flanger->fWetDryMix < DSFXECHO_WETDRYMIX_MIN || flanger->fWetDryMix > DSFXECHO_WETDRYMIX_MAX) ||
+ (flanger->fDepth < DSFXFLANGER_DEPTH_MIN || flanger->fDepth > DSFXFLANGER_DEPTH_MAX) ||
+ (flanger->fFeedback < DSFXFLANGER_FEEDBACK_MIN || flanger->fFeedback > DSFXFLANGER_FEEDBACK_MAX) ||
+ (flanger->fFrequency < DSFXFLANGER_FREQUENCY_MIN || flanger->fFrequency > DSFXFLANGER_FREQUENCY_MAX) ||
+ (flanger->lWaveform != DSFXFLANGER_WAVE_SIN && flanger->lWaveform != DSFXFLANGER_WAVE_TRIANGLE) ||
+ (flanger->fDelay < DSFXFLANGER_DELAY_MIN || flanger->fDelay > DSFXFLANGER_DELAY_MAX) ||
+ (flanger->lPhase < DSFXFLANGER_PHASE_MIN || flanger->lPhase > DSFXFLANGER_PHASE_MAX) )
+ {
+ return E_INVALIDARG;
+ }
+
+ This->params = *flanger;
+
+ return S_OK;
}
static HRESULT WINAPI flangerfx_GetAllParameters(IDirectSoundFXFlanger *iface, DSFXFlanger *flanger)
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index ecd755e0330..4e4aa8a795a 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -1657,6 +1657,38 @@ static void test_flanger_parameters(IDirectSoundBuffer8 *secondary8)
test_dsfx_interfaces("FXFlanger", (IUnknown *)flanger, &IID_IDirectSoundFXFlanger);
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, NULL);
+ ok(rc == E_POINTER, "got: %08x\n", rc);
+
+ /* Out of range Min */
+ params.fWetDryMix = -1.0f;
+
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, &params);
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
+
+ /* Out of range Max */
+ params.fWetDryMix = 101.1f;
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, &params);
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
+
+ params.fWetDryMix = 80.1f;
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, &params);
+ ok(rc == S_OK, "got: %08x\n", rc);
+
+ rc = IDirectSoundFXFlanger_GetAllParameters(flanger, &params);
+ ok(rc == DS_OK, "Failed: %08x\n", rc);
+ if (rc == DS_OK)
+ {
+ ok(params.fWetDryMix == 80.1f, "got %f\n", params.fWetDryMix);
+ ok(params.fDepth == 100.0f, "got %f\n", params.fDepth);
+ ok(params.fFeedback == -50.0f, "got %f\n", params.fFeedback);
+ ok(params.fFrequency == 0.25f, "got %f\n", params.fFrequency);
+ ok(params.lWaveform == DSFXFLANGER_WAVE_SIN, "got %d\n", params.lWaveform);
+ ok(params.fDelay == 2.0f, "got %f\n", params.fDelay);
+ ok(params.lPhase == 2, "got %d\n", params.lPhase);
+ }
+
+
IDirectSoundFXFlanger_Release(flanger);
}
}
--
2.24.0.rc1