dsound: Select the nth effect matching the given CLSID in GetObjectInPath().

Instead of selecting the nth effect overall and checking whether it matches.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-28 20:29:42 -05:00 committed by Alexandre Julliard
parent 1c843d3997
commit 91625e43f4
2 changed files with 25 additions and 31 deletions

View File

@ -845,27 +845,25 @@ static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources(IDirectSoundBuffer
}
static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath(IDirectSoundBuffer8 *iface,
REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, void **ppObject)
REFGUID clsid, DWORD index, REFGUID iid, void **out)
{
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
DWORD i, count = 0;
TRACE("(%p,%s,%u,%s,%p)\n",This,debugstr_guid(rguidObject),dwIndex,debugstr_guid(rguidInterface),ppObject);
TRACE("(%p,%s,%u,%s,%p)\n", This, debugstr_guid(clsid), index, debugstr_guid(iid), out);
if (dwIndex >= This->num_filters)
return DSERR_CONTROLUNAVAIL;
if (!out)
return E_INVALIDARG;
if (!ppObject)
return E_INVALIDARG;
if (IsEqualGUID(rguidObject, &This->filters[dwIndex].guid) || IsEqualGUID(rguidObject, &GUID_All_Objects)) {
if (SUCCEEDED(IMediaObject_QueryInterface(This->filters[dwIndex].obj, rguidInterface, ppObject)))
return DS_OK;
else
return E_NOINTERFACE;
} else {
WARN("control unavailable\n");
return DSERR_OBJECTNOTFOUND;
}
for (i = 0; i < This->num_filters; i++)
{
if (IsEqualGUID(clsid, &This->filters[i].guid) || IsEqualGUID(clsid, &GUID_All_Objects))
{
if (count++ == index)
return IMediaObject_QueryInterface(This->filters[i].obj, iid, out);
}
}
return DSERR_OBJECTNOTFOUND;
}
static HRESULT WINAPI IDirectSoundBufferImpl_Initialize(IDirectSoundBuffer8 *iface,

View File

@ -1678,7 +1678,7 @@ static void test_effects(void)
dmo = (IMediaObject *)0xdeadbeef;
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo);
todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo);
effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ;
@ -1705,9 +1705,8 @@ static void test_effects(void)
echo = dmo;
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8,
&GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IMediaObject, (void **)&dmo);
todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr);
if (hr == DS_OK)
reverb = dmo;
ok(hr == DS_OK, "Got hr %#x.\n", hr);
reverb = dmo;
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo);
ok(hr == DS_OK, "Got hr %#x.\n", hr);
@ -1716,12 +1715,12 @@ static void test_effects(void)
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo);
ok(hr == DS_OK, "Got hr %#x.\n", hr);
todo_wine ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo);
ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo);
IMediaObject_Release(dmo);
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8,
&GUID_DSFX_STANDARD_I3DL2REVERB, 1, &IID_IMediaObject, (void **)&dmo);
todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IDirectSoundFXParamEq, (void **)&unk);
ok(hr == DS_OK, "Got hr %#x.\n", hr);
@ -1743,14 +1742,11 @@ static void test_effects(void)
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8,
&GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk);
todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr);
if (hr == DS_OK)
IUnknown_Release(unk);
ok(hr == DS_OK, "Got hr %#x.\n", hr);
IUnknown_Release(unk);
if (echo)
IMediaObject_Release(echo);
if (reverb)
IMediaObject_Release(reverb);
IMediaObject_Release(echo);
IMediaObject_Release(reverb);
got_Process = CreateEventA(NULL, TRUE, FALSE, NULL);
@ -1786,7 +1782,7 @@ static void test_effects(void)
ok(hr == DS_OK, "Got hr %#x.\n", hr);
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo);
todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
CloseHandle(got_Process);
IDirectSoundBuffer8_Release(buffer8);