dsdmo: Implement IDirectSoundFXI3DL2Reverb parameters methods.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-27 20:26:02 -05:00 committed by Alexandre Julliard
parent 9faa7af99a
commit baddd55817
2 changed files with 52 additions and 20 deletions

View File

@ -438,6 +438,7 @@ struct reverb
{
struct effect effect;
IDirectSoundFXI3DL2Reverb IDirectSoundFXI3DL2Reverb_iface;
DSFXI3DL2Reverb params;
};
static struct reverb *impl_from_IDirectSoundFXI3DL2Reverb(IDirectSoundFXI3DL2Reverb *iface)
@ -467,18 +468,24 @@ static HRESULT WINAPI reverb_params_SetAllParameters(IDirectSoundFXI3DL2Reverb *
{
struct reverb *effect = impl_from_IDirectSoundFXI3DL2Reverb(iface);
FIXME("effect %p, params %p, stub!\n", effect, params);
TRACE("effect %p, params %p.\n", effect, params);
return E_NOTIMPL;
EnterCriticalSection(&effect->effect.cs);
effect->params = *params;
LeaveCriticalSection(&effect->effect.cs);
return S_OK;
}
static HRESULT WINAPI reverb_params_GetAllParameters(IDirectSoundFXI3DL2Reverb *iface, DSFXI3DL2Reverb *params)
{
struct reverb *effect = impl_from_IDirectSoundFXI3DL2Reverb(iface);
FIXME("effect %p, params %p, stub!\n", effect, params);
TRACE("effect %p, params %p.\n", effect, params);
return E_NOTIMPL;
EnterCriticalSection(&effect->effect.cs);
*params = effect->params;
LeaveCriticalSection(&effect->effect.cs);
return S_OK;
}
static HRESULT WINAPI reverb_params_SetPreset(IDirectSoundFXI3DL2Reverb *iface, DWORD preset)
@ -567,6 +574,19 @@ static HRESULT reverb_create(IUnknown *outer, IUnknown **out)
effect_init(&object->effect, outer, &reverb_ops);
object->IDirectSoundFXI3DL2Reverb_iface.lpVtbl = &reverb_params_vtbl;
object->params.lRoom = DSFX_I3DL2REVERB_ROOM_DEFAULT;
object->params.lRoomHF = DSFX_I3DL2REVERB_ROOMHF_DEFAULT;
object->params.flRoomRolloffFactor = DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT;
object->params.flDecayTime = DSFX_I3DL2REVERB_DECAYTIME_DEFAULT;
object->params.flDecayHFRatio = DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT;
object->params.lReflections = DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT;
object->params.flReflectionsDelay = DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT;
object->params.lReverb = DSFX_I3DL2REVERB_REVERB_DEFAULT;
object->params.flReverbDelay = DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT;
object->params.flDiffusion = DSFX_I3DL2REVERB_DIFFUSION_DEFAULT;
object->params.flDensity = DSFX_I3DL2REVERB_DENSITY_DEFAULT;
object->params.flHFReference = DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT;
TRACE("Created I3DL2 reverb effect %p.\n", object);
*out = &object->effect.IUnknown_inner;
return S_OK;

View File

@ -476,9 +476,7 @@ static void test_reverb_parameters(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, &params);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(params.lRoom == -1000, "Got room attenuation %d mB.\n", params.lRoom);
ok(params.lRoomHF == -100, "Got room high-frequency attenuation %d mB.\n", params.lRoomHF);
ok(params.flRoomRolloffFactor == 0.0f, "Got room rolloff factor %.8e.\n", params.flRoomRolloffFactor);
@ -491,7 +489,21 @@ static void test_reverb_parameters(void)
ok(params.flDiffusion == 100.0f, "Got diffusion %.8e%%.\n", params.flDiffusion);
ok(params.flDensity == 100.0f, "Got density %.8e%%.\n", params.flDensity);
ok(params.flHFReference == 5000.0f, "Got reference high frequency %.8e Hz.\n", params.flHFReference);
}
params.lRoom = -10001;
hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
params.lRoom = 1;
hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
params.lRoom = -900;
hr = IDirectSoundFXI3DL2Reverb_SetAllParameters(reverb, &params);
ok(hr == S_OK, "Got hr %#x.\n", hr);
memset(&params, 0xcc, sizeof(params));
hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, &params);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(params.lRoom == -900, "Got room attenuation %d mB.\n", params.lRoom);
ref = IDirectSoundFXI3DL2Reverb_Release(reverb);
ok(!ref, "Got outstanding refcount %d.\n", ref);