[PATCH] dmstyle: Add GUID_IDirectMusicStyle support in Style Track GetParam.

Michael Stefaniuc mstefani at winehq.org
Sun Nov 17 18:03:50 CST 2019


Hello Alistair,

I've added exhaustive IsParamSupported tests so you can drop that from
this patch.

thanks
bye
	michael


On 11/15/19 1:27 AM, Alistair Leslie-Hughes wrote:
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> ---
>  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, &params[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();
> 




More information about the wine-devel mailing list