dsdmo: Implement IDirectSoundFXParamEq 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:05 -05:00 committed by Alexandre Julliard
parent 861cfee25d
commit 3ba24075f2
2 changed files with 36 additions and 11 deletions

View File

@ -438,6 +438,7 @@ struct eq
{
struct effect effect;
IDirectSoundFXParamEq IDirectSoundFXParamEq_iface;
DSFXParamEq params;
};
static struct eq *impl_from_IDirectSoundFXParamEq(IDirectSoundFXParamEq *iface)
@ -467,18 +468,24 @@ static HRESULT WINAPI eq_params_SetAllParameters(IDirectSoundFXParamEq *iface, c
{
struct eq *effect = impl_from_IDirectSoundFXParamEq(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 eq_params_GetAllParameters(IDirectSoundFXParamEq *iface, DSFXParamEq *params)
{
struct eq *effect = impl_from_IDirectSoundFXParamEq(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 const IDirectSoundFXParamEqVtbl eq_params_vtbl =
@ -527,6 +534,10 @@ static HRESULT eq_create(IUnknown *outer, IUnknown **out)
effect_init(&object->effect, outer, &eq_ops);
object->IDirectSoundFXParamEq_iface.lpVtbl = &eq_params_vtbl;
object->params.fCenter = 8000.0f;
object->params.fBandwidth = 12.0f;
object->params.fGain = 0.0f;
TRACE("Created equalizer effect %p.\n", object);
*out = &object->effect.IUnknown_inner;
return S_OK;

View File

@ -453,13 +453,27 @@ static void test_eq_parameters(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IDirectSoundFXParamEq_GetAllParameters(eq, &params);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
}
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
params.fCenter = 79.0f;
hr = IDirectSoundFXParamEq_SetAllParameters(eq, &params);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
params.fCenter = 16001.0f;
hr = IDirectSoundFXParamEq_SetAllParameters(eq, &params);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
params.fCenter = 738.0f;
hr = IDirectSoundFXParamEq_SetAllParameters(eq, &params);
ok(hr == S_OK, "Got hr %#x.\n", hr);
memset(&params, 0xcc, sizeof(params));
hr = IDirectSoundFXParamEq_GetAllParameters(eq, &params);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(params.fCenter == 738.0f, "Got center frequency %.8e Hz.\n", params.fCenter);
ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth);
ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain);
ref = IDirectSoundFXParamEq_Release(eq);
ok(!ref, "Got outstanding refcount %d.\n", ref);