Commit b3b7616f authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

dmsynth: Implement IKsControl_KsProperty for Synth and SynthSink objects.

parent 8bb1af84
......@@ -2,6 +2,7 @@
* IDirectMusicSynth8 Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -415,9 +416,52 @@ static ULONG WINAPI DMSynthImpl_IKsControl_Release(IKsControl* iface)
static HRESULT WINAPI DMSynthImpl_IKsControl_KsProperty(IKsControl* iface, PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
ULONG DataLength, ULONG* BytesReturned)
{
FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
return E_NOTIMPL;
TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->Set), Property->Id, Property->Flags);
if (Property->Flags != KSPROPERTY_TYPE_GET)
{
FIXME("Property flags %u not yet supported\n", Property->Flags);
return S_FALSE;
}
if (DataLength < sizeof(DWORD))
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_INSTRUMENT2))
{
*(DWORD*)PropertyData = TRUE;
*BytesReturned = sizeof(DWORD);
}
else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_DLS2))
{
*(DWORD*)PropertyData = TRUE;
*BytesReturned = sizeof(DWORD);
}
else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_GM_Hardware))
{
*(DWORD*)PropertyData = FALSE;
*BytesReturned = sizeof(DWORD);
}
else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_GS_Hardware))
{
*(DWORD*)PropertyData = FALSE;
*BytesReturned = sizeof(DWORD);
}
else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_XG_Hardware))
{
*(DWORD*)PropertyData = FALSE;
*BytesReturned = sizeof(DWORD);
}
else
{
FIXME("Unknown property %s\n", debugstr_guid(&Property->Set));
*(DWORD*)PropertyData = FALSE;
*BytesReturned = sizeof(DWORD);
}
return S_OK;
}
static HRESULT WINAPI DMSynthImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
......
......@@ -2,6 +2,7 @@
* IDirectMusicSynthSink Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -209,9 +210,32 @@ static ULONG WINAPI DMSynthSinkImpl_IKsControl_Release(IKsControl* iface)
static HRESULT WINAPI DMSynthSinkImpl_IKsControl_KsProperty(IKsControl* iface, PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
ULONG DataLength, ULONG* BytesReturned)
{
FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
return E_NOTIMPL;
TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->Set), Property->Id, Property->Flags);
if (Property->Flags != KSPROPERTY_TYPE_GET)
{
FIXME("Property flags %u not yet supported\n", Property->Flags);
return S_FALSE;
}
if (DataLength < sizeof(DWORD))
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_SinkUsesDSound))
{
*(DWORD*)PropertyData = TRUE;
*BytesReturned = sizeof(DWORD);
}
else
{
FIXME("Unknown property %s\n", debugstr_guid(&Property->Set));
*(DWORD*)PropertyData = FALSE;
*BytesReturned = sizeof(DWORD);
}
return S_OK;
}
static HRESULT WINAPI DMSynthSinkImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
......
......@@ -39,6 +39,9 @@ static void test_dmsynth(void)
IKsControl* control_synth = NULL;
IKsControl* control_sink = NULL;
HRESULT hr;
KSPROPERTY property;
ULONG value;
ULONG bytes;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth, (LPVOID*)&dmsynth);
if (hr != S_OK)
......@@ -52,9 +55,45 @@ static void test_dmsynth(void)
hr = IDirectMusicSynth_QueryInterface(dmsynth, &IID_IKsControl, (LPVOID*)&control_synth);
ok(hr == S_OK, "IDirectMusicSynth_QueryInterface returned: %x\n", hr);
property.Id = 0;
property.Flags = KSPROPERTY_TYPE_GET;
property.Set = GUID_DMUS_PROP_INSTRUMENT2;
hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == TRUE, "Return value: %u, should be 1\n", value);
property.Set = GUID_DMUS_PROP_DLS2;
hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == TRUE, "Return value: %u, should be 1\n", value);
property.Set = GUID_DMUS_PROP_GM_Hardware;
hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == FALSE, "Return value: %u, should be 0\n", value);
property.Set = GUID_DMUS_PROP_GS_Hardware;
hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == FALSE, "Return value: %u, should be 0\n", value);
property.Set = GUID_DMUS_PROP_XG_Hardware;
hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == FALSE, "Return value: %u, should be 0\n", value);
hr = IDirectMusicSynthSink_QueryInterface(dmsynth_sink, &IID_IKsControl, (LPVOID*)&control_sink);
ok(hr == S_OK, "IDirectMusicSynthSink_QueryInterface returned: %x\n", hr);
property.Set = GUID_DMUS_PROP_SinkUsesDSound;
hr = IKsControl_KsProperty(control_sink, &property, sizeof(property), &value, sizeof(value), &bytes);
ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
ok(value == TRUE, "Return value: %u, should be 1\n", value);
/* Synth has no default clock */
hr = IDirectMusicSynth_GetLatencyClock(dmsynth, &clock_synth);
ok(hr == DMUS_E_NOSYNTHSINK, "IDirectMusicSynth_GetLatencyClock returned: %x\n", hr);
......
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