mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
90 lines
3.6 KiB
Diff
90 lines
3.6 KiB
Diff
|
From 865d05785612e7a098793613cdda907337ea01ad 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 23/27] dsdmo: Implement IDirectSoundFXFlanger
|
||
|
SetAllParameters.
|
||
|
|
||
|
---
|
||
|
dlls/dsdmo/flanger.c | 21 +++++++++++++++++++--
|
||
|
dlls/dsound/tests/dsound8.c | 31 +++++++++++++++++++++++++++++++
|
||
|
2 files changed, 50 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/dlls/dsdmo/flanger.c b/dlls/dsdmo/flanger.c
|
||
|
index a647c862fa..e1012b8d1c 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 d68e4a50f8..bdcf609c8f 100644
|
||
|
--- a/dlls/dsound/tests/dsound8.c
|
||
|
+++ b/dlls/dsound/tests/dsound8.c
|
||
|
@@ -1565,6 +1565,37 @@ static void test_flanger_parameters(IDirectSoundBuffer8 *secondary8)
|
||
|
ok(params.lPhase == 2, "got %d\n", params.lPhase);
|
||
|
}
|
||
|
|
||
|
+ 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, ¶ms);
|
||
|
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
|
||
|
+
|
||
|
+ /* Out of range Max */
|
||
|
+ params.fWetDryMix = 101.1f;
|
||
|
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, ¶ms);
|
||
|
+ ok(rc == E_INVALIDARG, "got: %08x\n", rc);
|
||
|
+
|
||
|
+ params.fWetDryMix = 80.1f;
|
||
|
+ rc = IDirectSoundFXFlanger_SetAllParameters(flanger, ¶ms);
|
||
|
+ ok(rc == S_OK, "got: %08x\n", rc);
|
||
|
+
|
||
|
+ rc = IDirectSoundFXFlanger_GetAllParameters(flanger, ¶ms);
|
||
|
+ 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.17.1
|
||
|
|