From: Alistair Leslie-Hughes Subject: [PATCH] dmstyle: Add GUID_IDirectMusicStyle support in Style Track GetParam. Message-Id: Date: Fri, 15 Nov 2019 00:27:35 +0000 Signed-off-by: Alistair Leslie-Hughes --- dlls/dmstyle/styletrack.c | 24 ++++++++++++++++++++---- dlls/dmstyle/tests/dmstyle.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c index cc15bd81d1..06fe1c7ca8 100644 --- a/dlls/dmstyle/styletrack.c +++ b/dlls/dmstyle/styletrack.c @@ -132,15 +132,31 @@ static HRESULT WINAPI style_track_Play(IDirectMusicTrack8 *iface, void *pStateDa return S_OK; } -static HRESULT WINAPI style_track_GetParam(IDirectMusicTrack8 *iface, REFGUID rguidType, - MUSIC_TIME mtTime, MUSIC_TIME *pmtNext, void *pParam) +static HRESULT WINAPI style_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, + MUSIC_TIME time, MUSIC_TIME *next, void *param) { IDirectMusicStyleTrack *This = impl_from_IDirectMusicTrack8(iface); - FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam); + struct list *item = NULL; - if (!rguidType) + FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(type), time, next, param); + + if (!type) return E_POINTER; + if (IsEqualGUID(&GUID_IDirectMusicStyle, type)) { + LIST_FOR_EACH (item, &This->Items) { + DMUS_PRIVATE_STYLE_ITEM *style = LIST_ENTRY(item, DMUS_PRIVATE_STYLE_ITEM, entry); + if (style->pObject) { + IDirectMusicStyle8_AddRef(style->pObject); + *((IDirectMusicStyle8**)param) = style->pObject; + + return S_OK; + } + } + + return DMUS_E_NOT_FOUND; + } + return S_OK; } diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c index 6b2275866c..9cb42ec077 100644 --- a/dlls/dmstyle/tests/dmstyle.c +++ b/dlls/dmstyle/tests/dmstyle.c @@ -318,6 +318,12 @@ static void test_track(void) ok(hr == E_NOTIMPL, "IDirectMusicTrack8_Join failed: %08x\n", hr); } + hr = IDirectMusicTrack8_IsParamSupported(dmt8, &GUID_IDirectMusicStyle); + if (class[i].clsid == &CLSID_DirectMusicStyleTrack) + ok(hr == S_OK, "got: %08x\n", hr); + else + ok(hr == DMUS_E_TYPE_UNSUPPORTED, "got: %08x\n", hr); + /* IPersistStream */ hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps); ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); @@ -341,6 +347,30 @@ static void test_track(void) } } +static void test_track_DirectMusicStyleTrack(void) +{ + IDirectMusicTrack8 *dmt8; + HRESULT hr; + GUID params[] = { GUID_DisableTimeSig, GUID_EnableTimeSig, GUID_IDirectMusicStyle, GUID_SeedVariations, + GUID_TimeSignature}; + IDirectMusicStyle *style = NULL; + int i; + + hr = CoCreateInstance(&CLSID_DirectMusicStyleTrack, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicTrack8, + (void**)&dmt8); + ok(hr == S_OK, "Failed: %08x\n", hr); + + for (i=0; i < ARRAY_SIZE(params); i++) { + hr = IDirectMusicTrack8_IsParamSupported(dmt8, ¶ms[i]); + ok(hr == S_OK, "Failed: %08x\n", hr); + } + + hr = IDirectMusicTrack8_GetParam(dmt8, &GUID_IDirectMusicStyle, 0, NULL, &style); + ok(hr == DMUS_E_NOT_FOUND, "Failed: %08x\n", hr); + + IDirectMusicTrack8_Release(dmt8); +} + struct chunk { FOURCC id; DWORD size; @@ -556,6 +586,7 @@ START_TEST(dmstyle) test_COM_track(); test_dmstyle(); test_track(); + test_track_DirectMusicStyleTrack(); test_parsedescriptor(); CoUninitialize(); -- 2.17.1