Christian Costa : dmsynth: Add stubbed IKsControl interface to DirectMusicSynth object.

Alexandre Julliard julliard at winehq.org
Tue May 8 14:16:56 CDT 2012


Module: wine
Branch: master
Commit: 1f3d99a2e4cb2a0c512744465a1b6bbd983f0c3f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1f3d99a2e4cb2a0c512744465a1b6bbd983f0c3f

Author: Christian Costa <titan.costa at gmail.com>
Date:   Thu May  3 23:05:51 2012 +0200

dmsynth: Add stubbed IKsControl interface to DirectMusicSynth object.

---

 dlls/dmsynth/dmsynth_private.h |   18 +++++----
 dlls/dmsynth/synth.c           |   76 +++++++++++++++++++++++++++++++++++++++-
 dlls/dmsynth/tests/dmsynth.c   |    2 +-
 3 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/dlls/dmsynth/dmsynth_private.h b/dlls/dmsynth/dmsynth_private.h
index aec547a..86606bb 100644
--- a/dlls/dmsynth/dmsynth_private.h
+++ b/dlls/dmsynth/dmsynth_private.h
@@ -39,6 +39,7 @@
 #include "dmusici.h"
 #include "dmusicf.h"
 #include "dmusics.h"
+#include "dmksctrl.h"
 
 /*****************************************************************************
  * Interfaces
@@ -56,15 +57,16 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSinkImpl (LPCGUID lpcGUID, LP
  * IDirectMusicSynth8Impl implementation structure
  */
 struct IDirectMusicSynth8Impl {
-  /* IUnknown fields */
-  IDirectMusicSynth8 IDirectMusicSynth8_iface;
-  LONG          ref;
-
-  /* IDirectMusicSynth8 fields */
-  DMUS_PORTCAPS pCaps;
-  BOOL fActive;
-  IReferenceClock* pLatencyClock;
-  IDirectMusicSynthSinkImpl* pSynthSink;
+    /* IUnknown fields */
+    IDirectMusicSynth8 IDirectMusicSynth8_iface;
+    IKsControl IKsControl_iface;
+    LONG ref;
+
+    /* IDirectMusicSynth8 fields */
+    DMUS_PORTCAPS pCaps;
+    BOOL fActive;
+    IReferenceClock* pLatencyClock;
+    IDirectMusicSynthSinkImpl* pSynthSink;
 };
 
 /*****************************************************************************
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c
index aadb72f..9c088af 100644
--- a/dlls/dmsynth/synth.c
+++ b/dlls/dmsynth/synth.c
@@ -1,4 +1,5 @@
-/* IDirectMusicSynth8 Implementation
+/*
+ * IDirectMusicSynth8 Implementation
  *
  * Copyright (C) 2003-2004 Rok Mandeljc
  *
@@ -17,6 +18,12 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define COBJMACROS
+
+#include "objbase.h"
+#include "initguid.h"
+#include "dmksctrl.h"
+
 #include "dmsynth_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
@@ -40,6 +47,12 @@ static HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface(LPDIRECTMUSICSYNTH8
 		*ppobj = This;
 		return S_OK;
 	}
+    else if (IsEqualIID(riid, &IID_IKsControl)) {
+		IUnknown_AddRef(iface);
+		*ppobj = &This->IKsControl_iface;
+		return S_OK;
+    }
+
 	WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
 	return E_NOINTERFACE;
 }
@@ -324,6 +337,66 @@ static const IDirectMusicSynth8Vtbl DirectMusicSynth8_Vtbl = {
 	IDirectMusicSynth8Impl_AssignChannelToBuses
 };
 
+static inline IDirectMusicSynth8Impl *impl_from_IKsControl(IKsControl *iface)
+{
+    return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IKsControl_iface);
+}
+
+static HRESULT WINAPI DMSynthImpl_IKsControl_QueryInterface(IKsControl* iface, REFIID riid, LPVOID *ppobj)
+{
+    IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
+
+    return IDirectMusicSynth8Impl_QueryInterface(&This->IDirectMusicSynth8_iface, riid, ppobj);
+}
+
+static ULONG WINAPI DMSynthImpl_IKsControl_AddRef(IKsControl* iface)
+{
+    IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
+
+    return IDirectMusicSynth8Impl_AddRef(&This->IDirectMusicSynth8_iface);
+}
+
+static ULONG WINAPI DMSynthImpl_IKsControl_Release(IKsControl* iface)
+{
+    IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
+
+    return IDirectMusicSynth8Impl_Release(&This->IDirectMusicSynth8_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);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DMSynthImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
+                                                      ULONG DataLength, ULONG* BytesReturned)
+{
+    FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Method, MethodLength, MethodData, DataLength, BytesReturned);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DMSynthImpl_IKsControl_KsEvent(IKsControl* iface, PKSEVENT Event, ULONG EventLength, LPVOID EventData,
+                                                     ULONG DataLength, ULONG* BytesReturned)
+{
+    FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Event, EventLength, EventData, DataLength, BytesReturned);
+
+    return E_NOTIMPL;
+}
+
+
+static const IKsControlVtbl DMSynthImpl_IKsControl_Vtbl = {
+    DMSynthImpl_IKsControl_QueryInterface,
+    DMSynthImpl_IKsControl_AddRef,
+    DMSynthImpl_IKsControl_Release,
+    DMSynthImpl_IKsControl_KsProperty,
+    DMSynthImpl_IKsControl_KsMethod,
+    DMSynthImpl_IKsControl_KsEvent
+};
+
 /* for ClassFactory */
 HRESULT WINAPI DMUSIC_CreateDirectMusicSynthImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter)
 {
@@ -336,6 +409,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicSynthImpl (LPCGUID lpcGUID, LPVOID* ppobj
 		return E_OUTOFMEMORY;
 	}
 	obj->IDirectMusicSynth8_iface.lpVtbl = &DirectMusicSynth8_Vtbl;
+	obj->IKsControl_iface.lpVtbl = &DMSynthImpl_IKsControl_Vtbl;
 	obj->ref = 0;
 	/* fill in caps */
 	obj->pCaps.dwSize = sizeof(DMUS_PORTCAPS);
diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c
index 66da1fb..3a53900 100644
--- a/dlls/dmsynth/tests/dmsynth.c
+++ b/dlls/dmsynth/tests/dmsynth.c
@@ -51,7 +51,7 @@ static void test_dmsynth(void)
     ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
 
     hr = IDirectMusicSynth_QueryInterface(dmsynth, &IID_IKsControl, (LPVOID*)&control_synth);
-    todo_wine ok(hr == S_OK, "IDirectMusicSynth_QueryInterface returned: %x\n", hr);
+    ok(hr == S_OK, "IDirectMusicSynth_QueryInterface returned: %x\n", hr);
     hr = IDirectMusicSynthSink_QueryInterface(dmsynth_sink, &IID_IKsControl, (LPVOID*)&control_sink);
     todo_wine ok(hr == S_OK, "IDirectMusicSynthSink_QueryInterface returned: %x\n", hr);
 




More information about the wine-cvs mailing list