Commit baddd558 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

dsdmo: Implement IDirectSoundFXI3DL2Reverb parameters methods.

parent 9faa7af9
......@@ -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;
......
......@@ -476,22 +476,34 @@ 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(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);
ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime);
ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio);
ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections);
ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay);
ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb);
ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay);
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);
}
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);
ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime);
ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio);
ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections);
ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay);
ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb);
ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment