From df167d17c626a3780d260e8a72846e5c7421a435 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Fri, 22 Aug 2003 23:53:27 +0000 Subject: [PATCH] - implemented loader, loader's stream and loading of objects (now you can use builtin dmloader and native other dm*.dlls) - implemented proper creation of objects and retrieval of dmusic interfaces from them (object, stream, ...) - implemented all "standard track types" and appropriate stream (for dmband, loading is almost complete) - cleaned some obsolete stuff - split debug channels --- dlls/dmband/Makefile.in | 1 + dlls/dmband/band.c | 508 +++++++++++++- dlls/dmband/bandtrack.c | 589 ++++++++++++++++ dlls/dmband/dmband_main.c | 117 +++- dlls/dmband/dmband_private.h | 170 +++++ dlls/dmband/regsvr.c | 2 +- dlls/dmcompos/Makefile.in | 4 +- dlls/dmcompos/chordmap.c | 206 +++++- dlls/dmcompos/chordmaptrack.c | 339 ++++++++++ dlls/dmcompos/composer.c | 13 +- dlls/dmcompos/dmcompos_main.c | 292 +++++++- dlls/dmcompos/dmcompos_private.h | 194 +++++- dlls/dmcompos/regsvr.c | 2 +- dlls/dmcompos/signposttrack.c | 338 ++++++++++ dlls/dmime/Makefile.in | 10 +- dlls/dmime/audiopath.c | 243 ++++++- dlls/dmime/dmime_main.c | 921 ++++++++++++++++++++++++-- dlls/dmime/dmime_private.h | 878 ++++++++++++++++++++++-- dlls/dmime/graph.c | 225 ++++++- dlls/dmime/lyricstrack.c | 337 ++++++++++ dlls/dmime/markertrack.c | 342 ++++++++++ dlls/dmime/paramcontroltrack.c | 336 ++++++++++ dlls/dmime/patterntrack.c | 15 +- dlls/dmime/performance.c | 102 ++- dlls/dmime/regsvr.c | 2 +- dlls/dmime/segment.c | 507 +++++++++++++- dlls/dmime/segmentstate.c | 22 +- dlls/dmime/segtriggertrack.c | 338 ++++++++++ dlls/dmime/seqtrack.c | 338 ++++++++++ dlls/dmime/song.c | 225 ++++++- dlls/dmime/sysextrack.c | 337 ++++++++++ dlls/dmime/tempotrack.c | 342 ++++++++++ dlls/dmime/timesigtrack.c | 341 ++++++++++ dlls/dmime/tool.c | 21 +- dlls/dmime/track.c | 237 ------- dlls/dmime/wavetrack.c | 343 ++++++++++ dlls/dmloader/Makefile.in | 2 +- dlls/dmloader/container.c | 219 +++++- dlls/dmloader/dmloader_main.c | 112 +++- dlls/dmloader/dmloader_private.h | 134 +++- dlls/dmloader/getloader.c | 96 --- dlls/dmloader/loader.c | 245 +++++-- dlls/dmloader/loaderstream.c | 281 ++++++++ dlls/dmloader/regsvr.c | 6 +- dlls/dmscript/Makefile.in | 3 +- dlls/dmscript/dmscript_main.c | 577 +++++++++++++++- dlls/dmscript/dmscript_private.h | 128 ++++ dlls/dmscript/regsvr.c | 4 +- dlls/dmscript/script.c | 227 ++++++- dlls/dmscript/scripttrack.c | 338 ++++++++++ dlls/dmstyle/Makefile.in | 9 +- dlls/dmstyle/auditiontrack.c | 338 ++++++++++ dlls/dmstyle/chordtrack.c | 465 +++++++++++++ dlls/dmstyle/commandtrack.c | 387 +++++++++++ dlls/dmstyle/dmstyle_main.c | 536 ++++++++++++++- dlls/dmstyle/dmstyle_private.h | 551 ++++++++++++++- dlls/dmstyle/melodyformulationtrack.c | 343 ++++++++++ dlls/dmstyle/motiftrack.c | 344 ++++++++++ dlls/dmstyle/mutetrack.c | 384 +++++++++++ dlls/dmstyle/regsvr.c | 2 +- dlls/dmstyle/style.c | 238 ++++++- dlls/dmstyle/styletrack.c | 531 +++++++++++++++ dlls/dmsynth/dmsynth_main.c | 115 +++- dlls/dmsynth/regsvr.c | 2 +- dlls/dmsynth/synth.c | 23 +- dlls/dmsynth/synthsink.c | 19 +- dlls/dmusic/Makefile.in | 4 +- dlls/dmusic/buffer.c | 13 +- dlls/dmusic/clock.c | 13 +- dlls/dmusic/collection.c | 262 +++++++- dlls/dmusic/dmusic.c | 22 +- dlls/dmusic/dmusic_main.c | 134 ++-- dlls/dmusic/dmusic_private.h | 93 ++- dlls/dmusic/download.c | 13 +- dlls/dmusic/downloadedinstrument.c | 15 +- dlls/dmusic/instrument.c | 17 +- dlls/dmusic/object.c | 127 ---- dlls/dmusic/port.c | 9 +- dlls/dmusic/portdownload.c | 13 +- dlls/dmusic/thru.c | 13 +- dlls/dmusic32/dmusic32.spec | 4 +- dlls/dmusic32/dmusic32_main.c | 38 +- winedefault.reg | 3 + 83 files changed, 15454 insertions(+), 1235 deletions(-) create mode 100644 dlls/dmband/bandtrack.c create mode 100644 dlls/dmcompos/chordmaptrack.c create mode 100644 dlls/dmcompos/signposttrack.c create mode 100644 dlls/dmime/lyricstrack.c create mode 100644 dlls/dmime/markertrack.c create mode 100644 dlls/dmime/paramcontroltrack.c create mode 100644 dlls/dmime/segtriggertrack.c create mode 100644 dlls/dmime/seqtrack.c create mode 100644 dlls/dmime/sysextrack.c create mode 100644 dlls/dmime/tempotrack.c create mode 100644 dlls/dmime/timesigtrack.c delete mode 100644 dlls/dmime/track.c create mode 100644 dlls/dmime/wavetrack.c delete mode 100644 dlls/dmloader/getloader.c create mode 100644 dlls/dmloader/loaderstream.c create mode 100644 dlls/dmscript/scripttrack.c create mode 100644 dlls/dmstyle/auditiontrack.c create mode 100644 dlls/dmstyle/chordtrack.c create mode 100644 dlls/dmstyle/commandtrack.c create mode 100644 dlls/dmstyle/melodyformulationtrack.c create mode 100644 dlls/dmstyle/motiftrack.c create mode 100644 dlls/dmstyle/mutetrack.c create mode 100644 dlls/dmstyle/styletrack.c delete mode 100644 dlls/dmusic/object.c diff --git a/dlls/dmband/Makefile.in b/dlls/dmband/Makefile.in index 725acbcf0a0..6ae78565aa3 100644 --- a/dlls/dmband/Makefile.in +++ b/dlls/dmband/Makefile.in @@ -11,6 +11,7 @@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ band.c \ + bandtrack.c \ dmband_main.c \ regsvr.c diff --git a/dlls/dmband/band.c b/dlls/dmband/band.c index 7df17ed6d6e..e7da0b36f0e 100644 --- a/dlls/dmband/band.c +++ b/dlls/dmband/band.c @@ -25,9 +25,13 @@ #include "dmband_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmband); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); -/* IDirectMusicBand IUnknown parts follow: */ +/***************************************************************************** + * IDirectMusicBandImpl implementation + */ +/* IDirectMusicBand IUnknown part: */ HRESULT WINAPI IDirectMusicBandImpl_QueryInterface (LPDIRECTMUSICBAND iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicBandImpl,iface); @@ -62,7 +66,7 @@ ULONG WINAPI IDirectMusicBandImpl_Release (LPDIRECTMUSICBAND iface) return ref; } -/* IDirectMusicBand Interface follow: */ +/* IDirectMusicBand IDirectMusicBand part: */ HRESULT WINAPI IDirectMusicBandImpl_CreateSegment (LPDIRECTMUSICBAND iface, IDirectMusicSegment** ppSegment) { ICOM_THIS(IDirectMusicBandImpl,iface); @@ -122,3 +126,501 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicBand (LPCGUID lpcGUID, LPDIRECTMUSICBAND* return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicBandObject implementation + */ +/* IDirectMusicBandObject IUnknown part: */ +HRESULT WINAPI IDirectMusicBandObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + + if (IsEqualGUID (riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IDirectMusicObject)) { + IDirectMusicBandObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualGUID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualGUID (riid, &IID_IDirectMusicBand)) { + IDirectMusicBand_AddRef ((LPDIRECTMUSICBAND)This->pBand); + *ppobj = (LPDIRECTMUSICBAND)This->pBand; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicBandObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicBandObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicBandObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicBandObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicBandObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicBandObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicBandObject_QueryInterface, + IDirectMusicBandObject_AddRef, + IDirectMusicBandObject_Release, + IDirectMusicBandObject_GetDescriptor, + IDirectMusicBandObject_SetDescriptor, + IDirectMusicBandObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicBandObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicBandObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualGUID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicBandObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandObjectStream)); + obj->pStream->lpVtbl = &DirectMusicBandObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicBand */ + DMUSIC_CreateDirectMusicBand (&IID_IDirectMusicBand, (LPDIRECTMUSICBAND*)&obj->pBand, NULL); + obj->pBand->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicBandObjectStream implementation + */ +/* IDirectMusicBandObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicBandObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicBandObjectStream,iface); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IPersistStream)) { + IDirectMusicBandObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicBandObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicBandObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicBandObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicBandObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicBandObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicBandObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicBandObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicBandObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicBandObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicBandObjectStream,iface); + FOURCC chunkID; + DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3]; + LARGE_INTEGER liMove; /* used when skipping chunks */ + DMUS_IO_REFERENCE tempReferenceHeader; + DMUS_OBJECTDESC ObjDesc; + IDirectMusicBandImpl* pBand = This->pParentObject->pBand; /* that's where we load data to */ + LPDIRECTMUSICLOADER pLoader; + LPDIRECTMUSICGETLOADER pGetLoader; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_RIFF: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunkID)); + StreamSize = chunkSize - sizeof(FOURCC); + StreamCount = 0; + switch (chunkID) { + case DMUS_FOURCC_BAND_FORM: { + TRACE_(dmfile)(": band form\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + StreamCount += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_GUID_CHUNK: { + TRACE_(dmfile)(": GUID chunk\n"); + IStream_Read (pStm, &pBand->vVersion, chunkSize, NULL); + break; + } + case DMUS_FOURCC_VERSION_CHUNK: { + TRACE_(dmfile)(": version chunk\n"); + IStream_Read (pStm, &pBand->guidID, chunkSize, NULL); + break; + } + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[0] = chunkSize - sizeof(FOURCC); + ListCount[0] = 0; + switch (chunkID) { + case DMUS_FOURCC_UNFO_LIST: { + TRACE_(dmfile)(": UNFO list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_UNAM_CHUNK: { + TRACE_(dmfile)(": name chunk\n"); + pBand->wszName = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pBand->wszName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UART_CHUNK: { + TRACE_(dmfile)(": artist chunk\n"); + pBand->wszArtist = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pBand->wszArtist, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCOP_CHUNK: { + TRACE_(dmfile)(": copyright chunk\n"); + pBand->wszCopyright = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pBand->wszCopyright, chunkSize, NULL); + break; + } + case DMUS_FOURCC_USBJ_CHUNK: { + TRACE_(dmfile)(": subject chunk\n"); + pBand->wszSubject = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pBand->wszSubject, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCMT_CHUNK: { + TRACE_(dmfile)(": comment chunk\n"); + pBand->wszComment = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pBand->wszComment, chunkSize, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + case DMUS_FOURCC_INSTRUMENTS_LIST: { + TRACE_(dmfile)(": instruments list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[1] = chunkSize - sizeof(FOURCC); + ListCount[1] = 0; + switch (chunkID) { + case DMUS_FOURCC_INSTRUMENT_LIST: { + TRACE_(dmfile)(": instrument list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_INSTRUMENT_CHUNK: { + TRACE_(dmfile)(": band instrument header\n"); + IStream_Read (pStm, &pBand->pInstruments[pBand->dwInstruments], chunkSize, NULL); + break; + } + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[2] = chunkSize - sizeof(FOURCC); + ListCount[2] = 0; + switch (chunkID) { + case DMUS_FOURCC_REF_LIST: { + TRACE_(dmfile)(": reference list\n"); + ZeroMemory ((LPVOID)&ObjDesc, sizeof(DMUS_OBJECTDESC)); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[2] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_REF_CHUNK: { + TRACE_(dmfile)(": reference header chunk\n"); + IStream_Read (pStm, &tempReferenceHeader, chunkSize, NULL); + /* copy retrieved data to DMUS_OBJECTDESC */ + ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC); + ObjDesc.guidClass = tempReferenceHeader.guidClassID; + ObjDesc.dwValidData = tempReferenceHeader.dwValidData; + break; + } + case DMUS_FOURCC_GUID_CHUNK: { + TRACE_(dmfile)(": guid chunk\n"); + IStream_Read (pStm, &ObjDesc.guidObject, chunkSize, NULL); + break; + } + case DMUS_FOURCC_DATE_CHUNK: { + TRACE_(dmfile)(": file date chunk\n"); + IStream_Read (pStm, &ObjDesc.ftDate, chunkSize, NULL); + break; + } + case DMUS_FOURCC_NAME_CHUNK: { + TRACE_(dmfile)(": name chunk\n"); + IStream_Read (pStm, &ObjDesc.wszName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_FILE_CHUNK: { + TRACE_(dmfile)(": file name chunk\n"); + IStream_Read (pStm, &ObjDesc.wszFileName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_CATEGORY_CHUNK: { + TRACE_(dmfile)(": category chunk\n"); + IStream_Read (pStm, &ObjDesc.wszCategory, chunkSize, NULL); + break; + } + case DMUS_FOURCC_VERSION_CHUNK: { + TRACE_(dmfile)(": version chunk\n"); + IStream_Read (pStm, &ObjDesc.vVersion, chunkSize, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[2] = %ld < ListSize[2] = %ld\n", ListCount[2], ListSize[2]); + } while (ListCount[2] < ListSize[2]); + /* let's see what we have */ + TRACE_(dmfile)(": (READ): reference: dwSize = %ld; dwValidData = %ld; guidObject = %s; guidClass = %s; \ +vVersion = %08lx,%08lx; wszName = %s; wszCategory = %s; wszFileName = %s\n", ObjDesc.dwSize, ObjDesc.dwValidData, debugstr_guid(&ObjDesc.guidObject), debugstr_guid(&ObjDesc.guidClass), +ObjDesc.vVersion.dwVersionMS, ObjDesc.vVersion.dwVersionLS, debugstr_w(ObjDesc.wszName), debugstr_w(ObjDesc.wszCategory), debugstr_w(ObjDesc.wszFileName)); + /* now, let's convience loader to load reference */ + if (IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader) == S_OK) { + if (IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader) == S_OK) { + /* load referenced object */ + IDirectMusicObject* pObject; + if(FAILED(IDirectMusicLoader_GetObject (pLoader, &ObjDesc, &IID_IDirectMusicObject, (LPVOID*)&pObject))) + /* acquire collection from loaded referenced object */ + if(FAILED(IDirectMusicObject_QueryInterface (pObject, &IID_IDirectMusicCollection, (LPVOID*)&pBand->ppReferenceCollection[pBand->dwInstruments]))) + IDirectMusicLoader_Release (pLoader); + } + IDirectMusicGetLoader_Release (pGetLoader); + } else { + ERR("Could not get IDirectMusicGetLoader... reference will not be loaded :(\n"); + /* E_FAIL */ + } + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + return E_FAIL; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[1] = %ld < ListSize[1] = %ld\n", ListCount[1], ListSize[1]); + } while (ListCount[1] < ListSize[1]); +/* causes crash :( */ +#if 0 + /* hmm... in dxdiag segment's band there aren't any references, but loader still desperatly + loads default collection... does that mean that if there is no reference, use default? + */ + if (!pBand->ppReferenceCollection[pBand->dwInstruments]) { + TRACE(": (READ): loading default collection (as no specific reference was made)\n"); + ZeroMemory ((LPVOID)&ObjDesc, sizeof(DMUS_OBJECTDESC)); + ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC); + ObjDesc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_OBJECT; + ObjDesc.guidObject = GUID_DefaultGMCollection; + ObjDesc.guidClass = CLSID_DirectMusicCollection; + if (SUCCEEDED(IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader))) { + if (SUCCEEDED(IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader))) { + IDirectMusicObject* pObject; + if (SUCCEEDED(IDirectMusicLoader_GetObject (pLoader, &ObjDesc, &IID_IDirectMusicObject, (LPVOID*)&pObject))) { + IDirectMusicObject_QueryInterface (pObject, &IID_IDirectMusicCollection, (LPVOID*)&pBand->ppReferenceCollection[pBand->dwInstruments]); + IDirectMusicLoader_Release (pLoader); + } + } + IDirectMusicGetLoader_Release (pGetLoader); + } else { + ERR("Could not get IDirectMusicGetLoader... reference will not be loaded :(\n"); + /* E_FAIL */ + } + } +#endif + pBand->dwInstruments++; /* add count */ + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + return E_FAIL; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + default: { + TRACE_(dmfile)(": unknown (skipping)\n"); + liMove.QuadPart = chunkSize - sizeof(FOURCC); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); + } while (StreamCount < StreamSize); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = StreamSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + TRACE_(dmfile)(": reading finished\n"); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicBandObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicBandObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicBandObjectStream_QueryInterface, + IDirectMusicBandObjectStream_AddRef, + IDirectMusicBandObjectStream_Release, + IDirectMusicBandObjectStream_GetClassID, + IDirectMusicBandObjectStream_IsDirty, + IDirectMusicBandObjectStream_Load, + IDirectMusicBandObjectStream_Save, + IDirectMusicBandObjectStream_GetSizeMax +}; diff --git a/dlls/dmband/bandtrack.c b/dlls/dmband/bandtrack.c new file mode 100644 index 00000000000..d2fd3187a78 --- /dev/null +++ b/dlls/dmband/bandtrack.c @@ -0,0 +1,589 @@ +/* IDirectMusicBandTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmband_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmband); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicBandTrack implementation + */ +/* IDirectMusicBandTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicBandTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicBandTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicBandTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicBandTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicBandTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicBandTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicBandTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_BandParam) + || IsEqualGUID (rguidType, &GUID_Clear_All_Bands) + || IsEqualGUID (rguidType, &GUID_ConnectToDLSCollection) + || IsEqualGUID (rguidType, &GUID_Disable_Auto_Download) + || IsEqualGUID (rguidType, &GUID_Download) + || IsEqualGUID (rguidType, &GUID_DownloadToAudioPath) + || IsEqualGUID (rguidType, &GUID_Enable_Auto_Download) + || IsEqualGUID (rguidType, &GUID_IDirectMusicBand) + || IsEqualGUID (rguidType, &GUID_StandardMIDIFile) + || IsEqualGUID (rguidType, &GUID_Unload) + || IsEqualGUID (rguidType, &GUID_UnloadFromAudioPath)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicBandTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicBandTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicBandTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicBandTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicBandTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicBandTrack_QueryInterface, + IDirectMusicBandTrack_AddRef, + IDirectMusicBandTrack_Release, + IDirectMusicBandTrack_Init, + IDirectMusicBandTrack_InitPlay, + IDirectMusicBandTrack_EndPlay, + IDirectMusicBandTrack_Play, + IDirectMusicBandTrack_GetParam, + IDirectMusicBandTrack_SetParam, + IDirectMusicBandTrack_IsParamSupported, + IDirectMusicBandTrack_AddNotificationType, + IDirectMusicBandTrack_RemoveNotificationType, + IDirectMusicBandTrack_Clone, + IDirectMusicBandTrack_PlayEx, + IDirectMusicBandTrack_GetParamEx, + IDirectMusicBandTrack_SetParamEx, + IDirectMusicBandTrack_Compose, + IDirectMusicBandTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicBandTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicBandTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicBandTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandTrackStream)); + track->pStream->lpVtbl = &DirectMusicBandTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicBandTrackStream implementation + */ +/* IDirectMusicBandTrackStream IUnknown part: */ +HRESULT WINAPI IDirectMusicBandTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicBandTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicBandTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicBandTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicBandTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicBandTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicBandTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicBandTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicBandTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicBandTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicBandTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicBandTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicBandTrackStream,iface); + FOURCC chunkID; + DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3]; + LARGE_INTEGER liMove; /* used when skipping chunks */ + DMUS_OBJECTDESC ObjDesc; + IDirectMusicBandTrack* pTrack = This->pParentTrack; /* that's where we load data to */ + DMUS_IO_BAND_ITEM_HEADER tempHeaderV1; + DMUS_IO_BAND_ITEM_HEADER2 tempHeaderV2; + LPDIRECTMUSICLOADER pLoader; + LPDIRECTMUSICGETLOADER pGetLoader; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_RIFF: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunkID)); + StreamSize = chunkSize - sizeof(FOURCC); + StreamCount = 0; + switch (chunkID) { + case DMUS_FOURCC_BANDTRACK_FORM: { + TRACE_(dmfile)(": band track form\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + StreamCount += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_BANDTRACK_CHUNK: { + TRACE_(dmfile)(": band track header chunk\n"); + IStream_Read (pStm, &pTrack->btkHeader, chunkSize, NULL); + break; + } + case DMUS_FOURCC_GUID_CHUNK: { + TRACE_(dmfile)(": GUID chunk\n"); + IStream_Read (pStm, &pTrack->vVersion, chunkSize, NULL); + break; + } + case DMUS_FOURCC_VERSION_CHUNK: { + TRACE_(dmfile)(": version chunk\n"); + IStream_Read (pStm, &pTrack->guidID, chunkSize, NULL); + break; + } + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[0] = chunkSize - sizeof(FOURCC); + ListCount[0] = 0; + switch (chunkID) { + case DMUS_FOURCC_UNFO_LIST: { + TRACE_(dmfile)(": UNFO list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_UNAM_CHUNK: { + TRACE_(dmfile)(": name chunk\n"); + pTrack->wszName = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->wszName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UART_CHUNK: { + TRACE_(dmfile)(": artist chunk\n"); + pTrack->wszArtist = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->wszArtist, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCOP_CHUNK: { + TRACE_(dmfile)(": copyright chunk\n"); + pTrack->wszCopyright = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->wszCopyright, chunkSize, NULL); + break; + } + case DMUS_FOURCC_USBJ_CHUNK: { + TRACE_(dmfile)(": subject chunk\n"); + pTrack->wszSubject = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->wszSubject, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCMT_CHUNK: { + TRACE_(dmfile)(": comment chunk\n"); + pTrack->wszComment = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->wszComment, chunkSize, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + case DMUS_FOURCC_BANDS_LIST: { + TRACE_(dmfile)(": bands list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[1] = chunkSize - sizeof(FOURCC); + ListCount[1] = 0; + switch (chunkID) { + case DMUS_FOURCC_BAND_LIST: { + TRACE_(dmfile)(": band list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_BANDITEM_CHUNK: { + TRACE_(dmfile)(": band item header (v.1) chunk\n"); + IStream_Read (pStm, &tempHeaderV1, chunkSize, NULL); + /* now transfer data to universal header */ + pTrack->pBandHeaders[pTrack->dwBands].dwVersion = 1; + pTrack->pBandHeaders[pTrack->dwBands].lBandTime = tempHeaderV1.lBandTime; + TRACE_(dmfile)(": (READ): header: lBandTime = %li\n", tempHeaderV1.lBandTime); + break; + } + case DMUS_FOURCC_BANDITEM_CHUNK2: { + TRACE_(dmfile)(": band item header (v.2) chunk\n"); + IStream_Read (pStm, &tempHeaderV2, chunkSize, NULL); + /* now transfer data to universal header */ + pTrack->pBandHeaders[pTrack->dwBands].dwVersion = 2; + pTrack->pBandHeaders[pTrack->dwBands].lBandTimeLogical = tempHeaderV2.lBandTimeLogical; + pTrack->pBandHeaders[pTrack->dwBands].lBandTimePhysical = tempHeaderV2.lBandTimePhysical; + break; + } + case FOURCC_RIFF: { + TRACE_(dmfile)(": RIFF chunk (probably band form)\n"); + liMove.QuadPart = 0; + liMove.QuadPart -= (sizeof(FOURCC) + sizeof(DWORD)); /* goto the beginning of chunk */ + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + /* perform sacrificial ritual so that loader will load band */ + ZeroMemory ((LPVOID)&ObjDesc, sizeof(DMUS_OBJECTDESC)); + ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC); + ObjDesc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_STREAM; + ObjDesc.guidClass = CLSID_DirectMusicBand; + ObjDesc.pStream = pStm; + /* now pray... */ + if (SUCCEEDED(IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader))) { + if (SUCCEEDED(IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader))) { + IDirectMusicObject* pObject; + if (SUCCEEDED(IDirectMusicLoader_GetObject (pLoader, &ObjDesc, &IID_IDirectMusicObject, (LPVOID*)&pObject))) { + /* acquire band from loaded object */ + IDirectMusicObject_QueryInterface (pObject, &IID_IDirectMusicBand, (LPVOID*)&pTrack->ppBands[pTrack->dwBands]); + /*IDirectMusicLoader_Release (pLoader);*/ + } else FIXME(": couldn't get band\n"); + } + IDirectMusicGetLoader_Release (pGetLoader); + } else { + ERR("Could not get IDirectMusicGetLoader... reference will not be loaded :(\n"); + /* E_FAIL */ + } + /* MSDN states that loader returns stream pointer to it's before-reading position, + which means that we must skip whole (loaded) chunk */ + liMove.QuadPart = sizeof(FOURCC) + sizeof(DWORD) + chunkID; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[1] = %ld < ListSize[1] = %ld\n", ListCount[1], ListSize[1]); + } while (ListCount[1] < ListSize[1]); + break; + } + default: { + TRACE_(dmfile)(": unknown (skipping)\n"); + liMove.QuadPart = chunkSize - sizeof(FOURCC); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + pTrack->dwBands++; /* add reference count */ + break; + } + default: { + TRACE_(dmfile)(": unknown (skipping)\n"); + liMove.QuadPart = chunkSize - sizeof(FOURCC); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); + } while (StreamCount < StreamSize); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = StreamSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + TRACE_(dmfile)(": reading finished\n"); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicBandTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicBandTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicBandTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicBandTrackStream_QueryInterface, + IDirectMusicBandTrackStream_AddRef, + IDirectMusicBandTrackStream_Release, + IDirectMusicBandTrackStream_GetClassID, + IDirectMusicBandTrackStream_IsDirty, + IDirectMusicBandTrackStream_Load, + IDirectMusicBandTrackStream_Save, + IDirectMusicBandTrackStream_GetSizeMax +}; diff --git a/dlls/dmband/dmband_main.c b/dlls/dmband/dmband_main.c index 8b99a7432be..09ba2e42f53 100644 --- a/dlls/dmband/dmband_main.c +++ b/dlls/dmband/dmband_main.c @@ -19,15 +19,8 @@ #include "dmband_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmband); - -/****************************************************************** - * DirectMusicBand ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,11 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMBCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicBand ClassFactory + */ + +static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,49 +40,109 @@ static HRESULT WINAPI DMBCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVO return E_NOINTERFACE; } -static ULONG WINAPI DMBCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMBCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicBand)) { + if (IsEqualIID (riid, &IID_IDirectMusicBand)) { return DMUSIC_CreateDirectMusicBand (riid, (LPDIRECTMUSICBAND*) ppobj, pOuter); - + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicBandObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMBCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMBCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) BandCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMBCF_QueryInterface, - DMBCF_AddRef, - DMBCF_Release, - DMBCF_CreateInstance, - DMBCF_LockServer + BandCF_QueryInterface, + BandCF_AddRef, + BandCF_Release, + BandCF_CreateInstance, + BandCF_LockServer }; -static IClassFactoryImpl DMBAND_CF = {&DMBCF_Vtbl, 1 }; +static IClassFactoryImpl Band_CF = {&BandCF_Vtbl, 1 }; + + +/****************************************************************** + * DirectMusicBandTrack ClassFactory + */ + +static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicBandTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) BandTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + BandTrackCF_QueryInterface, + BandTrackCF_AddRef, + BandTrackCF_Release, + BandTrackCF_CreateInstance, + BandTrackCF_LockServer +}; + +static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -129,11 +186,17 @@ HRESULT WINAPI DMBAND_DllCanUnloadNow(void) HRESULT WINAPI DMBAND_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMBAND_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBand) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Band_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBandTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &BandTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmband/dmband_private.h b/dlls/dmband/dmband_private.h index 76541fa3122..f37fd009271 100644 --- a/dlls/dmband/dmband_private.h +++ b/dlls/dmband/dmband_private.h @@ -36,11 +36,23 @@ */ typedef struct IDirectMusicBandImpl IDirectMusicBandImpl; +typedef struct IDirectMusicBandObject IDirectMusicBandObject; +typedef struct IDirectMusicBandObjectStream IDirectMusicBandObjectStream; + +typedef struct IDirectMusicBandTrack IDirectMusicBandTrack; +typedef struct IDirectMusicBandTrackStream IDirectMusicBandTrackStream; + /***************************************************************************** * Predeclare the interface implementation structures */ extern ICOM_VTABLE(IDirectMusicBand) DirectMusicBand_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicBandObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicBandObjectStream_Vtbl; + +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicBandTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicBandTrackStream_Vtbl; + /***************************************************************************** * ClassFactory * can support IID_IDirectMusicBand @@ -48,6 +60,10 @@ extern ICOM_VTABLE(IDirectMusicBand) DirectMusicBand_Vtbl; */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicBand (LPCGUID lpcGUID, LPDIRECTMUSICBAND* ppDMBand, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicBandObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicBandTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); + /***************************************************************************** * IDirectMusicBandImpl implementation structure */ @@ -58,6 +74,19 @@ struct IDirectMusicBandImpl DWORD ref; /* IDirectMusicBandImpl fields */ + IDirectMusicBandObject* pObject; + GUID guidID; /* unique id */ + DMUS_IO_VERSION vVersion; /* version */ + /* info from UNFO list */ + WCHAR* wszName; + WCHAR* wszArtist; + WCHAR* wszCopyright; + WCHAR* wszSubject; + WCHAR* wszComment; + /* data */ + DMUS_IO_INSTRUMENT pInstruments[255]; + IDirectMusicCollection* ppReferenceCollection[255]; + DWORD dwInstruments; }; /* IUnknown: */ @@ -69,4 +98,145 @@ extern HRESULT WINAPI IDirectMusicBandImpl_CreateSegment (LPDIRECTMUSICBAND ifac extern HRESULT WINAPI IDirectMusicBandImpl_Download (LPDIRECTMUSICBAND iface, IDirectMusicPerformance* pPerformance); extern HRESULT WINAPI IDirectMusicBandImpl_Unload (LPDIRECTMUSICBAND iface, IDirectMusicPerformance* pPerformance); + +/***************************************************************************** + * IDirectMusicBandObject implementation structure + */ +struct IDirectMusicBandObject +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicBandObjectStream* pStream; + IDirectMusicBandImpl* pBand; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicBandObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicBandObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicBandObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicBandObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicBandObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicBandObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicBandObjectStream implementation structure + */ +struct IDirectMusicBandObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicBandObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicBandObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicBandObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicBandObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicBandObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicBandObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicBandObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicBandObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicBandObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/* i don't like M$'s idea about two different band item headers, so behold: universal one */ +typedef struct _DMUS_PRIVATE_BAND_ITEM_HEADER { + DWORD dwVersion; /* 1 or 2 */ + /* v.1 */ + MUSIC_TIME lBandTime; + /* v.2 */ + MUSIC_TIME lBandTimeLogical; + MUSIC_TIME lBandTimePhysical; +} DMUS_PRIVATE_BAND_ITEM_HEADER; + +/***************************************************************************** + * IDirectMusicBandTrack implementation structure + */ +struct IDirectMusicBandTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicBandTrack fields */ + IDirectMusicBandTrackStream* pStream; + DMUS_IO_BAND_TRACK_HEADER btkHeader; /* header */ + GUID guidID; /* unique id */ + DMUS_IO_VERSION vVersion; /* version */ + /* info from UNFO list */ + WCHAR* wszName; + WCHAR* wszArtist; + WCHAR* wszCopyright; + WCHAR* wszSubject; + WCHAR* wszComment; + /* data */ + DMUS_PRIVATE_BAND_ITEM_HEADER pBandHeaders[255]; /* band item headers for bands */ + IDirectMusicBandImpl* ppBands[255]; /* bands */ + DWORD dwBands; /* nr. of IDirectMusicBandImpl* and DMUS_PRIVATE_BAND_ITEM_HEADER */ +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicBandTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicBandTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicBandTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicBandTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicBandTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicBandTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicBandTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicBandTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicBandTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicBandTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicBandTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicBandTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicBandTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicBandTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicBandTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicBandTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicBandTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicBandTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicBandTrackStream implementation structure + */ +struct IDirectMusicBandTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicBandTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicBandTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicBandTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicBandTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicBandTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicBandTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicBandTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicBandTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicBandTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +static inline const char *debugstr_fourcc( DWORD fourcc ) +{ + if (!fourcc) return "'null'"; + return wine_dbg_sprintf( "\'%c%c%c%c\'", + (char)(fourcc), (char)(fourcc >> 8), + (char)(fourcc >> 16), (char)(fourcc >> 24) ); +} + #endif /* __WINE_DMBAND_PRIVATE_H */ diff --git a/dlls/dmband/regsvr.c b/dlls/dmband/regsvr.c index 8db7b693b15..274cfa19ecd 100644 --- a/dlls/dmband/regsvr.c +++ b/dlls/dmband/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmband); /* * Near the bottom of this file are the exported DllRegisterServer and diff --git a/dlls/dmcompos/Makefile.in b/dlls/dmcompos/Makefile.in index 46407a696dc..7de812147e0 100644 --- a/dlls/dmcompos/Makefile.in +++ b/dlls/dmcompos/Makefile.in @@ -11,9 +11,11 @@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ chordmap.c \ + chordmaptrack.c \ composer.c \ dmcompos_main.c \ - regsvr.c + regsvr.c \ + signposttrack.c RC_SRCS = version.rc diff --git a/dlls/dmcompos/chordmap.c b/dlls/dmcompos/chordmap.c index d56b25aa379..47e7970f8c7 100644 --- a/dlls/dmcompos/chordmap.c +++ b/dlls/dmcompos/chordmap.c @@ -25,20 +25,20 @@ #include "dmcompos_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); /* IDirectMusicChordMap IUnknown parts follow: */ HRESULT WINAPI IDirectMusicChordMapImpl_QueryInterface (LPDIRECTMUSICCHORDMAP iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicChordMapImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicChordMap)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicChordMap)) { IDirectMusicChordMapImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,8 +55,7 @@ ULONG WINAPI IDirectMusicChordMapImpl_Release (LPDIRECTMUSICCHORDMAP iface) ICOM_THIS(IDirectMusicChordMapImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -87,8 +86,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicChordMap (LPCGUID lpcGUID, LPDIRECTMUSICC { IDirectMusicChordMapImpl* dmchordmap; - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicChordMap)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicChordMap)) { dmchordmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl)); if (NULL == dmchordmap) { *ppDMCM = (LPDIRECTMUSICCHORDMAP) NULL; @@ -103,3 +101,195 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicChordMap (LPCGUID lpcGUID, LPDIRECTMUSICC return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicChordMapObject implementation + */ +/* IDirectMusicChordMapObject IUnknown part: */ +HRESULT WINAPI IDirectMusicChordMapObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicChordMapObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicChordMap)) { + IDirectMusicChordMap_AddRef ((LPDIRECTMUSICCHORDMAP)This->pChordMap); + *ppobj = (LPDIRECTMUSICCHORDMAP)This->pChordMap; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordMapObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordMapObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordMapObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicChordMapObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicChordMapObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicChordMapObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordMapObject_QueryInterface, + IDirectMusicChordMapObject_AddRef, + IDirectMusicChordMapObject_Release, + IDirectMusicChordMapObject_GetDescriptor, + IDirectMusicChordMapObject_SetDescriptor, + IDirectMusicChordMapObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicChordMapObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicChordMapObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapObjectStream)); + obj->pStream->lpVtbl = &DirectMusicChordMapObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusiChordMap */ + DMUSIC_CreateDirectMusicChordMap (&IID_IDirectMusicChordMap, (LPDIRECTMUSICCHORDMAP*)&obj->pChordMap, NULL); + obj->pChordMap->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicChordMapObjectStream implementation + */ +/* IDirectMusicChordMapObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicChordMapObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordMapObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicChordMapObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordMapObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordMapObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordMapObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordMapObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordMapObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicChordMapObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicChordMapObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicChordMapObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordMapObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordMapObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicChordMapObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordMapObjectStream_QueryInterface, + IDirectMusicChordMapObjectStream_AddRef, + IDirectMusicChordMapObjectStream_Release, + IDirectMusicChordMapObjectStream_GetClassID, + IDirectMusicChordMapObjectStream_IsDirty, + IDirectMusicChordMapObjectStream_Load, + IDirectMusicChordMapObjectStream_Save, + IDirectMusicChordMapObjectStream_GetSizeMax +}; diff --git a/dlls/dmcompos/chordmaptrack.c b/dlls/dmcompos/chordmaptrack.c new file mode 100644 index 00000000000..5fc1c66eefb --- /dev/null +++ b/dlls/dmcompos/chordmaptrack.c @@ -0,0 +1,339 @@ +/* IDirectMusicChordMapTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmcompos_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicChordMapTrack implementation + */ +/* IDirectMusicChordMapTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicChordMapTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicChordMapTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicChordMapTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordMapTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordMapTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordMapTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicChordMapTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_IDirectMusicChordMap)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicChordMapTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicChordMapTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicChordMapTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicChordMapTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordMapTrack_QueryInterface, + IDirectMusicChordMapTrack_AddRef, + IDirectMusicChordMapTrack_Release, + IDirectMusicChordMapTrack_Init, + IDirectMusicChordMapTrack_InitPlay, + IDirectMusicChordMapTrack_EndPlay, + IDirectMusicChordMapTrack_Play, + IDirectMusicChordMapTrack_GetParam, + IDirectMusicChordMapTrack_SetParam, + IDirectMusicChordMapTrack_IsParamSupported, + IDirectMusicChordMapTrack_AddNotificationType, + IDirectMusicChordMapTrack_RemoveNotificationType, + IDirectMusicChordMapTrack_Clone, + IDirectMusicChordMapTrack_PlayEx, + IDirectMusicChordMapTrack_GetParamEx, + IDirectMusicChordMapTrack_SetParamEx, + IDirectMusicChordMapTrack_Compose, + IDirectMusicChordMapTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicChordMapTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicChordMapTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapTrackStream)); + track->pStream->lpVtbl = &DirectMusicChordMapTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicChordMapTrackStream implementation + */ +/* IDirectMusicChordMapTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicChordMapTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordMapTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicChordMapTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordMapTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordMapTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordMapTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordMapTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordMapTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicChordMapTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicChordMapTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicChordMapTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordMapTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordMapTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordMapTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicChordMapTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordMapTrackStream_QueryInterface, + IDirectMusicChordMapTrackStream_AddRef, + IDirectMusicChordMapTrackStream_Release, + IDirectMusicChordMapTrackStream_GetClassID, + IDirectMusicChordMapTrackStream_IsDirty, + IDirectMusicChordMapTrackStream_Load, + IDirectMusicChordMapTrackStream_Save, + IDirectMusicChordMapTrackStream_GetSizeMax +}; diff --git a/dlls/dmcompos/composer.c b/dlls/dmcompos/composer.c index 0940d46f057..f60a5573fe7 100644 --- a/dlls/dmcompos/composer.c +++ b/dlls/dmcompos/composer.c @@ -25,16 +25,15 @@ #include "dmcompos_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); /* IDirectMusicComposer IUnknown parts follow: */ HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface (LPDIRECTMUSICCOMPOSER iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicComposerImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicComposer)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicComposer)) { IDirectMusicComposerImpl_AddRef(iface); *ppobj = This; return S_OK; @@ -55,8 +54,7 @@ ULONG WINAPI IDirectMusicComposerImpl_Release (LPDIRECTMUSICCOMPOSER iface) ICOM_THIS(IDirectMusicComposerImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -136,8 +134,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicComposer (LPCGUID lpcGUID, LPDIRECTMUSICC { IDirectMusicComposerImpl* dmcompos; - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicComposer)) { dmcompos = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicComposerImpl)); if (NULL == dmcompos) { *ppDMCP = (LPDIRECTMUSICCOMPOSER) NULL; diff --git a/dlls/dmcompos/dmcompos_main.c b/dlls/dmcompos/dmcompos_main.c index 6a91224cd3f..75bf4ca7283 100644 --- a/dlls/dmcompos/dmcompos_main.c +++ b/dlls/dmcompos/dmcompos_main.c @@ -19,15 +19,8 @@ #include "dmcompos_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); - -/****************************************************************** - * DirectMusicComposer ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMCPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicChordMap ClassFactory + */ +static HRESULT WINAPI ChordMapCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,51 +39,272 @@ static HRESULT WINAPI DMCPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPV return E_NOINTERFACE; } -static ULONG WINAPI DMCPCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI ChordMapCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMCPCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI ChordMapCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMCPCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI ChordMapCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicChordMap)) { + if (IsEqualIID (riid, &IID_IDirectMusicChordMap)) { return DMUSIC_CreateDirectMusicChordMap (riid, (LPDIRECTMUSICCHORDMAP*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicComposer)) { - return DMUSIC_CreateDirectMusicComposer (riid, (LPDIRECTMUSICCOMPOSER*)ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicChordMapObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); } - + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMCPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI ChordMapCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMCPCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) ChordMapCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMCPCF_QueryInterface, - DMCPCF_AddRef, - DMCPCF_Release, - DMCPCF_CreateInstance, - DMCPCF_LockServer + ChordMapCF_QueryInterface, + ChordMapCF_AddRef, + ChordMapCF_Release, + ChordMapCF_CreateInstance, + ChordMapCF_LockServer }; -static IClassFactoryImpl DMCOMPOS_CF = {&DMCPCF_Vtbl, 1 }; +static IClassFactoryImpl ChordMap_CF = {&ChordMapCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicComposer ClassFactory + */ +static HRESULT WINAPI ComposerCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ComposerCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ComposerCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ComposerCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicComposer)) { + return DMUSIC_CreateDirectMusicComposer (riid, (LPDIRECTMUSICCOMPOSER*)ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ComposerCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ComposerCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ComposerCF_QueryInterface, + ComposerCF_AddRef, + ComposerCF_Release, + ComposerCF_CreateInstance, + ComposerCF_LockServer +}; + +static IClassFactoryImpl Composer_CF = {&ComposerCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicChordMapTrack ClassFactory + */ +static HRESULT WINAPI ChordMapTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ChordMapTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ChordMapTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ChordMapTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicChordMapTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ChordMapTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ChordMapTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ChordMapTrackCF_QueryInterface, + ChordMapTrackCF_AddRef, + ChordMapTrackCF_Release, + ChordMapTrackCF_CreateInstance, + ChordMapTrackCF_LockServer +}; + +static IClassFactoryImpl ChordMapTrack_CF = {&ChordMapTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicTemplate ClassFactory + */ +static HRESULT WINAPI TemplateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI TemplateCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI TemplateCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI TemplateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI TemplateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) TemplateCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + TemplateCF_QueryInterface, + TemplateCF_AddRef, + TemplateCF_Release, + TemplateCF_CreateInstance, + TemplateCF_LockServer +}; + +static IClassFactoryImpl Template_CF = {&TemplateCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSignPostTrack ClassFactory + */ +static HRESULT WINAPI SignPostTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SignPostTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SignPostTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SignPostTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicSignPostTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SignPostTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SignPostTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SignPostTrackCF_QueryInterface, + SignPostTrackCF_AddRef, + SignPostTrackCF_Release, + SignPostTrackCF_CreateInstance, + SignPostTrackCF_LockServer +}; + +static IClassFactoryImpl SignPostTrack_CF = {&SignPostTrackCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -131,11 +348,28 @@ HRESULT WINAPI DMCOMPOS_DllCanUnloadNow(void) HRESULT WINAPI DMCOMPOS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMCOMPOS_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordMap) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ChordMap_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicComposer) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Composer_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordMapTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ChordMapTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTemplate) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Template_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSignPostTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SignPostTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmcompos/dmcompos_private.h b/dlls/dmcompos/dmcompos_private.h index 3fc8b63b871..e2c7e73e028 100644 --- a/dlls/dmcompos/dmcompos_private.h +++ b/dlls/dmcompos/dmcompos_private.h @@ -37,12 +37,28 @@ typedef struct IDirectMusicChordMapImpl IDirectMusicChordMapImpl; typedef struct IDirectMusicComposerImpl IDirectMusicComposerImpl; +typedef struct IDirectMusicChordMapObject IDirectMusicChordMapObject; +typedef struct IDirectMusicChordMapObjectStream IDirectMusicChordMapObjectStream; + +typedef struct IDirectMusicChordMapTrack IDirectMusicChordMapTrack; +typedef struct IDirectMusicChordMapTrackStream IDirectMusicChordMapTrackStream; +typedef struct IDirectMusicSignPostTrack IDirectMusicSignPostTrack; +typedef struct IDirectMusicSignPostTrackStream IDirectMusicSignPostTrackStream; + /***************************************************************************** * Predeclare the interface implementation structures */ extern ICOM_VTABLE(IDirectMusicChordMap) DirectMusicChordMap_Vtbl; extern ICOM_VTABLE(IDirectMusicComposer) DirectMusicComposer_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicChordMapObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicChordMapObjectStream_Vtbl; + +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicChordMapTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicChordMapTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSignPostTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSignPostTrackStream_Vtbl; + /***************************************************************************** * ClassFactory */ @@ -56,6 +72,10 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicChordMap (LPCGUID lpcGUID, LPDIREC */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicComposer (LPCGUID lpcGUID, LPDIRECTMUSICCOMPOSER* ppDMCP, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSignPostTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); /***************************************************************************** * IDirectMusicChordMapImpl implementation structure @@ -67,6 +87,7 @@ struct IDirectMusicChordMapImpl DWORD ref; /* IDirectMusicChordMapImpl fields */ + IDirectMusicChordMapObject* pObject; DWORD dwScale; }; @@ -77,7 +98,6 @@ extern ULONG WINAPI IDirectMusicChordMapImpl_Release (LPDIRECTMUSICCHORDMAP if /* IDirectMusicChordMap: */ extern HRESULT WINAPI IDirectMusicChordMapImpl_GetScale (LPDIRECTMUSICCHORDMAP iface, DWORD* pdwScale); - /***************************************************************************** * IDirectMusicComposerImpl implementation structure */ @@ -102,4 +122,176 @@ extern HRESULT WINAPI IDirectMusicComposerImpl_AutoTransition (LPDIRECTMUSICCOMP extern HRESULT WINAPI IDirectMusicComposerImpl_ComposeTemplateFromShape (LPDIRECTMUSICCOMPOSER iface, WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength, IDirectMusicSegment** ppTemplate); extern HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pSegment, BOOL fTrackScale, IDirectMusicChordMap* pChordMap); + +/***************************************************************************** + * IDirectMusicChordMapObject implementation structure + */ +struct IDirectMusicChordMapObject +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicChordMapObjectStream* pStream; + IDirectMusicChordMapImpl* pChordMap; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordMapObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicChordMapObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicChordMapObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicChordMapObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicChordMapObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicChordMapObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicChordMapObjectStream implementation structure + */ +struct IDirectMusicChordMapObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicChordMapObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicChordMapObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicChordMapObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicChordMapObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicChordMapTrack implementation structure + */ +struct IDirectMusicChordMapTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicChordMapTrack fields */ + IDirectMusicChordMapTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordMapTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicChordMapTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicChordMapTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicChordMapTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicChordMapTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordMapTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicChordMapTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicChordMapTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicChordMapTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicChordMapTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicChordMapTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicChordMapTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicChordMapTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicChordMapTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicChordMapTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordMapTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordMapTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicChordMapTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicChordMapTrackStream implementation structure + */ +struct IDirectMusicChordMapTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicChordMapTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicChordMapTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicChordMapTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicChordMapTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicSignPostTrack implementation structure + */ +struct IDirectMusicSignPostTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicSignPostTrack fields */ + IDirectMusicSignPostTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSignPostTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSignPostTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicSignPostTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicSignPostTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicSignPostTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSignPostTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicSignPostTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSignPostTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicSignPostTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicSignPostTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicSignPostTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSignPostTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSignPostTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicSignPostTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSignPostTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSignPostTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSignPostTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicSignPostTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicSignPostTrackStream implementation structure + */ +struct IDirectMusicSignPostTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSignPostTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSignPostTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSignPostTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSignPostTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + #endif /* __WINE_DMCOMPOS_PRIVATE_H */ diff --git a/dlls/dmcompos/regsvr.c b/dlls/dmcompos/regsvr.c index 8640959f23f..8611c9e7a0c 100644 --- a/dlls/dmcompos/regsvr.c +++ b/dlls/dmcompos/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); /* * Near the bottom of this file are the exported DllRegisterServer and diff --git a/dlls/dmcompos/signposttrack.c b/dlls/dmcompos/signposttrack.c new file mode 100644 index 00000000000..ae015d4d9c8 --- /dev/null +++ b/dlls/dmcompos/signposttrack.c @@ -0,0 +1,338 @@ +/* IDirectMusicSignPostTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmcompos_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicSignPostTrack implementation + */ +/* IDirectMusicSignPostTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicSignPostTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicSignPostTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSignPostTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSignPostTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSignPostTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSignPostTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicSignPostTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicSignPostTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicSignPostTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSignPostTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSignPostTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSignPostTrack_QueryInterface, + IDirectMusicSignPostTrack_AddRef, + IDirectMusicSignPostTrack_Release, + IDirectMusicSignPostTrack_Init, + IDirectMusicSignPostTrack_InitPlay, + IDirectMusicSignPostTrack_EndPlay, + IDirectMusicSignPostTrack_Play, + IDirectMusicSignPostTrack_GetParam, + IDirectMusicSignPostTrack_SetParam, + IDirectMusicSignPostTrack_IsParamSupported, + IDirectMusicSignPostTrack_AddNotificationType, + IDirectMusicSignPostTrack_RemoveNotificationType, + IDirectMusicSignPostTrack_Clone, + IDirectMusicSignPostTrack_PlayEx, + IDirectMusicSignPostTrack_GetParamEx, + IDirectMusicSignPostTrack_SetParamEx, + IDirectMusicSignPostTrack_Compose, + IDirectMusicSignPostTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSignPostTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSignPostTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSignPostTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicSignPostTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSignPostTrackStream)); + track->pStream->lpVtbl = &DirectMusicSignPostTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicSignPostTrackStream implementation + */ +/* IDirectMusicSignPostTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicSignPostTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSignPostTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSignPostTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSignPostTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSignPostTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSignPostTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSignPostTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSignPostTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicSignPostTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSignPostTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSignPostTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSignPostTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicSignPostTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSignPostTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSignPostTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSignPostTrackStream_QueryInterface, + IDirectMusicSignPostTrackStream_AddRef, + IDirectMusicSignPostTrackStream_Release, + IDirectMusicSignPostTrackStream_GetClassID, + IDirectMusicSignPostTrackStream_IsDirty, + IDirectMusicSignPostTrackStream_Load, + IDirectMusicSignPostTrackStream_Save, + IDirectMusicSignPostTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/Makefile.in b/dlls/dmime/Makefile.in index 816e829cbd1..34e4f61537b 100644 --- a/dlls/dmime/Makefile.in +++ b/dlls/dmime/Makefile.in @@ -13,14 +13,22 @@ C_SRCS = \ audiopath.c \ dmime_main.c \ graph.c \ + lyricstrack.c \ + markertrack.c \ + paramcontroltrack.c \ patterntrack.c \ performance.c \ regsvr.c \ segment.c \ segmentstate.c \ + segtriggertrack.c \ + seqtrack.c \ song.c \ + sysextrack.c \ + tempotrack.c \ + timesigtrack.c \ tool.c \ - track.c + wavetrack.c RC_SRCS = version.rc diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c index f5c44495281..c7356b37b5e 100644 --- a/dlls/dmime/audiopath.c +++ b/dlls/dmime/audiopath.c @@ -25,20 +25,20 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicAudioPath IUnknown parts follow: */ +/* IDirectMusicAudioPath IUnknown part: */ HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface (LPDIRECTMUSICAUDIOPATH iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicAudioPathImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicAudioPath)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicAudioPath)) { IDirectMusicAudioPathImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,14 +55,13 @@ ULONG WINAPI IDirectMusicAudioPathImpl_Release (LPDIRECTMUSICAUDIOPATH iface) ICOM_THIS(IDirectMusicAudioPathImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicAudioPath Interface follow: */ +/* IDirectMusicAudioPath IDirectMusicAudioPath part: */ HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject) { ICOM_THIS(IDirectMusicAudioPathImpl,iface); @@ -72,12 +71,12 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH switch (dwStage) { case DMUS_PATH_BUFFER: { - if (IsEqualGUID(iidInterface,&IID_IDirectSoundBuffer8)) { - IDirectSoundBuffer8_QueryInterface(This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject); + if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) { + IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject); TRACE("returning %p\n",*ppObject); return S_OK; - } else if (IsEqualGUID(iidInterface,&IID_IDirectSound3DBuffer)) { - IDirectSoundBuffer8_QueryInterface(This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject); + } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) { + IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject); TRACE("returning %p\n",*ppObject); return S_OK; } else { @@ -87,10 +86,10 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH break; case DMUS_PATH_PRIMARY_BUFFER: { - if (IsEqualGUID(iidInterface,&IID_IDirectSound3DListener)) { - IDirectSoundBuffer8_QueryInterface(This->pPrimary, &IID_IDirectSound3DListener, ppObject); + if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) { + IDirectSoundBuffer8_QueryInterface (This->pPrimary, &IID_IDirectSound3DListener, ppObject); return S_OK; - }else { + } else { FIXME("bad iid...\n"); } } @@ -98,7 +97,7 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH case DMUS_PATH_AUDIOPATH_GRAPH: { - if (IsEqualGUID(iidInterface, &IID_IDirectMusicGraph)) { + if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) { if (NULL == This->pToolGraph) { IDirectMusicGraphImpl* pGraph; pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl)); @@ -198,12 +197,214 @@ ICOM_VTABLE(IDirectMusicAudioPath) DirectMusicAudioPath_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPath (LPCGUID lpcGUID, LPDIRECTMUSICAUDIOPATH* ppDMCAPath, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicAudioPath)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicAudioPathImpl* path; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicAudioPath)) { + path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl)); + if (NULL == path) { + *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) NULL; + return E_OUTOFMEMORY; + } + path->lpVtbl = &DirectMusicAudioPath_Vtbl; + path->ref = 1; + *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) path; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicAudioPathObject implementation + */ +/* IDirectMusicAudioPathObject IUnknown part: */ +HRESULT WINAPI IDirectMusicAudioPathObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicAudioPathObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicAudioPath)) { + IDirectMusicAudioPath_AddRef ((LPDIRECTMUSICAUDIOPATH)This->pAudioPath); + *ppobj = (LPDIRECTMUSICAUDIOPATH)This->pAudioPath; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicAudioPathObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicAudioPathObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicAudioPathObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicAudioPathObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAudioPathObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAudioPathObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicAudioPathObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicAudioPathObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicAudioPathObject_QueryInterface, + IDirectMusicAudioPathObject_AddRef, + IDirectMusicAudioPathObject_Release, + IDirectMusicAudioPathObject_GetDescriptor, + IDirectMusicAudioPathObject_SetDescriptor, + IDirectMusicAudioPathObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicAudioPathObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicAudioPathObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObjectStream)); + obj->pStream->lpVtbl = &DirectMusicAudioPathObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicAudioPath */ + DMUSIC_CreateDirectMusicAudioPath (&IID_IDirectMusicAudioPath, (LPDIRECTMUSICAUDIOPATH*)&obj->pAudioPath, NULL); + obj->pAudioPath->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicAudioPathObjectStream implementation + */ +/* IDirectMusicAudioPathObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicAudioPathObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicAudioPathObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicAudioPathObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicAudioPathObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicAudioPathObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicAudioPathObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicAudioPathObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicAudioPathObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicAudioPathObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicAudioPathObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicAudioPathObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicAudioPathObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicAudioPathObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicAudioPathObjectStream_QueryInterface, + IDirectMusicAudioPathObjectStream_AddRef, + IDirectMusicAudioPathObjectStream_Release, + IDirectMusicAudioPathObjectStream_GetClassID, + IDirectMusicAudioPathObjectStream_IsDirty, + IDirectMusicAudioPathObjectStream_Load, + IDirectMusicAudioPathObjectStream_Save, + IDirectMusicAudioPathObjectStream_GetSizeMax +}; diff --git a/dlls/dmime/dmime_main.c b/dlls/dmime/dmime_main.c index 896c8c10412..edb5f022ee2 100644 --- a/dlls/dmime/dmime_main.c +++ b/dlls/dmime/dmime_main.c @@ -19,15 +19,8 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); - -/****************************************************************** - * DirectMusicInteractiveEngine ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMIMECF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicPerformance ClassFactory + */ +static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,70 +39,842 @@ static HRESULT WINAPI DMIMECF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LP return E_NOINTERFACE; } -static ULONG WINAPI DMIMECF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMIMECF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMIMECF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicPerformance) || - IsEqualGUID (riid, &IID_IDirectMusicPerformance8)) { + if (IsEqualIID (riid, &IID_IDirectMusicPerformance) || + IsEqualIID (riid, &IID_IDirectMusicPerformance8)) { return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicSegment) || - IsEqualGUID (riid, &IID_IDirectMusicSegment8)) { - return DMUSIC_CreateDirectMusicSegment (riid, (LPDIRECTMUSICSEGMENT8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicSegmentState) || - IsEqualGUID (riid, &IID_IDirectMusicSegmentState8)) { - return DMUSIC_CreateDirectMusicSegmentState (riid, (LPDIRECTMUSICSEGMENTSTATE8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicGraph)) { - return DMUSIC_CreateDirectMusicGraph (riid, (LPDIRECTMUSICGRAPH*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicAudioPath)) { - return DMUSIC_CreateDirectMusicSong (riid, (LPDIRECTMUSICSONG*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicAudioPath)) { - return DMUSIC_CreateDirectMusicAudioPath (riid, (LPDIRECTMUSICAUDIOPATH*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicTool) || - IsEqualGUID (riid, &IID_IDirectMusicTool8)) { - return DMUSIC_CreateDirectMusicTool (riid, (LPDIRECTMUSICTOOL8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicTrack) || - IsEqualGUID (riid, &IID_IDirectMusicTrack8)) { - return DMUSIC_CreateDirectMusicTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicPatternTrack)) { - return DMUSIC_CreateDirectMusicPatternTrack (riid, (LPDIRECTMUSICPATTERNTRACK*) ppobj, pOuter); } WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMIMECF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI PerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMIMECF_Vtbl = { +static ICOM_VTABLE(IClassFactory) PerformanceCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMIMECF_QueryInterface, - DMIMECF_AddRef, - DMIMECF_Release, - DMIMECF_CreateInstance, - DMIMECF_LockServer + PerformanceCF_QueryInterface, + PerformanceCF_AddRef, + PerformanceCF_Release, + PerformanceCF_CreateInstance, + PerformanceCF_LockServer }; -static IClassFactoryImpl DMIME_CF = {&DMIMECF_Vtbl, 1 }; +static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSegment ClassFactory + */ +static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicSegment) || + IsEqualIID (riid, &IID_IDirectMusicSegment8)) { + return DMUSIC_CreateDirectMusicSegment (riid, (LPDIRECTMUSICSEGMENT8*) ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicSegmentObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SegmentCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SegmentCF_QueryInterface, + SegmentCF_AddRef, + SegmentCF_Release, + SegmentCF_CreateInstance, + SegmentCF_LockServer +}; + +static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSegmentState ClassFactory + */ +static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicSegmentState) || + IsEqualIID (riid, &IID_IDirectMusicSegmentState8)) { + return DMUSIC_CreateDirectMusicSegmentState (riid, (LPDIRECTMUSICSEGMENTSTATE8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SegmentStateCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SegmentStateCF_QueryInterface, + SegmentStateCF_AddRef, + SegmentStateCF_Release, + SegmentStateCF_CreateInstance, + SegmentStateCF_LockServer +}; + +static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicGraph ClassFactory + */ +static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicGraph)) { + return DMUSIC_CreateDirectMusicGraph (riid, (LPDIRECTMUSICGRAPH*) ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicGraphObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI GraphCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) GraphCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + GraphCF_QueryInterface, + GraphCF_AddRef, + GraphCF_Release, + GraphCF_CreateInstance, + GraphCF_LockServer +}; + +static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicTempoTrack ClassFactory + */ +static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicTempoTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI TempoTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) TempoTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + TempoTrackCF_QueryInterface, + TempoTrackCF_AddRef, + TempoTrackCF_Release, + TempoTrackCF_CreateInstance, + TempoTrackCF_LockServer +}; + +static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSeqTrack ClassFactory + */ +static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicSeqTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SeqTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SeqTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SeqTrackCF_QueryInterface, + SeqTrackCF_AddRef, + SeqTrackCF_Release, + SeqTrackCF_CreateInstance, + SeqTrackCF_LockServer +}; + +static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSysExTrack ClassFactory + */ +static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicSysExTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SysExTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SysExTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SysExTrackCF_QueryInterface, + SysExTrackCF_AddRef, + SysExTrackCF_Release, + SysExTrackCF_CreateInstance, + SysExTrackCF_LockServer +}; + +static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicTimeSigTrack ClassFactory + */ +static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicTimeSigTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI TimeSigTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) TimeSigTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + TimeSigTrackCF_QueryInterface, + TimeSigTrackCF_AddRef, + TimeSigTrackCF_Release, + TimeSigTrackCF_CreateInstance, + TimeSigTrackCF_LockServer +}; + +static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicParamControlTrack ClassFactory + */ +static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicParamControlTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ParamControlTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ParamControlTrackCF_QueryInterface, + ParamControlTrackCF_AddRef, + ParamControlTrackCF_Release, + ParamControlTrackCF_CreateInstance, + ParamControlTrackCF_LockServer +}; + +static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicMarkerTrack ClassFactory + */ +static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicMarkerTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) MarkerTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + MarkerTrackCF_QueryInterface, + MarkerTrackCF_AddRef, + MarkerTrackCF_Release, + MarkerTrackCF_CreateInstance, + MarkerTrackCF_LockServer +}; + +static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicLyricsTrack ClassFactory + */ +static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicLyricsTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) LyricsTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + LyricsTrackCF_QueryInterface, + LyricsTrackCF_AddRef, + LyricsTrackCF_Release, + LyricsTrackCF_CreateInstance, + LyricsTrackCF_LockServer +}; + +static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSong ClassFactory + */ +static HRESULT WINAPI SongCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SongCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SongCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SongCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicSong)) { + return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE8*) ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicSongObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SongCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SongCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SongCF_QueryInterface, + SongCF_AddRef, + SongCF_Release, + SongCF_CreateInstance, + SongCF_LockServer +}; + +static IClassFactoryImpl Song_CF = {&SongCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicSegTriggerTrack ClassFactory + */ +static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SegTriggerTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SegTriggerTrackCF_QueryInterface, + SegTriggerTrackCF_AddRef, + SegTriggerTrackCF_Release, + SegTriggerTrackCF_CreateInstance, + SegTriggerTrackCF_LockServer +}; + +static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl, 1 }; + + + + +/****************************************************************** + * DirectMusicAudioPath ClassFactory + */ +static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicAudioPath)) { + return DMUSIC_CreateDirectMusicAudioPath (riid, (LPDIRECTMUSICAUDIOPATH*) ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicAudioPathObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) AudioPathCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + AudioPathCF_QueryInterface, + AudioPathCF_AddRef, + AudioPathCF_Release, + AudioPathCF_CreateInstance, + AudioPathCF_LockServer +}; + +static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicWaveTrack ClassFactory + */ +static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicWaveTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) WaveTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + WaveTrackCF_QueryInterface, + WaveTrackCF_AddRef, + WaveTrackCF_Release, + WaveTrackCF_CreateInstance, + WaveTrackCF_LockServer +}; + +static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -117,7 +885,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { - DisableThreadLibraryCalls(hinstDLL); + DisableThreadLibraryCalls(hinstDLL); /* FIXME: Initialisation */ } else if (fdwReason == DLL_PROCESS_DETACH) @@ -150,11 +918,68 @@ HRESULT WINAPI DMIME_DllCanUnloadNow(void) HRESULT WINAPI DMIME_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMIME_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicPerformance) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Performance_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegment) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Segment_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SegmentState_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicGraph) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Graph_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTempoTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &TempoTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSeqTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SeqTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSysExTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SysExTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTimeSigTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &TimeSigTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicParamControlTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ParamControlTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMarkerTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &MarkerTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLyricsTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &LyricsTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSong) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Song_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegTriggerTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SegTriggerTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &AudioPath_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicWaveTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &WaveTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h index 4187fe5da3d..c8527384a51 100644 --- a/dlls/dmime/dmime_private.h +++ b/dlls/dmime/dmime_private.h @@ -43,9 +43,36 @@ typedef struct IDirectMusicGraphImpl IDirectMusicGraphImpl; typedef struct IDirectMusicSongImpl IDirectMusicSongImpl; typedef struct IDirectMusicAudioPathImpl IDirectMusicAudioPathImpl; typedef struct IDirectMusicTool8Impl IDirectMusicTool8Impl; -typedef struct IDirectMusicTrack8Impl IDirectMusicTrack8Impl; typedef struct IDirectMusicPatternTrackImpl IDirectMusicPatternTrackImpl; +typedef struct IDirectMusicSegmentObject IDirectMusicSegmentObject; +typedef struct IDirectMusicSegmentObjectStream IDirectMusicSegmentObjectStream; +typedef struct IDirectMusicSongObject IDirectMusicSongObject; +typedef struct IDirectMusicSongObjectStream IDirectMusicSongObjectStream; +typedef struct IDirectMusicAudioPathObject IDirectMusicAudioPathObject; +typedef struct IDirectMusicAudioPathObjectStream IDirectMusicAudioPathObjectStream; +typedef struct IDirectMusicGraphObject IDirectMusicGraphObject; +typedef struct IDirectMusicGraphObjectStream IDirectMusicGraphObjectStream; + +typedef struct IDirectMusicLyricsTrack IDirectMusicLyricsTrack; +typedef struct IDirectMusicLyricsTrackStream IDirectMusicLyricsTrackStream; +typedef struct IDirectMusicMarkerTrack IDirectMusicMarkerTrack; +typedef struct IDirectMusicMarkerTrackStream IDirectMusicMarkerTrackStream; +typedef struct IDirectMusicParamControlTrack IDirectMusicParamControlTrack; +typedef struct IDirectMusicParamControlTrackStream IDirectMusicParamControlTrackStream; +typedef struct IDirectMusicSegTriggerTrack IDirectMusicSegTriggerTrack; +typedef struct IDirectMusicSegTriggerTrackStream IDirectMusicSegTriggerTrackStream; +typedef struct IDirectMusicSeqTrack IDirectMusicSeqTrack; +typedef struct IDirectMusicSeqTrackStream IDirectMusicSeqTrackStream; +typedef struct IDirectMusicSysExTrack IDirectMusicSysExTrack; +typedef struct IDirectMusicSysExTrackStream IDirectMusicSysExTrackStream; +typedef struct IDirectMusicTempoTrack IDirectMusicTempoTrack; +typedef struct IDirectMusicTempoTrackStream IDirectMusicTempoTrackStream; +typedef struct IDirectMusicTimeSigTrack IDirectMusicTimeSigTrack; +typedef struct IDirectMusicTimeSigTrackStream IDirectMusicTimeSigTrackStream; +typedef struct IDirectMusicWaveTrack IDirectMusicWaveTrack; +typedef struct IDirectMusicWaveTrackStream IDirectMusicWaveTrackStream; + /***************************************************************************** * Predeclare the interface implementation structures */ @@ -56,9 +83,36 @@ extern ICOM_VTABLE(IDirectMusicGraph) DirectMusicGraph_Vtbl; extern ICOM_VTABLE(IDirectMusicSong) DirectMusicSong_Vtbl; extern ICOM_VTABLE(IDirectMusicAudioPath) DirectMusicAudioPath_Vtbl; extern ICOM_VTABLE(IDirectMusicTool8) DirectMusicTool8_Vtbl; -extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTrack8_Vtbl; extern ICOM_VTABLE(IDirectMusicPatternTrack) DirectMusicPatternTrack_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicSegmentObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSegmentObjectStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicSongObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSongObjectStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicAudioPathObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicAudioPathObjectStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicGraphObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicGraphObjectStream_Vtbl; + +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicLyricsTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicLyricsTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMarkerTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicMarkerTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicParamControlTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicParamControlTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSegTriggerTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSegTriggerTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSeqTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSeqTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSysExTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicSysExTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTempoTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicTempoTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTimeSigTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicTimeSigTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicWaveTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicWaveTrackStream_Vtbl; + /***************************************************************************** * ClassFactory */ @@ -90,15 +144,26 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPath (LPCGUID lpcGUID, LPDIRE * return always an IDirectMusicTool8Impl */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicTool (LPCGUID lpcGUID, LPDIRECTMUSICTOOL8 *ppDMTool, LPUNKNOWN pUnkOuter); -/* can support IID_IDirectMusicTrack and IID_IDirectMusicTrack8 - * return always an IDirectMusicTrack8Impl - */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppDMTrack, LPUNKNOWN pUnkOuter); /* can support IID_IDirectMusicPatternTrack * return always an IDirectMusicPatternTrackImpl */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicPatternTrack (LPCGUID lpcGUID, LPDIRECTMUSICPATTERNTRACK *ppDMPtrnTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT *ppObject, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSongObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT *ppObject, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT *ppObject, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicGraphObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT *ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicLyricsTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicMarkerTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicParamControlTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSegTriggerTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSeqTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicTimeSigTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicWaveTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); + /***************************************************************************** * IDirectMusicPerformance8Impl implementation structure */ @@ -196,6 +261,20 @@ struct IDirectMusicSegment8Impl DWORD ref; /* IDirectMusicSegment8Impl fields */ + IDirectMusicSegmentObject* pObject; + + DMUS_IO_SEGMENT_HEADER segHeader; /* header */ + GUID guidID; /* unique id */ + DMUS_IO_VERSION vVersion; /* version */ + /* info from UNFO list */ + WCHAR* wszName; + WCHAR* wszArtist; + WCHAR* wszCopyright; + WCHAR* wszSubject; + WCHAR* wszComment; + /* tracks */ + DWORD dwTracks; + LPDIRECTMUSICTRACK8 ppTracks[255]; }; /* IUnknown: */ @@ -269,6 +348,7 @@ struct IDirectMusicGraphImpl DWORD ref; /* IDirectMusicGraphImpl fields */ + IDirectMusicGraphObject* pObject; IDirectMusicTool8Impl* pFirst; IDirectMusicTool8Impl* pLast; WORD num_tools; @@ -294,6 +374,7 @@ struct IDirectMusicSongImpl DWORD ref; /* IDirectMusicSongImpl fields */ + IDirectMusicSongObject* pObject; }; /* IUnknown: */ @@ -319,6 +400,8 @@ struct IDirectMusicAudioPathImpl DWORD ref; /* IDirectMusicAudioPathImpl fields */ + IDirectMusicAudioPathObject* pObject; + IDirectMusicPerformance8* pPerf; IDirectMusicGraph* pToolGraph; IDirectSoundBuffer* pDSBuffer; @@ -363,40 +446,6 @@ extern HRESULT WINAPI IDirectMusicTool8Impl_Flush (LPDIRECTMUSICTOOL8 iface, IDi /* IDirectMusicToolImpl8: */ extern HRESULT WINAPI IDirectMusicTool8Impl_Clone (LPDIRECTMUSICTOOL8 iface, IDirectMusicTool** ppTool); -/***************************************************************************** - * IDirectMusicTrack8Impl implementation structure - */ -struct IDirectMusicTrack8Impl -{ - /* IUnknown fields */ - ICOM_VFIELD(IDirectMusicTrack8); - DWORD ref; - - /* IDirectMusicTrack8Impl fields */ -}; - -/* IUnknown: */ -extern HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); -extern ULONG WINAPI IDirectMusicTrack8Impl_AddRef (LPDIRECTMUSICTRACK8 iface); -extern ULONG WINAPI IDirectMusicTrack8Impl_Release (LPDIRECTMUSICTRACK8 iface); -/* IDirectMusicTrack: */ -extern HRESULT WINAPI IDirectMusicTrack8Impl_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); -extern HRESULT WINAPI IDirectMusicTrack8Impl_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); -extern HRESULT WINAPI IDirectMusicTrack8Impl_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); -extern HRESULT WINAPI IDirectMusicTrack8Impl_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); -extern HRESULT WINAPI IDirectMusicTrack8Impl_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); -extern HRESULT WINAPI IDirectMusicTrack8Impl_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); -extern HRESULT WINAPI IDirectMusicTrack8Impl_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); -extern HRESULT WINAPI IDirectMusicTrack8Impl_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); -extern HRESULT WINAPI IDirectMusicTrack8Impl_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); -extern HRESULT WINAPI IDirectMusicTrack8Impl_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); -/* IDirectMusicTrack8: */ -extern HRESULT WINAPI IDirectMusicTrack8Impl_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); -extern HRESULT WINAPI IDirectMusicTrack8Impl_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); -extern HRESULT WINAPI IDirectMusicTrack8Impl_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); -extern HRESULT WINAPI IDirectMusicTrack8Impl_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); -extern HRESULT WINAPI IDirectMusicTrack8Impl_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); - /***************************************************************************** * IDirectMusicPatternTrackImpl implementation structure */ @@ -406,7 +455,7 @@ struct IDirectMusicPatternTrackImpl ICOM_VFIELD(IDirectMusicPatternTrack); DWORD ref; - /* IDirectMusicComposerImpl fields */ + /* IDirectMusicPatternTrackImpl fields */ }; /* IUnknown: */ @@ -418,4 +467,751 @@ extern HRESULT WINAPI IDirectMusicPatternTrackImpl_CreateSegment (LPDIRECTMUSICP extern HRESULT WINAPI IDirectMusicPatternTrackImpl_SetVariation (LPDIRECTMUSICPATTERNTRACK iface, IDirectMusicSegmentState* pSegState, DWORD dwVariationFlags, DWORD dwPart); extern HRESULT WINAPI IDirectMusicPatternTrackImpl_SetPatternByName (LPDIRECTMUSICPATTERNTRACK iface, IDirectMusicSegmentState* pSegState, WCHAR* wszName, IDirectMusicStyle* pStyle, DWORD dwPatternType, DWORD* pdwLength); + +/***************************************************************************** + * IDirectMusicSegmentObject implementation structure + */ +struct IDirectMusicSegmentObject +{ + /* IUnknown fields */ + ICOM_VFIELD (IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicSegmentObjectStream* pStream; + IDirectMusicSegment8Impl* pSegment; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSegmentObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSegmentObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicSegmentObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicSegmentObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicSegmentObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicSegmentObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicSegmentObjectStream implementation structure + */ +struct IDirectMusicSegmentObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSegmentObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSegmentObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSegmentObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSegmentObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicSongObject implementation structure + */ +struct IDirectMusicSongObject +{ + /* IUnknown fields */ + ICOM_VFIELD (IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicSongObjectStream* pStream; + IDirectMusicSongImpl* pSong; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSongObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSongObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicSongObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicSongObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicSongObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicSongObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicSongObjectStream implementation structure + */ +struct IDirectMusicSongObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSongObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSongObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSongObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSongObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSongObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSongObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSongObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSongObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSongObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicAudioPathObject implementation structure + */ +struct IDirectMusicAudioPathObject +{ + /* IUnknown fields */ + ICOM_VFIELD (IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicAudioPathObjectStream* pStream; + IDirectMusicAudioPathImpl* pAudioPath; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicAudioPathObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicAudioPathObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicAudioPathObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicAudioPathObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicAudioPathObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicAudioPathObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicAudioPathObjectStream implementation structure + */ +struct IDirectMusicAudioPathObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicAudioPathObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicAudioPathObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicAudioPathObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicGraphObject implementation structure + */ +struct IDirectMusicGraphObject +{ + /* IUnknown fields */ + ICOM_VFIELD (IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicGraphObjectStream* pStream; + IDirectMusicGraphImpl* pGraph; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicGraphObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicGraphObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicGraphObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicGraphObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicGraphObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicGraphObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicGraphObjectStream implementation structure + */ +struct IDirectMusicGraphObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicGraphObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicGraphObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicGraphObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicGraphObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicGraphObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicGraphObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicGraphObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicGraphObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicGraphObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicLyricsTrack implementation structure + */ +struct IDirectMusicLyricsTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicLyricsTrack fields */ + IDirectMusicLyricsTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicLyricsTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicLyricsTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicLyricsTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicLyricsTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicLyricsTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicLyricsTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicLyricsTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicLyricsTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicLyricsTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicLyricsTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicLyricsTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicLyricsTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicLyricsTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicLyricsTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicLyricsTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicLyricsTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicLyricsTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicLyricsTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicLyricsTrackStream implementation structure + */ +struct IDirectMusicLyricsTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicLyricsTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicLyricsTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicLyricsTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicLyricsTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicMarkerTrack implementation structure + */ +struct IDirectMusicMarkerTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicMarkerTrack fields */ + IDirectMusicMarkerTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMarkerTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicMarkerTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicMarkerTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicMarkerTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicMarkerTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMarkerTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicMarkerTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMarkerTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicMarkerTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicMarkerTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicMarkerTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMarkerTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMarkerTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicMarkerTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMarkerTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMarkerTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMarkerTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicMarkerTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicMarkerTrackStream implementation structure + */ +struct IDirectMusicMarkerTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicMarkerTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicMarkerTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicMarkerTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicMarkerTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicParamControlTrack implementation structure + */ +struct IDirectMusicParamControlTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicParamControlTrack fields */ + IDirectMusicParamControlTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicParamControlTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicParamControlTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicParamControlTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicParamControlTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicParamControlTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicParamControlTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicParamControlTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicParamControlTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicParamControlTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicParamControlTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicParamControlTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicParamControlTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicParamControlTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicParamControlTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicParamControlTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicParamControlTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicParamControlTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicParamControlTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicParamControlTrackStream implementation structure + */ +struct IDirectMusicParamControlTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicParamControlTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicParamControlTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicParamControlTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicParamControlTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicSegTriggerTrack implementation structure + */ +struct IDirectMusicSegTriggerTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicSegTriggerTrack fields */ + IDirectMusicSegTriggerTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSegTriggerTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicSegTriggerTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicSegTriggerTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicSegTriggerTrackStream implementation structure + */ +struct IDirectMusicSegTriggerTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSegTriggerTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSegTriggerTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSegTriggerTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSegTriggerTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicSeqTrack implementation structure + */ +struct IDirectMusicSeqTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicSeqTrack fields */ + IDirectMusicSeqTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSeqTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSeqTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicSeqTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicSeqTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicSeqTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSeqTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicSeqTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSeqTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicSeqTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicSeqTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicSeqTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSeqTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSeqTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicSeqTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSeqTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSeqTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSeqTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicSeqTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicSeqTrackStream implementation structure + */ +struct IDirectMusicSeqTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSeqTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSeqTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSeqTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSeqTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSeqTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSeqTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSeqTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSeqTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSeqTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicSysExTrack implementation structure + */ +struct IDirectMusicSysExTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicSysExTrack fields */ + IDirectMusicSysExTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSysExTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicSysExTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicSysExTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicSysExTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicSysExTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSysExTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicSysExTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSysExTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicSysExTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicSysExTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicSysExTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSysExTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicSysExTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicSysExTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicSysExTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSysExTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicSysExTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicSysExTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicSysExTrackStream implementation structure + */ +struct IDirectMusicSysExTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicSysExTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicSysExTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicSysExTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicSysExTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicSysExTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicSysExTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicSysExTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicSysExTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicSysExTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicTempoTrack implementation structure + */ +struct IDirectMusicTempoTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicTempoTrack fields */ + IDirectMusicTempoTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicTempoTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicTempoTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicTempoTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicTempoTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicTempoTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTempoTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicTempoTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicTempoTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicTempoTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicTempoTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicTempoTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicTempoTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicTempoTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicTempoTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicTempoTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTempoTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTempoTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicTempoTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicTempoTrackStream implementation structure + */ +struct IDirectMusicTempoTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicTempoTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicTempoTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicTempoTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicTempoTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicTempoTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicTempoTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicTempoTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicTempoTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicTempoTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicTimeSigTrack implementation structure + */ +struct IDirectMusicTimeSigTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicTimeSigTrack fields */ + IDirectMusicTimeSigTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicTimeSigTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicTimeSigTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicTimeSigTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicTimeSigTrackStream implementation structure + */ +struct IDirectMusicTimeSigTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicTimeSigTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicTimeSigTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicTimeSigTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicTimeSigTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +/***************************************************************************** + * IDirectMusicWaveTrack implementation structure + */ +struct IDirectMusicWaveTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicWaveTrack fields */ + IDirectMusicWaveTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicWaveTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicWaveTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicWaveTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicWaveTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicWaveTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicWaveTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicWaveTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicWaveTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicWaveTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicWaveTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicWaveTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicWaveTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicWaveTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicWaveTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicWaveTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicWaveTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicWaveTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicWaveTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicWaveTrackStream implementation structure + */ +struct IDirectMusicWaveTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicWaveTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicWaveTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicWaveTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicWaveTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicWaveTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicWaveTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicWaveTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicWaveTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicWaveTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +static inline const char *debugstr_fourcc( DWORD fourcc ) +{ + if (!fourcc) return "'null'"; + return wine_dbg_sprintf( "\'%c%c%c%c\'", + (char)(fourcc), (char)(fourcc >> 8), + (char)(fourcc >> 16), (char)(fourcc >> 24) ); +} + #endif /* __WINE_DMIME_PRIVATE_H */ diff --git a/dlls/dmime/graph.c b/dlls/dmime/graph.c index 7cdbe981258..41796507f92 100644 --- a/dlls/dmime/graph.c +++ b/dlls/dmime/graph.c @@ -25,20 +25,20 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicGraph IUnknown parts follow: */ +/* IDirectMusicGraph IUnknown part: */ HRESULT WINAPI IDirectMusicGraphImpl_QueryInterface (LPDIRECTMUSICGRAPH iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicGraphImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicGraph)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicGraph)) { IDirectMusicGraphImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -55,14 +55,13 @@ ULONG WINAPI IDirectMusicGraphImpl_Release (LPDIRECTMUSICGRAPH iface) ICOM_THIS(IDirectMusicGraphImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicGraph Interface follow: */ +/* IDirectMusicGraph IDirectMusicGraph part: */ HRESULT WINAPI IDirectMusicGraphImpl_StampPMsg (LPDIRECTMUSICGRAPH iface, DMUS_PMSG* pPMSG) { ICOM_THIS(IDirectMusicGraphImpl,iface); @@ -160,12 +159,214 @@ ICOM_VTABLE(IDirectMusicGraph) DirectMusicGraph_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicGraph (LPCGUID lpcGUID, LPDIRECTMUSICGRAPH *ppDMGrph, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicGraph)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicGraphImpl* dmgraph; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicGraph)) { + dmgraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl)); + if (NULL == dmgraph) { + *ppDMGrph = (LPDIRECTMUSICGRAPH) NULL; + return E_OUTOFMEMORY; + } + dmgraph->lpVtbl = &DirectMusicGraph_Vtbl; + dmgraph->ref = 1; + *ppDMGrph = (LPDIRECTMUSICGRAPH) dmgraph; + return S_OK; } WARN("No interface found\n"); return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicGraphObject implementation + */ +/* IDirectMusicGraphObject IUnknown part: */ +HRESULT WINAPI IDirectMusicGraphObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicGraphObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicGraph)) { + IDirectMusicGraph_AddRef ((LPDIRECTMUSICGRAPH)This->pGraph); + *ppobj = (LPDIRECTMUSICGRAPH)This->pGraph; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicGraphObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicGraphObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicGraphObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicGraphObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicGraphObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicGraphObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicGraphObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicGraphObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicGraphObject_QueryInterface, + IDirectMusicGraphObject_AddRef, + IDirectMusicGraphObject_Release, + IDirectMusicGraphObject_GetDescriptor, + IDirectMusicGraphObject_SetDescriptor, + IDirectMusicGraphObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicGraphObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicGraphObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicGraphObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphObjectStream)); + obj->pStream->lpVtbl = &DirectMusicGraphObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicGraph */ + DMUSIC_CreateDirectMusicGraph (&IID_IDirectMusicGraph, (LPDIRECTMUSICGRAPH*)&obj->pGraph, NULL); + obj->pGraph->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicGraphObjectStream implementation + */ +/* IDirectMusicGraphObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicGraphObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicGraphObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicGraphObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicGraphObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicGraphObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicGraphObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicGraphObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicGraphObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicGraphObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicGraphObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicGraphObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicGraphObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicGraphObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicGraphObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicGraphObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicGraphObjectStream_QueryInterface, + IDirectMusicGraphObjectStream_AddRef, + IDirectMusicGraphObjectStream_Release, + IDirectMusicGraphObjectStream_GetClassID, + IDirectMusicGraphObjectStream_IsDirty, + IDirectMusicGraphObjectStream_Load, + IDirectMusicGraphObjectStream_Save, + IDirectMusicGraphObjectStream_GetSizeMax +}; diff --git a/dlls/dmime/lyricstrack.c b/dlls/dmime/lyricstrack.c new file mode 100644 index 00000000000..3a86912e272 --- /dev/null +++ b/dlls/dmime/lyricstrack.c @@ -0,0 +1,337 @@ +/* IDirectMusicLyricsTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicLyricsTrack implementation + */ +/* IDirectMusicLyricsTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicLyricsTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicLyricsTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicLyricsTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicLyricsTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicLyricsTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicLyricsTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicLyricsTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicLyricsTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicLyricsTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicLyricsTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicLyricsTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicLyricsTrack_QueryInterface, + IDirectMusicLyricsTrack_AddRef, + IDirectMusicLyricsTrack_Release, + IDirectMusicLyricsTrack_Init, + IDirectMusicLyricsTrack_InitPlay, + IDirectMusicLyricsTrack_EndPlay, + IDirectMusicLyricsTrack_Play, + IDirectMusicLyricsTrack_GetParam, + IDirectMusicLyricsTrack_SetParam, + IDirectMusicLyricsTrack_IsParamSupported, + IDirectMusicLyricsTrack_AddNotificationType, + IDirectMusicLyricsTrack_RemoveNotificationType, + IDirectMusicLyricsTrack_Clone, + IDirectMusicLyricsTrack_PlayEx, + IDirectMusicLyricsTrack_GetParamEx, + IDirectMusicLyricsTrack_SetParamEx, + IDirectMusicLyricsTrack_Compose, + IDirectMusicLyricsTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicLyricsTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicLyricsTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLyricsTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicLyricsTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLyricsTrackStream)); + track->pStream->lpVtbl = &DirectMusicLyricsTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicLyricsTrackStream implementation + */ +/* IDirectMusicLyricsTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicLyricsTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicLyricsTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicLyricsTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicLyricsTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicLyricsTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicLyricsTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicLyricsTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicLyricsTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicLyricsTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicLyricsTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicLyricsTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicLyricsTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicLyricsTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicLyricsTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicLyricsTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicLyricsTrackStream_QueryInterface, + IDirectMusicLyricsTrackStream_AddRef, + IDirectMusicLyricsTrackStream_Release, + IDirectMusicLyricsTrackStream_GetClassID, + IDirectMusicLyricsTrackStream_IsDirty, + IDirectMusicLyricsTrackStream_Load, + IDirectMusicLyricsTrackStream_Save, + IDirectMusicLyricsTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/markertrack.c b/dlls/dmime/markertrack.c new file mode 100644 index 00000000000..a46426dc70e --- /dev/null +++ b/dlls/dmime/markertrack.c @@ -0,0 +1,342 @@ +/* IDirectMusicMarkerTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicMarkerTrack implementation + */ +/* IDirectMusicMarkerTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicMarkerTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicMarkerTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMarkerTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMarkerTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMarkerTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMarkerTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicMarkerTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_Play_Marker) + || IsEqualGUID (rguidType, &GUID_Valid_Start_Time)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicMarkerTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicMarkerTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMarkerTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMarkerTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMarkerTrack_QueryInterface, + IDirectMusicMarkerTrack_AddRef, + IDirectMusicMarkerTrack_Release, + IDirectMusicMarkerTrack_Init, + IDirectMusicMarkerTrack_InitPlay, + IDirectMusicMarkerTrack_EndPlay, + IDirectMusicMarkerTrack_Play, + IDirectMusicMarkerTrack_GetParam, + IDirectMusicMarkerTrack_SetParam, + IDirectMusicMarkerTrack_IsParamSupported, + IDirectMusicMarkerTrack_AddNotificationType, + IDirectMusicMarkerTrack_RemoveNotificationType, + IDirectMusicMarkerTrack_Clone, + IDirectMusicMarkerTrack_PlayEx, + IDirectMusicMarkerTrack_GetParamEx, + IDirectMusicMarkerTrack_SetParamEx, + IDirectMusicMarkerTrack_Compose, + IDirectMusicMarkerTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicMarkerTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicMarkerTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMarkerTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicMarkerTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMarkerTrackStream)); + track->pStream->lpVtbl = &DirectMusicMarkerTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicMarkerTrackStream implementation + */ +/* IDirectMusicMarkerTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicMarkerTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMarkerTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMarkerTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMarkerTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMarkerTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMarkerTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMarkerTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMarkerTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicMarkerTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicMarkerTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicMarkerTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMarkerTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicMarkerTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMarkerTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicMarkerTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMarkerTrackStream_QueryInterface, + IDirectMusicMarkerTrackStream_AddRef, + IDirectMusicMarkerTrackStream_Release, + IDirectMusicMarkerTrackStream_GetClassID, + IDirectMusicMarkerTrackStream_IsDirty, + IDirectMusicMarkerTrackStream_Load, + IDirectMusicMarkerTrackStream_Save, + IDirectMusicMarkerTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/paramcontroltrack.c b/dlls/dmime/paramcontroltrack.c new file mode 100644 index 00000000000..0068facbe84 --- /dev/null +++ b/dlls/dmime/paramcontroltrack.c @@ -0,0 +1,336 @@ +/* IDirectMusicParamControlTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicParamControlTrack implementation + */ +/* IDirectMusicParamControlTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicParamControlTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicParamControlTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicParamControlTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicParamControlTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicParamControlTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicParamControlTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicParamControlTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicParamControlTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicParamControlTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicParamControlTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicParamControlTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicParamControlTrack_QueryInterface, + IDirectMusicParamControlTrack_AddRef, + IDirectMusicParamControlTrack_Release, + IDirectMusicParamControlTrack_Init, + IDirectMusicParamControlTrack_InitPlay, + IDirectMusicParamControlTrack_EndPlay, + IDirectMusicParamControlTrack_Play, + IDirectMusicParamControlTrack_GetParam, + IDirectMusicParamControlTrack_SetParam, + IDirectMusicParamControlTrack_IsParamSupported, + IDirectMusicParamControlTrack_AddNotificationType, + IDirectMusicParamControlTrack_RemoveNotificationType, + IDirectMusicParamControlTrack_Clone, + IDirectMusicParamControlTrack_PlayEx, + IDirectMusicParamControlTrack_GetParamEx, + IDirectMusicParamControlTrack_SetParamEx, + IDirectMusicParamControlTrack_Compose, + IDirectMusicParamControlTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicParamControlTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicParamControlTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicParamControlTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicParamControlTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicParamControlTrackStream)); + track->pStream->lpVtbl = &DirectMusicParamControlTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicParamControlTrackStream implementation + */ +/* IDirectMusicParamControlTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicParamControlTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicParamControlTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicParamControlTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicParamControlTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicParamControlTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicParamControlTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicParamControlTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicParamControlTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicParamControlTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicParamControlTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicParamControlTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicParamControlTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicParamControlTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicParamControlTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicParamControlTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicParamControlTrackStream_QueryInterface, + IDirectMusicParamControlTrackStream_AddRef, + IDirectMusicParamControlTrackStream_Release, + IDirectMusicParamControlTrackStream_GetClassID, + IDirectMusicParamControlTrackStream_IsDirty, + IDirectMusicParamControlTrackStream_Load, + IDirectMusicParamControlTrackStream_Save, + IDirectMusicParamControlTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/patterntrack.c b/dlls/dmime/patterntrack.c index f5ca1ff26f8..a2b0da0e6f1 100644 --- a/dlls/dmime/patterntrack.c +++ b/dlls/dmime/patterntrack.c @@ -25,20 +25,20 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); /* IDirectMusicPatternTrack IUnknown parts follow: */ HRESULT WINAPI IDirectMusicPatternTrackImpl_QueryInterface (LPDIRECTMUSICPATTERNTRACK iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicPatternTrackImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicPatternTrack)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicPatternTrack)) { IDirectMusicPatternTrackImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,8 +55,7 @@ ULONG WINAPI IDirectMusicPatternTrackImpl_Release (LPDIRECTMUSICPATTERNTRACK ifa ICOM_THIS(IDirectMusicPatternTrackImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -104,12 +103,12 @@ ICOM_VTABLE(IDirectMusicPatternTrack) DirectMusicPatternTrack_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicPatternTrack (LPCGUID lpcGUID, LPDIRECTMUSICPATTERNTRACK *ppDMPtrnTrack, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) + if (IsEqualIID (lpcGUID, &IID_IDirectMusicComposer)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index ee1d6bd099d..dfae2af8c55 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -25,21 +25,21 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicPerformance8 IUnknown part follow: */ +/* IDirectMusicPerformance8 IUnknown part: */ HRESULT WINAPI IDirectMusicPerformance8Impl_QueryInterface (LPDIRECTMUSICPERFORMANCE8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicPerformance8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicPerformance) || - IsEqualGUID(riid, &IID_IDirectMusicPerformance8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicPerformance) || + IsEqualIID (riid, &IID_IDirectMusicPerformance8)) { IDirectMusicPerformance8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -56,20 +56,19 @@ ULONG WINAPI IDirectMusicPerformance8Impl_Release (LPDIRECTMUSICPERFORMANCE8 ifa ICOM_THIS(IDirectMusicPerformance8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicPerformance8 IDirectMusicPerformance Interface part follow: */ +/* IDirectMusicPerformance8 IDirectMusicPerformance Interface part: */ HRESULT WINAPI IDirectMusicPerformance8Impl_Init (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusic** ppDirectMusic, LPDIRECTSOUND pDirectSound, HWND hWnd) { ICOM_THIS(IDirectMusicPerformance8Impl,iface); FIXME("(iface = %p, dmusic = %p, dsound = %p, hwnd = %p)\n", This, ppDirectMusic, pDirectSound, hWnd); - if (This->pDirectMusic || This->pDirectSound) + if (This->pDirectMusic || This->pDirectSound) return DMUS_E_ALREADY_INITED; if (NULL != pDirectSound) { @@ -93,7 +92,6 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_Init (LPDIRECTMUSICPERFORMANCE8 ifac IDirectMusic8_AddRef((LPDIRECTMUSIC8) *ppDirectMusic); } } - return S_OK; } @@ -316,18 +314,18 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock (LPDIRECTMUSICPE ICOM_THIS(IDirectMusicPerformance8Impl,iface); FIXME("(%p, %ld, %p, %ld): semi-stub\n", This, dwBlockNum, pPort, dwGroup-1); - range = 16 * dwBlockNum; - j = 0; + range = 16 * dwBlockNum; + j = 0; - for (i = range; i < range+16; i++) - { - /*TRACE("Setting PChannel[%i] to port %p, group %ld, MIDI port %i\n", i, pPort, dwGroup-1, j); */ - This->PChannel[i].port = pPort; - This->PChannel[i].group = dwGroup - 1; /* first index is always zero */ - This->PChannel[i].channel = j; /* FIXME: should this be assigned? */ - j++; - } - return S_OK; + for (i = range; i < range+16; i++) { + /*TRACE("Setting PChannel[%i] to port %p, group %ld, MIDI port %i\n", i, pPort, dwGroup-1, j); */ + This->PChannel[i].port = pPort; + This->PChannel[i].group = dwGroup - 1; /* first index is always zero */ + This->PChannel[i].channel = j; /* FIXME: should this be assigned? */ + j++; + } + + return S_OK; } HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannel (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwPChannel, IDirectMusicPort* pPort, DWORD dwGroup, DWORD dwMChannel) @@ -393,13 +391,13 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_GetGlobalParam (LPDIRECTMUSICPERFORM TRACE("(%p, %s, %p, %ld): stub\n", This, debugstr_guid(rguidType), pParam, dwSize); - if (IsEqualGUID(rguidType, &GUID_PerfAutoDownload)) + if (IsEqualGUID (rguidType, &GUID_PerfAutoDownload)) memcpy(pParam, &This->fAutoDownload, sizeof(&This->fAutoDownload)); - if (IsEqualGUID(rguidType, &GUID_PerfMasterGrooveLevel)) + if (IsEqualGUID (rguidType, &GUID_PerfMasterGrooveLevel)) memcpy(pParam, &This->cMasterGrooveLevel, sizeof(&This->cMasterGrooveLevel)); - if (IsEqualGUID(rguidType, &GUID_PerfMasterTempo)) + if (IsEqualGUID (rguidType, &GUID_PerfMasterTempo)) memcpy(pParam, &This->fMasterTempo, sizeof(&This->fMasterTempo)); - if (IsEqualGUID(rguidType, &GUID_PerfMasterVolume)) + if (IsEqualGUID (rguidType, &GUID_PerfMasterVolume)) memcpy(pParam, &This->lMasterVolume, sizeof(&This->lMasterVolume)); return S_OK; @@ -411,23 +409,19 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_SetGlobalParam (LPDIRECTMUSICPERFORM TRACE("(%p, %s, %p, %ld)\n", This, debugstr_guid(rguidType), pParam, dwSize); - if (IsEqualGUID(rguidType, &GUID_PerfAutoDownload)) - { + if (IsEqualGUID (rguidType, &GUID_PerfAutoDownload)) { memcpy(&This->fAutoDownload, pParam, dwSize); TRACE("=> AutoDownload set to %d\n", This->fAutoDownload); } - if (IsEqualGUID(rguidType, &GUID_PerfMasterGrooveLevel)) - { + if (IsEqualGUID (rguidType, &GUID_PerfMasterGrooveLevel)) { memcpy(&This->cMasterGrooveLevel, pParam, dwSize); TRACE("=> MasterGrooveLevel set to %i\n", This->cMasterGrooveLevel); } - if (IsEqualGUID(rguidType, &GUID_PerfMasterTempo)) - { + if (IsEqualGUID (rguidType, &GUID_PerfMasterTempo)) { memcpy(&This->fMasterTempo, pParam, dwSize); TRACE("=> MasterTempo set to %f\n", This->fMasterTempo); } - if (IsEqualGUID(rguidType, &GUID_PerfMasterVolume)) - { + if (IsEqualGUID (rguidType, &GUID_PerfMasterVolume)) { memcpy(&This->lMasterVolume, pParam, dwSize); TRACE("=> MasterVolume set to %li\n", This->lMasterVolume); } @@ -528,7 +522,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplInitAudio (LPDIRECTMUSICPERFORMANCE8 { IDirectSound* dsound; - ICOM_THIS(IDirectMusicPerformance8Impl,iface); + ICOM_THIS(IDirectMusicPerformance8Impl,iface); FIXME("(%p, %p, %p, %p, %lx, %lu, %lx, %p): to check\n", This, ppDirectMusic, ppDirectSound, hWnd, dwDefaultPathType, dwPChannelCount, dwFlags, pParams); if (This->pDirectMusic || This->pDirectSound) @@ -537,7 +531,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplInitAudio (LPDIRECTMUSICPERFORMANCE8 if (NULL != ppDirectSound && NULL != *ppDirectSound) { dsound = *ppDirectSound; } else { - DirectSoundCreate8(&IID_IDirectSound8, (LPDIRECTSOUND8*) &dsound, NULL); + DirectSoundCreate8 (&IID_IDirectSound8, (LPDIRECTSOUND8*) &dsound, NULL); if (!dsound) return DSERR_NODRIVER; if (ppDirectSound) @@ -650,7 +644,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSI } /* FIXME: Should we create one secondary buffer for each PChannel? */ - IDirectSound8_CreateSoundBuffer((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); + IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); default_path->pDSBuffer = (IDirectSoundBuffer*) buffer; /* Update description for creating primary buffer */ @@ -658,7 +652,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSI desc.dwBufferBytes = 0; desc.lpwfxFormat = NULL; - IDirectSound8_CreateSoundBuffer((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); + IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL); default_path->pPrimary = (IDirectSoundBuffer*) buffer; @@ -671,21 +665,21 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSI HRESULT WINAPI IDirectMusicPerformance8ImplSetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath* pAudioPath) { - ICOM_THIS(IDirectMusicPerformance8Impl,iface); + ICOM_THIS(IDirectMusicPerformance8Impl,iface); - FIXME("(%p, %p): semi-stub\n", This, pAudioPath); - - if (NULL != This->pDefaultPath) { - IDirectMusicAudioPathImpl_Release((LPDIRECTMUSICAUDIOPATH) This->pDefaultPath); - ((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = NULL; - This->pDefaultPath = NULL; - } - This->pDefaultPath = pAudioPath; - if (NULL != This->pDefaultPath) { - IDirectMusicAudioPathImpl_AddRef((LPDIRECTMUSICAUDIOPATH) This->pDefaultPath); - ((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = (IDirectMusicPerformance8*) This; - } - return S_OK; + FIXME("(%p, %p): semi-stub\n", This, pAudioPath); + if (NULL != This->pDefaultPath) { + IDirectMusicAudioPathImpl_Release((LPDIRECTMUSICAUDIOPATH) This->pDefaultPath); + ((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = NULL; + This->pDefaultPath = NULL; + } + This->pDefaultPath = pAudioPath; + if (NULL != This->pDefaultPath) { + IDirectMusicAudioPathImpl_AddRef((LPDIRECTMUSICAUDIOPATH) This->pDefaultPath); + ((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = (IDirectMusicPerformance8*) This; + } + + return S_OK; } HRESULT WINAPI IDirectMusicPerformance8ImplGetDefaultAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicAudioPath** ppAudioPath) @@ -776,8 +770,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance (LPCGUID lpcGUID, LPDIRECTMUS IDirectMusicPerformance8Impl *pPerf; TRACE("(%p,%p,%p)\n",lpcGUID, ppDMPerf, pUnkOuter); - if (IsEqualGUID(lpcGUID, &IID_IDirectMusicPerformance) || - IsEqualGUID(lpcGUID, &IID_IDirectMusicPerformance8)) { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicPerformance) || + IsEqualIID (lpcGUID, &IID_IDirectMusicPerformance8)) { pPerf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPerformance8Impl)); if (NULL == pPerf) { diff --git a/dlls/dmime/regsvr.c b/dlls/dmime/regsvr.c index 5cebeb51db9..e87cd6f9160 100644 --- a/dlls/dmime/regsvr.c +++ b/dlls/dmime/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); /* * Near the bottom of this file are the exported DllRegisterServer and diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c index b6d48c47f74..7e8be4e8701 100644 --- a/dlls/dmime/segment.c +++ b/dlls/dmime/segment.c @@ -25,22 +25,25 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); - -/* IDirectMusicSegment8 IUnknown parts follow: */ +/***************************************************************************** + * IDirectMusicSegment8Impl implementation + */ +/* IDirectMusicSegment8 IUnknown part: */ HRESULT WINAPI IDirectMusicSegment8Impl_QueryInterface (LPDIRECTMUSICSEGMENT8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicSegment8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicSegment) || - IsEqualGUID(riid, &IID_IDirectMusicSegment8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicSegment) || + IsEqualIID (riid, &IID_IDirectMusicSegment8)) { IDirectMusicSegment8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -57,19 +60,19 @@ ULONG WINAPI IDirectMusicSegment8Impl_Release (LPDIRECTMUSICSEGMENT8 iface) ICOM_THIS(IDirectMusicSegment8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicSegment Interface part follow: */ +/* IDirectMusicSegment8 IDirectMusicSegment part: */ HRESULT WINAPI IDirectMusicSegment8Impl_GetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtLength) { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %p): stub\n", This, pmtLength); + TRACE("(%p, %p)\n", This, pmtLength); + *pmtLength = This->segHeader.mtLength; return S_OK; } @@ -78,7 +81,8 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetLength (LPDIRECTMUSICSEGMENT8 iface, { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %ld): stub\n", This, mtLength); + TRACE("(%p, %ld)\n", This, mtLength); + This->segHeader.mtLength = mtLength; return S_OK; } @@ -87,7 +91,8 @@ HRESULT WINAPI IDirectMusicSegment8Impl_GetRepeats (LPDIRECTMUSICSEGMENT8 iface, { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %p): stub\n", This, pdwRepeats); + TRACE("(%p, %p)\n", This, pdwRepeats); + *pdwRepeats = This->segHeader.dwRepeats; return S_OK; } @@ -96,8 +101,9 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetRepeats (LPDIRECTMUSICSEGMENT8 iface, { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %ld): stub\n", This, dwRepeats); - + TRACE("(%p, %ld)\n", This, dwRepeats); + This->segHeader.dwRepeats = dwRepeats; + return S_OK; } @@ -105,8 +111,9 @@ HRESULT WINAPI IDirectMusicSegment8Impl_GetDefaultResolution (LPDIRECTMUSICSEGME { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %p): stub\n", This, pdwResolution); - + TRACE("(%p, %p)\n", This, pdwResolution); + *pdwResolution = This->segHeader.dwResolution; + return S_OK; } @@ -114,8 +121,9 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetDefaultResolution (LPDIRECTMUSICSEGME { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %ld): stub\n", This, dwResolution); - + TRACE("(%p, %ld)\n", This, dwResolution); + This->segHeader.dwResolution = dwResolution; + return S_OK; } @@ -231,8 +239,9 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetStartPoint (LPDIRECTMUSICSEGMENT8 ifa { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %ld): stub\n", This, mtStart); - + TRACE("(%p, %ld): stub\n", This, mtStart); + This->segHeader.mtPlayStart = mtStart; + return S_OK; } @@ -240,7 +249,8 @@ HRESULT WINAPI IDirectMusicSegment8Impl_GetStartPoint (LPDIRECTMUSICSEGMENT8 ifa { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %p): stub\n", This, pmtStart); + TRACE("(%p, %p): stub\n", This, pmtStart); + *pmtStart = This->segHeader.mtPlayStart; return S_OK; } @@ -249,8 +259,10 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetLoopPoints (LPDIRECTMUSICSEGMENT8 ifa { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %ld, %ld): stub\n", This, mtStart, mtEnd); - + TRACE("(%p, %ld, %ld): stub\n", This, mtStart, mtEnd); + This->segHeader.mtLoopStart = mtStart; + This->segHeader.mtLoopEnd = mtEnd; + return S_OK; } @@ -258,8 +270,10 @@ HRESULT WINAPI IDirectMusicSegment8Impl_GetLoopPoints (LPDIRECTMUSICSEGMENT8 ifa { ICOM_THIS(IDirectMusicSegment8Impl,iface); - FIXME("(%p, %p, %p): stub\n", This, pmtStart, pmtEnd); - + TRACE("(%p, %p, %p): stub\n", This, pmtStart, pmtEnd); + *pmtStart = This->segHeader.mtLoopStart; + *pmtEnd = This->segHeader.mtLoopEnd; + return S_OK; } @@ -272,7 +286,7 @@ HRESULT WINAPI IDirectMusicSegment8Impl_SetPChannelsUsed (LPDIRECTMUSICSEGMENT8 return S_OK; } -/* IDirectMusicSegment8 Interface part follow: */ +/* IDirectMusicSegment8 IDirectMusicSegment8 part: */ HRESULT WINAPI IDirectMusicSegment8Impl_SetTrackConfig (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) { ICOM_THIS(IDirectMusicSegment8Impl,iface); @@ -357,12 +371,443 @@ ICOM_VTABLE(IDirectMusicSegment8) DirectMusicSegment8_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicSegment (LPCGUID lpcGUID, LPDIRECTMUSICSEGMENT8 *ppDMSeg, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) + IDirectMusicSegment8Impl *segment; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppDMSeg, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicSegment) + || IsEqualIID (lpcGUID, &IID_IDirectMusicSegment2) + || IsEqualIID (lpcGUID, &IID_IDirectMusicSegment8)) { + segment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegment8Impl)); + if (NULL == segment) { + *ppDMSeg = (LPDIRECTMUSICSEGMENT8) NULL; + return E_OUTOFMEMORY; + } + segment->lpVtbl = &DirectMusicSegment8_Vtbl; + segment->ref = 1; + *ppDMSeg = (LPDIRECTMUSICSEGMENT8) segment; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicSegmentObject implementation + */ +/* IDirectMusicSegmentObject IUnknown part: */ +HRESULT WINAPI IDirectMusicSegmentObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IDirectMusicObject)) { + IDirectMusicSegmentObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualGUID (riid, &IID_IPersistStream)) { + IDirectMusicSegmentObjectStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } else if (IsEqualGUID (riid, &IID_IDirectMusicSegment) + || IsEqualGUID (riid, &IID_IDirectMusicSegment8)) { + IDirectMusicSegment8Impl_AddRef ((LPDIRECTMUSICSEGMENT8)This->pSegment); + *ppobj = This->pSegment; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSegmentObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSegmentObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { - FIXME("Not yet\n"); - return E_NOINTERFACE; + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSegmentObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicSegmentObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegmentObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegmentObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSegmentObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicSegmentObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSegmentObject_QueryInterface, + IDirectMusicSegmentObject_AddRef, + IDirectMusicSegmentObject_Release, + IDirectMusicSegmentObject_GetDescriptor, + IDirectMusicSegmentObject_SetDescriptor, + IDirectMusicSegmentObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSegmentObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualGUID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegmentObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicSegmentObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegmentObjectStream)); + obj->pStream->lpVtbl = &DirectMusicSegmentObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicSegment8 */ + DMUSIC_CreateDirectMusicSegment (&IID_IDirectMusicSegment8, (LPDIRECTMUSICSEGMENT8*)&obj->pSegment, NULL); + obj->pSegment->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicSegmentObjectStream implementation + */ +/* IDirectMusicSegmentObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicSegmentObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSegmentObjectStream,iface); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IPersistStream)) { + IDirectMusicSegmentObjectStream_AddRef (iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSegmentObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSegmentObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSegmentObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSegmentObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSegmentObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicSegmentObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSegmentObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSegmentObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSegmentObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicSegmentObjectStream,iface); + FOURCC chunkID; + DWORD chunkSize, StreamSize, StreamCount, ListSize[10], ListCount[10]; + LARGE_INTEGER liMove; /* used when skipping chunks */ + IDirectMusicSegment8Impl* pSegment = This->pParentObject->pSegment; /* that's where we load data */ + DMUS_IO_TRACK_HEADER tempHeader; + DMUS_IO_TRACK_EXTRAS_HEADER tempXHeader; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) + { + case FOURCC_RIFF: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": RIFF chunk containing %s", debugstr_fourcc (chunkID)); + StreamSize = chunkSize - sizeof(FOURCC); + StreamCount = 0; + switch (chunkID) + { + case DMUS_FOURCC_SEGMENT_FORM: { + TRACE_(dmfile)(": segment form\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + StreamCount += sizeof (FOURCC) + sizeof (DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_SEGMENT_CHUNK: { + TRACE_(dmfile)(": segment header chunk\n"); + IStream_Read (pStm, &pSegment->segHeader, chunkSize, NULL); + break; + } + case DMUS_FOURCC_GUID_CHUNK: { + TRACE_(dmfile)(": GUID chunk\n"); + IStream_Read (pStm, &pSegment->vVersion, chunkSize, NULL); + break; + } + case DMUS_FOURCC_VERSION_CHUNK: { + TRACE_(dmfile)(": version chunk\n"); + IStream_Read (pStm, &pSegment->guidID, chunkSize, NULL); + break; + } + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[0] = chunkSize - sizeof(FOURCC); + ListCount[0] = 0; + switch (chunkID) { + case DMUS_FOURCC_UNFO_LIST: { + TRACE_(dmfile)(": UNFO list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_UNAM_CHUNK: { + TRACE_(dmfile)(": name chunk\n"); + pSegment->wszName = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pSegment->wszName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UART_CHUNK: { + TRACE_(dmfile)(": artist chunk\n"); + pSegment->wszArtist = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pSegment->wszArtist, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCOP_CHUNK: { + TRACE_(dmfile)(": copyright chunk\n"); + pSegment->wszCopyright = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pSegment->wszCopyright, chunkSize, NULL); + break; + } + case DMUS_FOURCC_USBJ_CHUNK: { + TRACE_(dmfile)(": subject chunk\n"); + pSegment->wszSubject = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pSegment->wszSubject, chunkSize, NULL); + break; + } + case DMUS_FOURCC_UCMT_CHUNK: { + TRACE_(dmfile)(": comment chunk\n"); + pSegment->wszComment = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pSegment->wszComment, chunkSize, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + case DMUS_FOURCC_TRACK_LIST: { + TRACE_(dmfile)(": track list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) + { + case FOURCC_RIFF: { + TRACE_(dmfile)(": RIFF chunk"); + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + switch (chunkID) + { + case DMUS_FOURCC_TRACK_FORM: { + TRACE_(dmfile)(": containing %s: track form\n", debugstr_fourcc(chunkID)); + ListSize[1] = chunkSize - sizeof(FOURCC); + ListCount[1] = 0; + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_TRACK_CHUNK: { + TRACE_(dmfile)(": track header chunk\n"); + IStream_Read (pStm, &tempHeader, chunkSize, NULL); + break; + } + case DMUS_FOURCC_TRACK_EXTRAS_CHUNK: { + TRACE_(dmfile)(": track extra header chunk\n"); + IStream_Read (pStm, &tempXHeader, chunkSize, NULL); + break; + } + /* add other stuff (look at note below) */ + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[1] = %ld < ListSize[1] = %ld\n", ListCount[1], ListSize[1]); + } while (ListCount[1] < ListSize[1]); + FIXME(": loading tracks not supported yet\n"); + /* sigh... now comes track creation... currently I have some problems with implementing + this one because my test are contradicting: + - tracks are not loaded by loader (at least my dxdiag test with native dmime doesn't show it) + therefore i guess they're created with CoCreateInstance with CLSID specified in header and + IID_IDirectMusicTrack(8). Tracks are then probably passed to IDirectMusicSegment_Insert + (not quite sure, but behaviour complies with the one described in MSDN (about calling IDirectMusicTrack_Init) + - but on the other hand, track's stream implementation gets only chunk (look in MSDN for more info) + (tested with native dmime and builtin dmband and dmstyle) => this means that all info about track (header, extra header + UNFO, GUID and version are read by segment's stream... now, how the hell is all this info set on track?! + => I believe successful approach would be to create structure like this: + _DMUSIC_PRIVATE_TRACK_ENTRY { + DMUS_IO_TRACK_HEADER trkHeader; + DMUS_IO_TRACK_EXTRAS_HEADER trkXHeader; + WCHAR* name, ...; + GUID guidID; + DMUS_VERSION vVersion; + ... + IDirectMusicTrack* pTrack; + } DMUSIC_PRIVATE_TRACK_ENTRY; + and then load all stuff into it + => anyway, I'll try to implement it when I find some time again, but this note is here for anyone that wants to give it a try :) + */ + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (only DMTK expected; skipping)\n"); + liMove.QuadPart = chunkSize - sizeof(FOURCC); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + break; + } + default: { + TRACE_(dmfile)("(unexpected) non-RIFF chunk (skipping, but expect errors)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + default: { + TRACE_(dmfile)(": unknown (skipping)\n"); + liMove.QuadPart = chunkSize - sizeof(FOURCC); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + break; + } + } + TRACE_(dmfile)(": StreamCount = %ld < StreamSize = %ld\n", StreamCount, StreamSize); + } while (StreamCount < StreamSize); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = StreamSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + TRACE_(dmfile)(": reading finished\n"); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegmentObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSegmentObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSegmentObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSegmentObjectStream_QueryInterface, + IDirectMusicSegmentObjectStream_AddRef, + IDirectMusicSegmentObjectStream_Release, + IDirectMusicSegmentObjectStream_GetClassID, + IDirectMusicSegmentObjectStream_IsDirty, + IDirectMusicSegmentObjectStream_Load, + IDirectMusicSegmentObjectStream_Save, + IDirectMusicSegmentObjectStream_GetSizeMax +}; diff --git a/dlls/dmime/segmentstate.c b/dlls/dmime/segmentstate.c index 2e01ebbdc74..cd69dd111dc 100644 --- a/dlls/dmime/segmentstate.c +++ b/dlls/dmime/segmentstate.c @@ -25,18 +25,17 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicSegmentState8 IUnknown part follow: */ +/* IDirectMusicSegmentState8 IUnknown part: */ HRESULT WINAPI IDirectMusicSegmentState8Impl_QueryInterface (LPDIRECTMUSICSEGMENTSTATE8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicSegmentState8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicSegmentState) || - IsEqualGUID(riid, &IID_IDirectMusicSegmentState8)) - { + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IDirectMusicSegmentState) || + IsEqualIID(riid, &IID_IDirectMusicSegmentState8)) { IDirectMusicSegmentState8Impl_AddRef(iface); *ppobj = This; return S_OK; @@ -57,14 +56,13 @@ ULONG WINAPI IDirectMusicSegmentState8Impl_Release (LPDIRECTMUSICSEGMENTSTATE8 i ICOM_THIS(IDirectMusicSegmentState8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicSegmentState Interface part follow: */ +/* IDirectMusicSegmentState8 IDirectMusicSegmentState part: */ HRESULT WINAPI IDirectMusicSegmentState8Impl_GetRepeats (LPDIRECTMUSICSEGMENTSTATE8 iface, DWORD* pdwRepeats) { ICOM_THIS(IDirectMusicSegmentState8Impl,iface); @@ -110,7 +108,7 @@ HRESULT WINAPI IDirectMusicSegmentState8Impl_GetStartPoint (LPDIRECTMUSICSEGMENT return S_OK; } -/* IDirectMusicSegmentState8 Interface part follow: */ +/* IDirectMusicSegmentState8 IDirectMusicSegmentState8 part: */ HRESULT WINAPI IDirectMusicSegmentState8Impl_SetTrackConfig (LPDIRECTMUSICSEGMENTSTATE8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) { ICOM_THIS(IDirectMusicSegmentState8Impl,iface); @@ -147,8 +145,8 @@ ICOM_VTABLE(IDirectMusicSegmentState8) DirectMusicSegmentState8_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicSegmentState (LPCGUID lpcGUID, LPDIRECTMUSICSEGMENTSTATE8 *ppDMSeg, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicSegmentState) + || IsEqualIID (lpcGUID, &IID_IDirectMusicSegmentState8)) { FIXME("Not yet\n"); return E_NOINTERFACE; } diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c new file mode 100644 index 00000000000..771e88b8759 --- /dev/null +++ b/dlls/dmime/segtriggertrack.c @@ -0,0 +1,338 @@ +/* IDirectMusicSegTriggerTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicSegTriggerTrack implementation + */ +/* IDirectMusicSegTriggerTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicSegTriggerTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicSegTriggerTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSegTriggerTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSegTriggerTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSegTriggerTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSegTriggerTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicSegTriggerTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicSegTriggerTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicSegTriggerTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSegTriggerTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSegTriggerTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSegTriggerTrack_QueryInterface, + IDirectMusicSegTriggerTrack_AddRef, + IDirectMusicSegTriggerTrack_Release, + IDirectMusicSegTriggerTrack_Init, + IDirectMusicSegTriggerTrack_InitPlay, + IDirectMusicSegTriggerTrack_EndPlay, + IDirectMusicSegTriggerTrack_Play, + IDirectMusicSegTriggerTrack_GetParam, + IDirectMusicSegTriggerTrack_SetParam, + IDirectMusicSegTriggerTrack_IsParamSupported, + IDirectMusicSegTriggerTrack_AddNotificationType, + IDirectMusicSegTriggerTrack_RemoveNotificationType, + IDirectMusicSegTriggerTrack_Clone, + IDirectMusicSegTriggerTrack_PlayEx, + IDirectMusicSegTriggerTrack_GetParamEx, + IDirectMusicSegTriggerTrack_SetParamEx, + IDirectMusicSegTriggerTrack_Compose, + IDirectMusicSegTriggerTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSegTriggerTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSegTriggerTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicSegTriggerTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrackStream)); + track->pStream->lpVtbl = &DirectMusicSegTriggerTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicSegTriggerTrackStream implementation + */ +/* IDirectMusicSegTriggerTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSegTriggerTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSegTriggerTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSegTriggerTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSegTriggerTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSegTriggerTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSegTriggerTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSegTriggerTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSegTriggerTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSegTriggerTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSegTriggerTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSegTriggerTrackStream_QueryInterface, + IDirectMusicSegTriggerTrackStream_AddRef, + IDirectMusicSegTriggerTrackStream_Release, + IDirectMusicSegTriggerTrackStream_GetClassID, + IDirectMusicSegTriggerTrackStream_IsDirty, + IDirectMusicSegTriggerTrackStream_Load, + IDirectMusicSegTriggerTrackStream_Save, + IDirectMusicSegTriggerTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/seqtrack.c b/dlls/dmime/seqtrack.c new file mode 100644 index 00000000000..c78e433d854 --- /dev/null +++ b/dlls/dmime/seqtrack.c @@ -0,0 +1,338 @@ +/* IDirectMusicSeqTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicSeqTrack implementation + */ +/* IDirectMusicSeqTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicSeqTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicSeqTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSeqTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSeqTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSeqTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSeqTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicSeqTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicSeqTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicSeqTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicSeqTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSeqTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSeqTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSeqTrack_QueryInterface, + IDirectMusicSeqTrack_AddRef, + IDirectMusicSeqTrack_Release, + IDirectMusicSeqTrack_Init, + IDirectMusicSeqTrack_InitPlay, + IDirectMusicSeqTrack_EndPlay, + IDirectMusicSeqTrack_Play, + IDirectMusicSeqTrack_GetParam, + IDirectMusicSeqTrack_SetParam, + IDirectMusicSeqTrack_IsParamSupported, + IDirectMusicSeqTrack_AddNotificationType, + IDirectMusicSeqTrack_RemoveNotificationType, + IDirectMusicSeqTrack_Clone, + IDirectMusicSeqTrack_PlayEx, + IDirectMusicSeqTrack_GetParamEx, + IDirectMusicSeqTrack_SetParamEx, + IDirectMusicSeqTrack_Compose, + IDirectMusicSeqTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSeqTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSeqTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSeqTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicSeqTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSeqTrackStream)); + track->pStream->lpVtbl = &DirectMusicSeqTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicSeqTrackStream implementation + */ +/* IDirectMusicSeqTrackStream IUnknown part: */ +HRESULT WINAPI IDirectMusicSeqTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSeqTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSeqTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSeqTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSeqTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSeqTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSeqTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSeqTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicSeqTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSeqTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSeqTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSeqTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicSeqTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSeqTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSeqTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSeqTrackStream_QueryInterface, + IDirectMusicSeqTrackStream_AddRef, + IDirectMusicSeqTrackStream_Release, + IDirectMusicSeqTrackStream_GetClassID, + IDirectMusicSeqTrackStream_IsDirty, + IDirectMusicSeqTrackStream_Load, + IDirectMusicSeqTrackStream_Save, + IDirectMusicSeqTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/song.c b/dlls/dmime/song.c index d68950e186d..7235337e73f 100644 --- a/dlls/dmime/song.c +++ b/dlls/dmime/song.c @@ -25,20 +25,20 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicSong IUnknown parts follow: */ +/* IDirectMusicSong IUnknown part: */ HRESULT WINAPI IDirectMusicSongImpl_QueryInterface (LPDIRECTMUSICSONG iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicSongImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicSong)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicSong)) { IDirectMusicSongImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,14 +55,13 @@ ULONG WINAPI IDirectMusicSongImpl_Release (LPDIRECTMUSICSONG iface) ICOM_THIS(IDirectMusicSongImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicSong Interface follow: */ +/* IDirectMusicSong IDirectMusicSong part: */ HRESULT WINAPI IDirectMusicSongImpl_Compose (LPDIRECTMUSICSONG iface) { ICOM_THIS(IDirectMusicSongImpl,iface); @@ -144,12 +143,212 @@ ICOM_VTABLE(IDirectMusicSong) DirectMusicSong_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicSong (LPCGUID lpcGUID, LPDIRECTMUSICSONG *ppDMSng, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicSongImpl* dmsong; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicSong)) { + dmsong = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongImpl)); + if (NULL == dmsong) { + *ppDMSng = (LPDIRECTMUSICSONG) NULL; + return E_OUTOFMEMORY; + } + dmsong->lpVtbl = &DirectMusicSong_Vtbl; + dmsong->ref = 1; + *ppDMSng = (LPDIRECTMUSICSONG) dmsong; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicSongObject implementation + */ +/* IDirectMusicSongObject IUnknown part: */ +HRESULT WINAPI IDirectMusicSongObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicSongObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicSong)) { + IDirectMusicSong_AddRef ((LPDIRECTMUSICSONG)This->pSong); + *ppobj = (LPDIRECTMUSICSONG)This->pSong; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSongObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSongObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSongObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicSongObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSongObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSongObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicSongObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicSongObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSongObject_QueryInterface, + IDirectMusicSongObject_AddRef, + IDirectMusicSongObject_Release, + IDirectMusicSongObject_GetDescriptor, + IDirectMusicSongObject_SetDescriptor, + IDirectMusicSongObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSongObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSongObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicSongObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObjectStream)); + obj->pStream->lpVtbl = &DirectMusicSongObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicSong */ + DMUSIC_CreateDirectMusicSong (&IID_IDirectMusicSong, (LPDIRECTMUSICSONG*)&obj->pSong, NULL); + obj->pSong->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicSongObjectStream implementation + */ +/* IDirectMusicSongObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicSongObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSongObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSongObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSongObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSongObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSongObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSongObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSongObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicSongObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSongObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSongObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSongObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicSongObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSongObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSongObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSongObjectStream_QueryInterface, + IDirectMusicSongObjectStream_AddRef, + IDirectMusicSongObjectStream_Release, + IDirectMusicSongObjectStream_GetClassID, + IDirectMusicSongObjectStream_IsDirty, + IDirectMusicSongObjectStream_Load, + IDirectMusicSongObjectStream_Save, + IDirectMusicSongObjectStream_GetSizeMax +}; diff --git a/dlls/dmime/sysextrack.c b/dlls/dmime/sysextrack.c new file mode 100644 index 00000000000..d4202b6b949 --- /dev/null +++ b/dlls/dmime/sysextrack.c @@ -0,0 +1,337 @@ +/* IDirectMusicSysExTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicSysExTrack implementation + */ +/* IDirectMusicSysExTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicSysExTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicSysExTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSysExTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSysExTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSysExTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSysExTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicSysExTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicSysExTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicSysExTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicSysExTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicSysExTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSysExTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSysExTrack_QueryInterface, + IDirectMusicSysExTrack_AddRef, + IDirectMusicSysExTrack_Release, + IDirectMusicSysExTrack_Init, + IDirectMusicSysExTrack_InitPlay, + IDirectMusicSysExTrack_EndPlay, + IDirectMusicSysExTrack_Play, + IDirectMusicSysExTrack_GetParam, + IDirectMusicSysExTrack_SetParam, + IDirectMusicSysExTrack_IsParamSupported, + IDirectMusicSysExTrack_AddNotificationType, + IDirectMusicSysExTrack_RemoveNotificationType, + IDirectMusicSysExTrack_Clone, + IDirectMusicSysExTrack_PlayEx, + IDirectMusicSysExTrack_GetParamEx, + IDirectMusicSysExTrack_SetParamEx, + IDirectMusicSysExTrack_Compose, + IDirectMusicSysExTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicSysExTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSysExTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicSysExTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSysExTrackStream)); + track->pStream->lpVtbl = &DirectMusicSysExTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicSysExTrackStream implementation + */ +/* IDirectMusicSysExTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicSysExTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicSysExTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicSysExTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicSysExTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSysExTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicSysExTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicSysExTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicSysExTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicSysExTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicSysExTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicSysExTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSysExTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicSysExTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicSysExTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicSysExTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicSysExTrackStream_QueryInterface, + IDirectMusicSysExTrackStream_AddRef, + IDirectMusicSysExTrackStream_Release, + IDirectMusicSysExTrackStream_GetClassID, + IDirectMusicSysExTrackStream_IsDirty, + IDirectMusicSysExTrackStream_Load, + IDirectMusicSysExTrackStream_Save, + IDirectMusicSysExTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/tempotrack.c b/dlls/dmime/tempotrack.c new file mode 100644 index 00000000000..09e70839d0f --- /dev/null +++ b/dlls/dmime/tempotrack.c @@ -0,0 +1,342 @@ +/* IDirectMusicTempoTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicTempoTrack implementation + */ +/* IDirectMusicTempoTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicTempoTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicTempoTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicTempoTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicTempoTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicTempoTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicTempoTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicTempoTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_DisableTempo) + || IsEqualGUID (rguidType, &GUID_EnableTempo) + || IsEqualGUID (rguidType, &GUID_TempoParam)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicTempoTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicTempoTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicTempoTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicTempoTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTempoTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicTempoTrack_QueryInterface, + IDirectMusicTempoTrack_AddRef, + IDirectMusicTempoTrack_Release, + IDirectMusicTempoTrack_Init, + IDirectMusicTempoTrack_InitPlay, + IDirectMusicTempoTrack_EndPlay, + IDirectMusicTempoTrack_Play, + IDirectMusicTempoTrack_GetParam, + IDirectMusicTempoTrack_SetParam, + IDirectMusicTempoTrack_IsParamSupported, + IDirectMusicTempoTrack_AddNotificationType, + IDirectMusicTempoTrack_RemoveNotificationType, + IDirectMusicTempoTrack_Clone, + IDirectMusicTempoTrack_PlayEx, + IDirectMusicTempoTrack_GetParamEx, + IDirectMusicTempoTrack_SetParamEx, + IDirectMusicTempoTrack_Compose, + IDirectMusicTempoTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicTempoTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTempoTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicTempoTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTempoTrackStream)); + track->pStream->lpVtbl = &DirectMusicTempoTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicTempoTrackStream implementation + */ +/* IDirectMusicTempoTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicTempoTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicTempoTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicTempoTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicTempoTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicTempoTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicTempoTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicTempoTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicTempoTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicTempoTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicTempoTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicTempoTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicTempoTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicTempoTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicTempoTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicTempoTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicTempoTrackStream_QueryInterface, + IDirectMusicTempoTrackStream_AddRef, + IDirectMusicTempoTrackStream_Release, + IDirectMusicTempoTrackStream_GetClassID, + IDirectMusicTempoTrackStream_IsDirty, + IDirectMusicTempoTrackStream_Load, + IDirectMusicTempoTrackStream_Save, + IDirectMusicTempoTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/timesigtrack.c b/dlls/dmime/timesigtrack.c new file mode 100644 index 00000000000..9011013bce5 --- /dev/null +++ b/dlls/dmime/timesigtrack.c @@ -0,0 +1,341 @@ +/* IDirectMusicTimeSigTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicTimeSigTrack implementation + */ +/* IDirectMusicTimeSigTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicTimeSigTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicTimeSigTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicTimeSigTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicTimeSigTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicTimeSigTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicTimeSigTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicTimeSigTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_DisableTimeSig) + || IsEqualGUID (rguidType, &GUID_EnableTimeSig) + || IsEqualGUID (rguidType, &GUID_TimeSignature)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicTimeSigTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicTimeSigTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicTimeSigTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTimeSigTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicTimeSigTrack_QueryInterface, + IDirectMusicTimeSigTrack_AddRef, + IDirectMusicTimeSigTrack_Release, + IDirectMusicTimeSigTrack_Init, + IDirectMusicTimeSigTrack_InitPlay, + IDirectMusicTimeSigTrack_EndPlay, + IDirectMusicTimeSigTrack_Play, + IDirectMusicTimeSigTrack_GetParam, + IDirectMusicTimeSigTrack_SetParam, + IDirectMusicTimeSigTrack_IsParamSupported, + IDirectMusicTimeSigTrack_AddNotificationType, + IDirectMusicTimeSigTrack_RemoveNotificationType, + IDirectMusicTimeSigTrack_Clone, + IDirectMusicTimeSigTrack_PlayEx, + IDirectMusicTimeSigTrack_GetParamEx, + IDirectMusicTimeSigTrack_SetParamEx, + IDirectMusicTimeSigTrack_Compose, + IDirectMusicTimeSigTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicTimeSigTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicTimeSigTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTimeSigTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicTimeSigTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTimeSigTrackStream)); + track->pStream->lpVtbl = &DirectMusicTimeSigTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicTimeSigTrackStream implementation + */ +/* IDirectMusicTimeSigTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicTimeSigTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicTimeSigTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicTimeSigTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicTimeSigTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicTimeSigTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicTimeSigTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicTimeSigTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicTimeSigTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicTimeSigTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicTimeSigTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicTimeSigTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicTimeSigTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicTimeSigTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicTimeSigTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicTimeSigTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicTimeSigTrackStream_QueryInterface, + IDirectMusicTimeSigTrackStream_AddRef, + IDirectMusicTimeSigTrackStream_Release, + IDirectMusicTimeSigTrackStream_GetClassID, + IDirectMusicTimeSigTrackStream_IsDirty, + IDirectMusicTimeSigTrackStream_Load, + IDirectMusicTimeSigTrackStream_Save, + IDirectMusicTimeSigTrackStream_GetSizeMax +}; diff --git a/dlls/dmime/tool.c b/dlls/dmime/tool.c index 691d89362ab..99bb1ef652a 100644 --- a/dlls/dmime/tool.c +++ b/dlls/dmime/tool.c @@ -25,18 +25,17 @@ #include "dmime_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicTool8 IUnknown part follow: */ +/* IDirectMusicTool8 IUnknown part: */ HRESULT WINAPI IDirectMusicTool8Impl_QueryInterface (LPDIRECTMUSICTOOL8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicTool8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicTool) || - IsEqualGUID(riid, &IID_IDirectMusicTool8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTool) || + IsEqualIID (riid, &IID_IDirectMusicTool8)) { IDirectMusicTool8Impl_AddRef(iface); *ppobj = This; return S_OK; @@ -57,14 +56,13 @@ ULONG WINAPI IDirectMusicTool8Impl_Release (LPDIRECTMUSICTOOL8 iface) ICOM_THIS(IDirectMusicTool8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicTool Interface follow: */ +/* IDirectMusicTool8 IDirectMusicTool part: */ HRESULT WINAPI IDirectMusicTool8Impl_Init (LPDIRECTMUSICTOOL8 iface, IDirectMusicGraph* pGraph) { ICOM_THIS(IDirectMusicTool8Impl,iface); @@ -119,7 +117,7 @@ HRESULT WINAPI IDirectMusicTool8Impl_Flush (LPDIRECTMUSICTOOL8 iface, IDirectMus return S_OK; } -/* IDirectMusicTool8 Interface part follow: */ +/* IDirectMusicTool8 IDirectMusicTool8 part: */ HRESULT WINAPI IDirectMusicTool8Impl_Clone (LPDIRECTMUSICTOOL8 iface, IDirectMusicTool** ppTool) { ICOM_THIS(IDirectMusicTool8Impl,iface); @@ -147,8 +145,7 @@ ICOM_VTABLE(IDirectMusicTool8) DirectMusicTool8_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicTool (LPCGUID lpcGUID, LPDIRECTMUSICTOOL8 *ppDMTool, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicComposer)) { FIXME("Not yet\n"); return E_NOINTERFACE; } diff --git a/dlls/dmime/track.c b/dlls/dmime/track.c deleted file mode 100644 index 5f66a4818a7..00000000000 --- a/dlls/dmime/track.c +++ /dev/null @@ -1,237 +0,0 @@ -/* IDirectMusicTrack8 Implementation - * - * Copyright (C) 2003 Rok Mandeljc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "wingdi.h" -#include "wine/debug.h" - -#include "dmime_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/* IDirectMusicTrack8 IUnknown part follow: */ -HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicTrack) || - IsEqualGUID(riid, &IID_IDirectMusicTrack8)) - { - IDirectMusicTrack8Impl_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); - return E_NOINTERFACE; -} - -ULONG WINAPI IDirectMusicTrack8Impl_AddRef (LPDIRECTMUSICTRACK8 iface) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); -} - -ULONG WINAPI IDirectMusicTrack8Impl_Release (LPDIRECTMUSICTRACK8 iface) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* IDirectMusicTrack Interface part follow: */ -HRESULT WINAPI IDirectMusicTrack8Impl_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p): stub\n", This, pSegment); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p): stub\n", This, pStateData); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidType)); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); - - return S_OK; -} - -/* IDirectMusicTrack8 Interface part follow: */ -HRESULT WINAPI IDirectMusicTrack8Impl_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); - - return S_OK; -} - -HRESULT WINAPI IDirectMusicTrack8Impl_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) -{ - ICOM_THIS(IDirectMusicTrack8Impl,iface); - - FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); - - return S_OK; -} - -ICOM_VTABLE(IDirectMusicTrack8) DirectMusicTrack8_Vtbl = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - IDirectMusicTrack8Impl_QueryInterface, - IDirectMusicTrack8Impl_AddRef, - IDirectMusicTrack8Impl_Release, - IDirectMusicTrack8Impl_Init, - IDirectMusicTrack8Impl_InitPlay, - IDirectMusicTrack8Impl_EndPlay, - IDirectMusicTrack8Impl_Play, - IDirectMusicTrack8Impl_GetParam, - IDirectMusicTrack8Impl_SetParam, - IDirectMusicTrack8Impl_IsParamSupported, - IDirectMusicTrack8Impl_AddNotificationType, - IDirectMusicTrack8Impl_RemoveNotificationType, - IDirectMusicTrack8Impl_Clone, - IDirectMusicTrack8Impl_PlayEx, - IDirectMusicTrack8Impl_GetParamEx, - IDirectMusicTrack8Impl_SetParamEx, - IDirectMusicTrack8Impl_Compose, - IDirectMusicTrack8Impl_Join -}; - -/* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppDMTrack, LPUNKNOWN pUnkOuter) -{ - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; - } - WARN("No interface found\n"); - - return E_NOINTERFACE; -} diff --git a/dlls/dmime/wavetrack.c b/dlls/dmime/wavetrack.c new file mode 100644 index 00000000000..50ec4b5a93a --- /dev/null +++ b/dlls/dmime/wavetrack.c @@ -0,0 +1,343 @@ +/* IDirectMusicWaveTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmime_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmime); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicWaveTrack implementation + */ +/* IDirectMusicWaveTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicWaveTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicWaveTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicWaveTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicWaveTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicWaveTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicWaveTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicWaveTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_Disable_Auto_Download) + || IsEqualGUID (rguidType, &GUID_Download) + || IsEqualGUID (rguidType, &GUID_DownloadToAudioPath) + || IsEqualGUID (rguidType, &GUID_Enable_Auto_Download)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicWaveTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicWaveTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicWaveTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicWaveTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicWaveTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicWaveTrack_QueryInterface, + IDirectMusicWaveTrack_AddRef, + IDirectMusicWaveTrack_Release, + IDirectMusicWaveTrack_Init, + IDirectMusicWaveTrack_InitPlay, + IDirectMusicWaveTrack_EndPlay, + IDirectMusicWaveTrack_Play, + IDirectMusicWaveTrack_GetParam, + IDirectMusicWaveTrack_SetParam, + IDirectMusicWaveTrack_IsParamSupported, + IDirectMusicWaveTrack_AddNotificationType, + IDirectMusicWaveTrack_RemoveNotificationType, + IDirectMusicWaveTrack_Clone, + IDirectMusicWaveTrack_PlayEx, + IDirectMusicWaveTrack_GetParamEx, + IDirectMusicWaveTrack_SetParamEx, + IDirectMusicWaveTrack_Compose, + IDirectMusicWaveTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicWaveTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicWaveTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicWaveTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveTrackStream)); + track->pStream->lpVtbl = &DirectMusicWaveTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicWaveTrackStream implementation + */ +/* IDirectMusicWaveTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicWaveTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicWaveTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicWaveTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicWaveTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicWaveTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicWaveTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicWaveTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicWaveTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicWaveTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicWaveTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicWaveTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicWaveTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicWaveTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicWaveTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicWaveTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicWaveTrackStream_QueryInterface, + IDirectMusicWaveTrackStream_AddRef, + IDirectMusicWaveTrackStream_Release, + IDirectMusicWaveTrackStream_GetClassID, + IDirectMusicWaveTrackStream_IsDirty, + IDirectMusicWaveTrackStream_Load, + IDirectMusicWaveTrackStream_Save, + IDirectMusicWaveTrackStream_GetSizeMax +}; diff --git a/dlls/dmloader/Makefile.in b/dlls/dmloader/Makefile.in index 6208f195902..87d2dfc916b 100644 --- a/dlls/dmloader/Makefile.in +++ b/dlls/dmloader/Makefile.in @@ -12,8 +12,8 @@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ container.c \ dmloader_main.c \ - getloader.c \ loader.c \ + loaderstream.c \ regsvr.c RC_SRCS = version.rc diff --git a/dlls/dmloader/container.c b/dlls/dmloader/container.c index 37867abcd9d..b221bce1755 100644 --- a/dlls/dmloader/container.c +++ b/dlls/dmloader/container.c @@ -25,16 +25,15 @@ #include "dmloader_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmloader); /* IDirectMusicContainer IUnknown parts follow: */ HRESULT WINAPI IDirectMusicContainerImpl_QueryInterface (LPDIRECTMUSICCONTAINER iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicContainerImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicContainer)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicContainer)) { IDirectMusicContainerImpl_AddRef(iface); *ppobj = This; return S_OK; @@ -55,8 +54,7 @@ ULONG WINAPI IDirectMusicContainerImpl_Release (LPDIRECTMUSICCONTAINER iface) ICOM_THIS(IDirectMusicContainerImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -84,12 +82,213 @@ ICOM_VTABLE(IDirectMusicContainer) DirectMusicContainer_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicContainer (LPCGUID lpcGUID, LPDIRECTMUSICCONTAINER *ppDMCon, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicContainer)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicContainerImpl* dmcon; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicBand)) { + dmcon = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerImpl)); + if (NULL == dmcon) { + *ppDMCon = (LPDIRECTMUSICCONTAINER) NULL; + return E_OUTOFMEMORY; + } + dmcon->lpVtbl = &DirectMusicContainer_Vtbl; + dmcon->ref = 1; + *ppDMCon = (LPDIRECTMUSICCONTAINER) dmcon; + return S_OK; } WARN("No interface found\n"); return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicContainerObject implementation + */ +/* IDirectMusicContainerObject IUnknown part: */ +HRESULT WINAPI IDirectMusicContainerObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicContainerObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicContainer)) { + IDirectMusicContainer_AddRef ((LPDIRECTMUSICCONTAINER)This->pContainer); + *ppobj = (LPDIRECTMUSICCONTAINER)This->pContainer; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicContainerObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicContainerObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicContainerObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicContainerObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicContainerObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicContainerObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicContainerObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicContainerObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicContainerObject_QueryInterface, + IDirectMusicContainerObject_AddRef, + IDirectMusicContainerObject_Release, + IDirectMusicContainerObject_GetDescriptor, + IDirectMusicContainerObject_SetDescriptor, + IDirectMusicContainerObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicContainerObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicContainerObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicContainerObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerObjectStream)); + obj->pStream->lpVtbl = &DirectMusicContainerObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicContainer */ + DMUSIC_CreateDirectMusicContainer (&IID_IDirectMusicContainer, (LPDIRECTMUSICCONTAINER*)&obj->pContainer, NULL); + obj->pContainer->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicContainerObjectStream implementation + */ +/* IDirectMusicContainerObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicContainerObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicContainerObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicContainerObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicContainerObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicContainerObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicContainerObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicContainerObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicContainerObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicContainerObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicContainerObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicContainerObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicContainerObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicContainerObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicContainerObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicContainerObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicContainerObjectStream_QueryInterface, + IDirectMusicContainerObjectStream_AddRef, + IDirectMusicContainerObjectStream_Release, + IDirectMusicContainerObjectStream_GetClassID, + IDirectMusicContainerObjectStream_IsDirty, + IDirectMusicContainerObjectStream_Load, + IDirectMusicContainerObjectStream_Save, + IDirectMusicContainerObjectStream_GetSizeMax +}; diff --git a/dlls/dmloader/dmloader_main.c b/dlls/dmloader/dmloader_main.c index ec9351dd615..e95d12a34f6 100644 --- a/dlls/dmloader/dmloader_main.c +++ b/dlls/dmloader/dmloader_main.c @@ -19,15 +19,8 @@ #include "dmloader_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmloader); - -/****************************************************************** - * DirectMusicLoader ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMLOADCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicLoader ClassFactory + */ +static HRESULT WINAPI LoaderCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,26 +39,26 @@ static HRESULT WINAPI DMLOADCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,L return E_NOINTERFACE; } -static ULONG WINAPI DMLOADCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI LoaderCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMLOADCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI LoaderCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMLOADCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI LoaderCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (&IID_IDirectMusicLoader, riid) || - IsEqualGUID (&IID_IDirectMusicLoader8, riid)) { + if (IsEqualIID (&IID_IDirectMusicLoader, riid) || + IsEqualIID (&IID_IDirectMusicLoader8, riid)) { return DMUSIC_CreateDirectMusicLoader(riid, (LPDIRECTMUSICLOADER8*) ppobj, pOuter); } @@ -70,23 +66,80 @@ static HRESULT WINAPI DMLOADCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pO return E_NOINTERFACE; } -static HRESULT WINAPI DMLOADCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI LoaderCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMLOADCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) LoaderCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMLOADCF_QueryInterface, - DMLOADCF_AddRef, - DMLOADCF_Release, - DMLOADCF_CreateInstance, - DMLOADCF_LockServer + LoaderCF_QueryInterface, + LoaderCF_AddRef, + LoaderCF_Release, + LoaderCF_CreateInstance, + LoaderCF_LockServer }; -static IClassFactoryImpl DMLOADER_CF = {&DMLOADCF_Vtbl, 1 }; +static IClassFactoryImpl Loader_CF = {&LoaderCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicContainer ClassFactory + */ +static HRESULT WINAPI ContainerCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ContainerCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ContainerCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ContainerCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicContainer)) { + return DMUSIC_CreateDirectMusicContainer (riid, (LPDIRECTMUSICCONTAINER*) ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicContainerObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ContainerCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ContainerCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ContainerCF_QueryInterface, + ContainerCF_AddRef, + ContainerCF_Release, + ContainerCF_CreateInstance, + ContainerCF_LockServer +}; + +static IClassFactoryImpl Container_CF = {&ContainerCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -130,11 +183,16 @@ HRESULT WINAPI DMLOADER_DllCanUnloadNow(void) HRESULT WINAPI DMLOADER_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMLOADER_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Loader_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Container_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmloader/dmloader_private.h b/dlls/dmloader/dmloader_private.h index 3014d7dc8fc..8c264a36464 100644 --- a/dlls/dmloader/dmloader_private.h +++ b/dlls/dmloader/dmloader_private.h @@ -31,19 +31,46 @@ #include "dmusicf.h" #include "dsound.h" + +typedef struct _DMUS_PRIVATE_CACHE_ENTRY +{ + GUID guidObject; + WCHAR pwzFileName[MAX_PATH]; + IDirectMusicObject* pObject; +} DMUS_PRIVATE_CACHE_ENTRY, *LPDMUS_PRIVATE_CACHE_ENTRY; + +typedef struct _DMUS_PRIVATE_OBJECT_REFERENCE DMUS_PRIVATE_OBJECT_REFERENCE; + +struct _DMUS_PRIVATE_OBJECT_REFERENCE { + DMUS_PRIVATE_OBJECT_REFERENCE* pNext; + WCHAR pwsFileName[MAX_PATH]; + GUID guidObject; + IDirectMusicObject* pObject; +}; + /***************************************************************************** * Interfaces */ typedef struct IDirectMusicLoader8Impl IDirectMusicLoader8Impl; typedef struct IDirectMusicContainerImpl IDirectMusicContainerImpl; -typedef struct IDirectMusicGetLoaderImpl IDirectMusicGetLoaderImpl; + +typedef struct IDirectMusicContainerObject IDirectMusicContainerObject; +typedef struct IDirectMusicContainerObjectStream IDirectMusicContainerObjectStream; + +typedef struct ILoaderStream ILoaderStream; /***************************************************************************** * Predeclare the interface implementation structures */ extern ICOM_VTABLE(IDirectMusicLoader8) DirectMusicLoader8_Vtbl; extern ICOM_VTABLE(IDirectMusicContainer) DirectMusicContainer_Vtbl; -extern ICOM_VTABLE(IDirectMusicGetLoader) DirectMusicGetLoader_Vtbl; + +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicContainerObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicContainerObjectStream_Vtbl; + +extern ICOM_VTABLE(IUnknown) LoaderStream_Unknown_Vtbl; +extern ICOM_VTABLE(IStream) LoaderStream_Stream_Vtbl; +extern ICOM_VTABLE(IDirectMusicGetLoader) LoaderStream_GetLoader_Vtbl; /***************************************************************************** * ClassFactory @@ -56,10 +83,10 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoader (LPCGUID lpcGUID, LPDIRECTM * return always an IDirectMusicContainerImpl */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainer (LPCGUID lpcGUID, LPDIRECTMUSICCONTAINER *ppDMCon, LPUNKNOWN pUnkOuter); -/* can support IID_IDirectMusicGetLoader - * return always an IDirectMusicGetLoaderImpl - */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicGetLoader (LPCGUID lpcGUID, LPDIRECTMUSICGETLOADER *ppDMGetLoad, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateLoaderStream (LPSTREAM *ppStream); /***************************************************************************** * IDirectMusicLoader8Impl implementation structure @@ -71,8 +98,11 @@ struct IDirectMusicLoader8Impl DWORD ref; /* IDirectMusicLoaderImpl fields */ - WCHAR wzSearchPath[MAX_PATH]; - /* IDirectMusicLoader8Impl fields */ + WCHAR wzSearchPath[MAX_PATH]; + + /* simple cache */ + LPDMUS_PRIVATE_CACHE_ENTRY pCache; /* cache entries */ + DWORD dwCacheSize; /* nr. of entries */ }; /* IUnknown: */ @@ -104,6 +134,7 @@ struct IDirectMusicContainerImpl DWORD ref; /* IDirectMusicContainerImpl fields */ + IDirectMusicContainerObject* pObject; }; /* IUnknown: */ @@ -113,23 +144,94 @@ extern ULONG WINAPI IDirectMusicContainerImpl_Release (LPDIRECTMUSICCONTAINER /* IDirectMusicContainer: */ extern HRESULT WINAPI IDirectMusicContainerImpl_EnumObject (LPDIRECTMUSICCONTAINER iface, REFGUID rguidClass, DWORD dwIndex, LPDMUS_OBJECTDESC pDesc, WCHAR* pwszAlias); + /***************************************************************************** - * IDirectMusicGetLoaderImpl implementation structure + * IDirectMusicContainerObject implementation structure */ -struct IDirectMusicGetLoaderImpl +struct IDirectMusicContainerObject { /* IUnknown fields */ - ICOM_VFIELD(IDirectMusicGetLoader); + ICOM_VFIELD(IDirectMusicObject); DWORD ref; - /* IDirectMusicGetLoaderImpl fields */ + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicContainerObjectStream* pStream; + IDirectMusicContainerImpl* pContainer; }; /* IUnknown: */ -extern HRESULT WINAPI IDirectMusicGetLoaderImpl_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, LPVOID *ppobj); -extern ULONG WINAPI IDirectMusicGetLoaderImpl_AddRef (LPDIRECTMUSICGETLOADER iface); -extern ULONG WINAPI IDirectMusicGetLoaderImpl_Release (LPDIRECTMUSICGETLOADER iface); +extern HRESULT WINAPI IDirectMusicContainerObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicContainerObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicContainerObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicContainerObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicContainerObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicContainerObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicContainerObjectStream implementation structure + */ +struct IDirectMusicContainerObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicContainerObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicContainerObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicContainerObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicContainerObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicContainerObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicContainerObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicContainerObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicContainerObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicContainerObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * ILoaderStream implementation structure + */ +struct ILoaderStream +{ + /* IUnknown fields */ + ICOM_VTABLE(IStream) *StreamVtbl; + ICOM_VTABLE(IDirectMusicGetLoader) *GetLoaderVtbl; + DWORD ref; + + /* ILoaderStream fields */ + IDirectMusicLoader8Impl* pLoader; + HANDLE hFile; + WCHAR wzFileName[MAX_PATH]; /* for clone */ +}; + +/* Custom: */ +extern HRESULT WINAPI ILoaderStream_Attach (ILoaderStream* iface, LPCWSTR wzFile, IDirectMusicLoader *pLoader); +extern void WINAPI ILoaderStream_Detach (ILoaderStream* iface); /* IDirectMusicGetLoader: */ -extern HRESULT WINAPI IDirectMusicGetLoaderImpl_GetLoader (LPDIRECTMUSICGETLOADER iface, IDirectMusicLoader** ppLoader); +extern HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj); +extern ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface); +extern ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_Release (LPDIRECTMUSICGETLOADER iface); +extern HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_GetLoader (LPDIRECTMUSICGETLOADER iface, IDirectMusicLoader **ppLoader); +/* IStream: */ +extern HRESULT WINAPI ILoaderStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj); +extern ULONG WINAPI ILoaderStream_IStream_AddRef (LPSTREAM iface); +extern ULONG WINAPI ILoaderStream_IStream_Release (LPSTREAM iface);extern HRESULT WINAPI ILoaderStream_IStream_Read (IStream* iface, void* pv, ULONG cb, ULONG* pcbRead); +extern HRESULT WINAPI ILoaderStream_IStream_Write (LPSTREAM iface, const void* pv, ULONG cb, ULONG* pcbWritten); +extern HRESULT WINAPI ILoaderStream_IStream_Seek (LPSTREAM iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition); +extern HRESULT WINAPI ILoaderStream_IStream_SetSize (LPSTREAM iface, ULARGE_INTEGER libNewSize); +extern HRESULT WINAPI ILoaderStream_IStream_CopyTo (LPSTREAM iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten); +extern HRESULT WINAPI ILoaderStream_IStream_Commit (LPSTREAM iface, DWORD grfCommitFlags); +extern HRESULT WINAPI ILoaderStream_IStream_Revert (LPSTREAM iface); +extern HRESULT WINAPI ILoaderStream_IStream_LockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); +extern HRESULT WINAPI ILoaderStream_IStream_UnlockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); +extern HRESULT WINAPI ILoaderStream_IStream_Stat (LPSTREAM iface, STATSTG* pstatstg, DWORD grfStatFlag); +extern HRESULT WINAPI ILoaderStream_IStream_Clone (LPSTREAM iface, IStream** ppstm); #endif /* __WINE_DMLOADER_PRIVATE_H */ diff --git a/dlls/dmloader/getloader.c b/dlls/dmloader/getloader.c deleted file mode 100644 index 5f34a23695a..00000000000 --- a/dlls/dmloader/getloader.c +++ /dev/null @@ -1,96 +0,0 @@ -/* IDirectMusicGetLoader Implementation - * - * Copyright (C) 2003 Rok Mandeljc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "wingdi.h" -#include "wine/debug.h" -#include "wine/unicode.h" - -#include "dmloader_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/* IDirectMusicGetLoader IUnknown parts follow: */ -HRESULT WINAPI IDirectMusicGetLoaderImpl_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, LPVOID *ppobj) -{ - ICOM_THIS(IDirectMusicGetLoaderImpl,iface); - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicGetLoader)) - { - IDirectMusicGetLoaderImpl_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); - return E_NOINTERFACE; -} - -ULONG WINAPI IDirectMusicGetLoaderImpl_AddRef (LPDIRECTMUSICGETLOADER iface) -{ - ICOM_THIS(IDirectMusicGetLoaderImpl,iface); - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); -} - -ULONG WINAPI IDirectMusicGetLoaderImpl_Release (LPDIRECTMUSICGETLOADER iface) -{ - ICOM_THIS(IDirectMusicGetLoaderImpl,iface); - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* IDirectMusicGetLoader Interface follow: */ -HRESULT WINAPI IDirectMusicGetLoaderImpl_GetLoader (LPDIRECTMUSICGETLOADER iface, IDirectMusicLoader** ppLoader) -{ - ICOM_THIS(IDirectMusicGetLoaderImpl,iface); - - FIXME("(%p, %p): stub\n", This, ppLoader); - - return S_OK; -} - -ICOM_VTABLE(IDirectMusicGetLoader) DirectMusicGetLoader_Vtbl = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - IDirectMusicGetLoaderImpl_QueryInterface, - IDirectMusicGetLoaderImpl_AddRef, - IDirectMusicGetLoaderImpl_Release, - IDirectMusicGetLoaderImpl_GetLoader -}; - -/* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicGetLoader (LPCGUID lpcGUID, LPDIRECTMUSICGETLOADER *ppDMGetLoad, LPUNKNOWN pUnkOuter) -{ - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicGetLoader)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; - } - WARN("No interface found\n"); - - return E_NOINTERFACE; -} diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c index 7132b03f6f8..1c5a60e87c1 100644 --- a/dlls/dmloader/loader.c +++ b/dlls/dmloader/loader.c @@ -23,24 +23,27 @@ #include "wingdi.h" #include "wine/debug.h" #include "wine/unicode.h" +#include "winreg.h" #include "dmloader_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmloader); -/* IDirectMusicLoader8 IUnknown part follow: */ +HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]); + +/* IDirectMusicLoader8 IUnknown part: */ HRESULT WINAPI IDirectMusicLoader8Impl_QueryInterface (LPDIRECTMUSICLOADER8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicLoader8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicLoader) || - IsEqualGUID(riid, &IID_IDirectMusicLoader8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicLoader) || + IsEqualIID (riid, &IID_IDirectMusicLoader8)) { IDirectMusicLoader8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -57,27 +60,147 @@ ULONG WINAPI IDirectMusicLoader8Impl_Release (LPDIRECTMUSICLOADER8 iface) ICOM_THIS(IDirectMusicLoader8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicLoader Interface part follow: */ +/* IDirectMusicLoader8 IDirectMusicLoader part: */ HRESULT WINAPI IDirectMusicLoader8Impl_GetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc, REFIID riid, LPVOID* ppv) { + IDirectMusicObject* pObject; + DMUS_OBJECTDESC desc; ICOM_THIS(IDirectMusicLoader8Impl,iface); - - FIXME("(%p, %p, %s, %p): stub\n", This, pDesc, debugstr_guid(riid), ppv); + int i; + HRESULT result; - if (IsEqualGUID(riid, &IID_IDirectMusicScript)) { - IDirectMusicScript* script; - CoCreateInstance (&CLSID_DirectMusicScript, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicScript, (void**)&script); - *ppv = script; + TRACE("(%p, %p, %s, %p)\n", This, pDesc, debugstr_guid(riid), ppv); + TRACE(": looking up cache"); + /* first, check if requested object is already in cache (check by name and GUID) */ + for (i = 0; i < This->dwCacheSize; i++) { + if (pDesc->dwValidData & DMUS_OBJ_OBJECT) { + if (IsEqualGUID (&pDesc->guidObject, &This->pCache[i].guidObject)) { + TRACE(": object already exist in cache (found by GUID)\n"); + if (This->pCache[i].pObject) { + return IDirectMusicObject_QueryInterface (This->pCache[i].pObject, riid, ppv); + } + } + } else if (pDesc->dwValidData & DMUS_OBJ_FILENAME) { + if (This->pCache[i].pwzFileName && !strncmpW(pDesc->wszFileName, This->pCache[i].pwzFileName, MAX_PATH)) { + TRACE(": object already exist in cache (found by file name)\n"); + if (This->pCache[i].pObject) { + return IDirectMusicObject_QueryInterface (This->pCache[i].pObject, riid, ppv); + } + } + } } - return DS_OK; + /* object doesn't exist in cache... guess we'll have to load it */ + TRACE(": object does not exist in cache\n"); + result = CoCreateInstance (&pDesc->guidClass, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicObject, (LPVOID*)&pObject); + if (FAILED(result)) return result; + if (pDesc->dwValidData & DMUS_OBJ_FILENAME) { + /* load object from file */ + WCHAR wzFileName[MAX_PATH]; + ILoaderStream* pStream; + IPersistStream *pPersistStream = NULL; + /* if it's full path, don't add search directory path, otherwise do */ + if (pDesc->dwValidData & DMUS_OBJ_FULLPATH) { + lstrcpyW( wzFileName, pDesc->wszFileName ); + } else { + WCHAR *p; + lstrcpyW( wzFileName, This->wzSearchPath ); + p = wzFileName + lstrlenW(wzFileName); + if (p > wzFileName && p[-1] != '\\') *p++ = '\\'; + lstrcpyW( p, pDesc->wszFileName ); + } + TRACE(": loading from file (%s)\n", debugstr_w(wzFileName)); + + result = DMUSIC_CreateLoaderStream ((LPSTREAM*)&pStream); + if (FAILED(result)) return result; + + result = ILoaderStream_Attach (pStream, wzFileName, (LPDIRECTMUSICLOADER)iface); + if (FAILED(result)) return result; + + result = IDirectMusicObject_QueryInterface (pObject, &IID_IPersistStream, (LPVOID*)&pPersistStream); + if (FAILED(result)) return result; + + result = IPersistStream_Load (pPersistStream, (LPSTREAM)pStream); + if (FAILED(result)) return result; + + ILoaderStream_IStream_Release ((LPSTREAM)pStream); + IPersistStream_Release (pPersistStream); + } else if (pDesc->dwValidData & DMUS_OBJ_STREAM) { + /* load object from stream */ + IStream* pClonedStream = NULL; + IPersistStream* pPersistStream = NULL; + + TRACE(": loading from stream\n"); + result = IDirectMusicObject_QueryInterface (pObject, &IID_IPersistStream, (LPVOID*)&pPersistStream); + if (FAILED(result)) { + TRACE("couln\'t get IPersistStream\n"); + return result; + } + + result = IStream_Clone (pDesc->pStream, &pClonedStream); + if (FAILED(result)) { + TRACE("failed to clone\n"); + return result; + } + + result = IPersistStream_Load (pPersistStream, pClonedStream); + if (FAILED(result)) { + TRACE("failed to load\n"); + return result; + } + + IPersistStream_Release (pPersistStream); + IStream_Release (pClonedStream); + } else if (pDesc->dwValidData & DMUS_OBJ_OBJECT) { + /* load object by GUID */ + TRACE(": loading by GUID (only default DLS supported)\n"); + if (IsEqualGUID (&pDesc->guidObject, &GUID_DefaultGMCollection)) { + /* great idea: let's just change dwValid and wszFileName fields and then call ourselves again :D */ + pDesc->dwValidData = DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH; + if (FAILED(DMUSIC_GetDefaultGMPath (pDesc->wszFileName))) + return E_FAIL; + return IDirectMusicLoader8Impl_GetObject (iface, pDesc, riid, ppv); + } else { + return E_FAIL; + } + } else { + /* nowhere to load from */ + FIXME(": unknown/unsupported way of loading\n"); + return E_FAIL; + } + + memset((LPVOID)&desc, 0, sizeof(desc)); + desc.dwSize = sizeof (DMUS_OBJECTDESC); + IDirectMusicObject_GetDescriptor (pObject, &desc); + + /* tests with native dlls show that descriptor, which is recieved by GetDescriptor doesn't contain filepath + therefore we must copy it from input description */ + if (pDesc->dwValidData & DMUS_OBJ_FILENAME || desc.dwValidData & DMUS_OBJ_OBJECT) { + DMUS_PRIVATE_CACHE_ENTRY CacheEntry; + This->dwCacheSize++; /* increase size of cache for one entry */ + This->pCache = HeapReAlloc (GetProcessHeap (), 0, This->pCache, sizeof(DMUS_PRIVATE_CACHE_ENTRY) * This->dwCacheSize); + if (desc.dwValidData & DMUS_OBJ_OBJECT) + CacheEntry.guidObject = desc.guidObject; + if (pDesc->dwValidData & DMUS_OBJ_FILENAME) + strncpyW (CacheEntry.pwzFileName, pDesc->wszFileName, MAX_PATH); + CacheEntry.pObject = pObject; + IDirectMusicObject_AddRef (pObject); /* MSDN says that we should */ + This->pCache[This->dwCacheSize - 1] = CacheEntry; /* fill in one backward, as list is zero based */ + TRACE(": filled in cache entry\n"); + } + + TRACE(": nr. of entries = %ld\n", This->dwCacheSize); + for (i = 0; i < This->dwCacheSize; i++) { + TRACE(": cache entry [%i]: GUID = %s, file name = %s, object = %p\n", i, debugstr_guid(&This->pCache[i].guidObject), debugstr_w(This->pCache[i].pwzFileName), This->pCache[i].pObject); + } + + return IDirectMusicObject_QueryInterface (pObject, riid, ppv); } HRESULT WINAPI IDirectMusicLoader8Impl_SetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc) @@ -93,13 +216,13 @@ HRESULT WINAPI IDirectMusicLoader8Impl_SetSearchDirectory (LPDIRECTMUSICLOADER8 { ICOM_THIS(IDirectMusicLoader8Impl,iface); - FIXME("(%p, %s, %p, %d): to check\n", This, debugstr_guid(rguidClass), pwzPath, fClear); - - if (0 == strncmpW(This->wzSearchPath, pwzPath, MAX_PATH)) { + TRACE("(%p, %s, %p, %d)\n", This, debugstr_guid(rguidClass), pwzPath, fClear); + if (0 == strncmpW(This->wzSearchPath, pwzPath, MAX_PATH)) { return S_FALSE; } strncpyW(This->wzSearchPath, pwzPath, MAX_PATH); - return DS_OK; + + return S_OK; } HRESULT WINAPI IDirectMusicLoader8Impl_ScanDirectory (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, WCHAR* pwzFileExtension, WCHAR* pwzScanFileName) @@ -180,57 +303,16 @@ HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8 void** ppObject) { ICOM_THIS(IDirectMusicLoader8Impl,iface); - - FIXME("(%p, %s, %s, %s, %p): stub\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject); + DMUS_OBJECTDESC ObjDesc; - if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicAudioPathConfig)) { - FIXME("wanted 'aud'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicBand)) { - FIXME("wanted 'bnd'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicContainer)) { - FIXME("wanted 'con'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicCollection)) { - FIXME("wanted 'dls'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicChordMap)) { - FIXME("wanted 'cdm'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSegment)) { - FIXME("wanted 'sgt'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicScript)) { - FIXME("wanted 'spt'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSong)) { - FIXME("wanted 'sng'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicStyle)) { - FIXME("wanted 'sty'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicSegment)) { - FIXME("wanted 'tpl'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectMusicGraph)) { - FIXME("wanted 'tgr'\n"); - } else if (IsEqualGUID(rguidClassID, &CLSID_DirectSoundWave)) { - FIXME("wanted 'wav'\n"); - } - - if (IsEqualGUID(iidInterfaceID, &IID_IDirectMusicSegment) || - IsEqualGUID(iidInterfaceID, &IID_IDirectMusicSegment8)) { - IDirectMusicSegment8* segment; - CoCreateInstance (&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSegment8, (void**)&segment); - *ppObject = segment; - return S_OK; - } else if (IsEqualGUID(iidInterfaceID, &IID_IDirectMusicContainer)) { - IDirectMusicContainer* container; - CoCreateInstance (&CLSID_DirectMusicContainer, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicContainer, (void**)&container); - *ppObject = container; - return S_OK; - } else if (IsEqualGUID(iidInterfaceID, &IID_IDirectMusicScript)) { - IDirectMusicScript* script; - CoCreateInstance (&CLSID_DirectMusicScript, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicScript, (void**)&script); - *ppObject = script; - return S_OK; - } else { - FIXME("bad iid\n"); - } + TRACE("(%p, %s, %s, %s, %p): wrapping to IDirectMusicLoader8Impl_GetObject\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject); - /** for now alway return not supported for avoiding futur crash */ - return DMUS_E_LOADER_FORMATNOTSUPPORTED; + ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC); + ObjDesc.dwValidData = DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH | DMUS_OBJ_CLASS; /* I believe I've read somewhere in MSDN that this function requires either full path or relative path */ + ObjDesc.guidClass = *rguidClassID; + strncpyW (ObjDesc.wszFileName, pwzFilePath, MAX_PATH); + + return IDirectMusicLoader8Impl_GetObject (iface, &ObjDesc, iidInterfaceID, ppObject); } ICOM_VTABLE(IDirectMusicLoader8) DirectMusicLoader8_Vtbl = @@ -259,9 +341,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoader (LPCGUID lpcGUID, LPDIRECTMUSICLOA IDirectMusicLoader8Impl *dmloader; TRACE("(%p,%p,%p)\n",lpcGUID, ppDMLoad, pUnkOuter); - if (IsEqualGUID(lpcGUID, &IID_IDirectMusicLoader) || - IsEqualGUID(lpcGUID, &IID_IDirectMusicLoader8)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicLoader) || + IsEqualIID (lpcGUID, &IID_IDirectMusicLoader8)) { dmloader = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoader8Impl)); if (NULL == dmloader) { *ppDMLoad = (LPDIRECTMUSICLOADER8)NULL; @@ -272,7 +353,25 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoader (LPCGUID lpcGUID, LPDIRECTMUSICLOA *ppDMLoad = (LPDIRECTMUSICLOADER8)dmloader; return S_OK; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } + +/* help function for IDirectMusicLoader8Impl_GetObject */ +HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]) +{ + HKEY hkDM; + DWORD returnType, sizeOfReturnBuffer = MAX_PATH; + char szPath[MAX_PATH]; + + if ((RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic" , 0, KEY_READ, &hkDM) != ERROR_SUCCESS) || + (RegQueryValueExA (hkDM, "GMFilePath", NULL, &returnType, szPath, &sizeOfReturnBuffer) != ERROR_SUCCESS)) { + WARN(": registry entry missing\n" ); + return E_FAIL; + } + /* FIXME: Check return types to ensure we're interpreting data right */ + MultiByteToWideChar (CP_ACP, 0, szPath, -1, wszPath, MAX_PATH); + + return S_OK; +} diff --git a/dlls/dmloader/loaderstream.c b/dlls/dmloader/loaderstream.c new file mode 100644 index 00000000000..10eec799d0d --- /dev/null +++ b/dlls/dmloader/loaderstream.c @@ -0,0 +1,281 @@ +/* ILoaderStream Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +#include "dmloader_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmloader); + +/***************************************************************************** + * Custom functions: + */ +HRESULT WINAPI ILoaderStream_Attach (ILoaderStream* This, LPCWSTR wzFile, IDirectMusicLoader *pLoader) +{ + TRACE("(%p, %s, %p)\n", This, debugstr_w(wzFile), pLoader); + ILoaderStream_Detach (This); + This->hFile = CreateFileW (wzFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (This->hFile == INVALID_HANDLE_VALUE) { + TRACE(": failed\n"); + return E_FAIL; + } + /* create IDirectMusicGetLoader */ + (LPDIRECTMUSICLOADER)This->pLoader = pLoader; + IDirectMusicLoader8_AddRef ((LPDIRECTMUSICLOADER8)This->pLoader); + strncpyW (This->wzFileName, wzFile, MAX_PATH); + TRACE(": succeeded\n"); + + return S_OK; +} + +void WINAPI ILoaderStream_Detach (ILoaderStream* This) +{ + if (This->hFile != INVALID_HANDLE_VALUE) { + CloseHandle(This->hFile); + } + This->wzFileName[0] = (L'\0'); +} + +/***************************************************************************** + * ILoaderStream IStream: + */ +HRESULT WINAPI ILoaderStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IStream)) { + *ppobj = (LPVOID)&This->StreamVtbl; + ILoaderStream_IStream_AddRef (iface); + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicGetLoader)) { + *ppobj = (LPVOID)&This->GetLoaderVtbl; + ILoaderStream_IStream_AddRef (iface); + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI ILoaderStream_IStream_AddRef (LPSTREAM iface) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI ILoaderStream_IStream_Release (LPSTREAM iface) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +HRESULT WINAPI ILoaderStream_IStream_Read (LPSTREAM iface, void* pv, ULONG cb, ULONG* pcbRead) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + ULONG cbRead; + + if (This->hFile == INVALID_HANDLE_VALUE) return E_FAIL; + if (pcbRead == NULL) pcbRead = &cbRead; + if (!ReadFile (This->hFile, pv, cb, pcbRead, NULL) || *pcbRead != cb) return E_FAIL; + + return S_OK; +} + +HRESULT WINAPI ILoaderStream_IStream_Seek (LPSTREAM iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + LARGE_INTEGER liNewPos; + + if (This->hFile == INVALID_HANDLE_VALUE) return E_FAIL; + + liNewPos.s.HighPart = dlibMove.s.HighPart; + liNewPos.s.LowPart = SetFilePointer (This->hFile, dlibMove.s.LowPart, &liNewPos.s.HighPart, dwOrigin); + + if (liNewPos.s.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR) return E_FAIL; + if (plibNewPosition) plibNewPosition->QuadPart = liNewPos.QuadPart; + + return S_OK; +} + +HRESULT WINAPI ILoaderStream_IStream_Clone (LPSTREAM iface, IStream** ppstm) +{ + ICOM_THIS_MULTI(ILoaderStream, StreamVtbl, iface); + ILoaderStream* pOther = NULL; + HRESULT result; + + TRACE("(%p, %p)\n", iface, ppstm); + result = DMUSIC_CreateLoaderStream ((LPSTREAM*)&pOther); + if (FAILED(result)) return result; + if (This->hFile != INVALID_HANDLE_VALUE) { + ULARGE_INTEGER ullCurrentPosition; + result = ILoaderStream_Attach (pOther, This->wzFileName, (LPDIRECTMUSICLOADER)This->pLoader); + if (SUCCEEDED(result)) { + LARGE_INTEGER liZero; + liZero.QuadPart = 0; + result = ILoaderStream_IStream_Seek (iface, liZero, STREAM_SEEK_CUR, &ullCurrentPosition); /* get current position in current stream */ + } + if (SUCCEEDED(result)) { + LARGE_INTEGER liNewPosition; + liNewPosition.QuadPart = ullCurrentPosition.QuadPart; + result = ILoaderStream_IStream_Seek ((LPSTREAM)pOther, liNewPosition, STREAM_SEEK_SET, &ullCurrentPosition); + } + if (FAILED(result)) { + TRACE(": failed\n"); + ILoaderStream_IStream_Release ((LPSTREAM)pOther); + return result; + } + } + TRACE(": succeeded\n"); + *ppstm = (IStream*)pOther; + return S_OK; +} + +/* not needed*/ +HRESULT WINAPI ILoaderStream_IStream_Write (LPSTREAM iface, const void* pv, ULONG cb, ULONG* pcbWritten) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_SetSize (LPSTREAM iface, ULARGE_INTEGER libNewSize) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_CopyTo (LPSTREAM iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_Commit (LPSTREAM iface, DWORD grfCommitFlags) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_Revert (LPSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_LockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_UnlockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI ILoaderStream_IStream_Stat (LPSTREAM iface, STATSTG* pstatstg, DWORD grfStatFlag) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IStream) LoaderStream_Stream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ILoaderStream_IStream_QueryInterface, + ILoaderStream_IStream_AddRef, + ILoaderStream_IStream_Release, + ILoaderStream_IStream_Read, + ILoaderStream_IStream_Write, + ILoaderStream_IStream_Seek, + ILoaderStream_IStream_SetSize, + ILoaderStream_IStream_CopyTo, + ILoaderStream_IStream_Commit, + ILoaderStream_IStream_Revert, + ILoaderStream_IStream_LockRegion, + ILoaderStream_IStream_UnlockRegion, + ILoaderStream_IStream_Stat, + ILoaderStream_IStream_Clone +}; + +/***************************************************************************** + * ILoaderStream IDirectMusicGetLoader: + */ +HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj) +{ + ICOM_THIS_MULTI(ILoaderStream, GetLoaderVtbl, iface); + return ILoaderStream_IStream_QueryInterface ((LPSTREAM)&This->StreamVtbl, riid, ppobj); +} + +ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface) +{ + ICOM_THIS_MULTI(ILoaderStream, GetLoaderVtbl, iface); + return ILoaderStream_IStream_AddRef ((LPSTREAM)&This->StreamVtbl); +} + +ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_Release (LPDIRECTMUSICGETLOADER iface) +{ + ICOM_THIS_MULTI(ILoaderStream, GetLoaderVtbl, iface); + return ILoaderStream_IStream_Release ((LPSTREAM)&This->StreamVtbl); +} + +HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_GetLoader (LPDIRECTMUSICGETLOADER iface, IDirectMusicLoader **ppLoader) +{ + ICOM_THIS_MULTI(ILoaderStream, GetLoaderVtbl, iface); + + TRACE("(%p, %p)\n", This, ppLoader); + *ppLoader = (LPDIRECTMUSICLOADER)This->pLoader; + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicGetLoader) LoaderStream_GetLoader_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ILoaderStream_IDirectMusicGetLoader_QueryInterface, + ILoaderStream_IDirectMusicGetLoader_AddRef, + ILoaderStream_IDirectMusicGetLoader_Release, + ILoaderStream_IDirectMusicGetLoader_GetLoader +}; + + +HRESULT WINAPI DMUSIC_CreateLoaderStream (LPSTREAM* ppStream) +{ + ILoaderStream *pStream; + + TRACE("(%p)\n", ppStream); + + pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(ILoaderStream)); + if (NULL == pStream) { + *ppStream = (LPSTREAM)NULL; + return E_OUTOFMEMORY; + } + pStream->StreamVtbl = &LoaderStream_Stream_Vtbl; + pStream->GetLoaderVtbl = &LoaderStream_GetLoader_Vtbl; + pStream->ref = 1; + + *ppStream = (LPSTREAM)pStream; + return S_OK; +} diff --git a/dlls/dmloader/regsvr.c b/dlls/dmloader/regsvr.c index c323d90edef..57d1e0d4ba8 100644 --- a/dlls/dmloader/regsvr.c +++ b/dlls/dmloader/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmloader); /* * Near the bottom of this file are the exported DllRegisterServer and @@ -503,7 +503,7 @@ static LONG recursive_delete_keyW(HKEY base, WCHAR const *name) */ static struct regsvr_coclass const coclass_list[] = { { &CLSID_DirectMusicLoader, - "DirectMusicLoader", + "DirectMusicLoader", NULL, "dmloader.dll", "Both", @@ -511,7 +511,7 @@ static struct regsvr_coclass const coclass_list[] = { "Microsoft.DirectMusicLoader" }, { &CLSID_DirectMusicContainer, - "DirectMusicContainer", + "DirectMusicContainer", NULL, "dmloader.dll", "Both", diff --git a/dlls/dmscript/Makefile.in b/dlls/dmscript/Makefile.in index d78e83107c7..5f5b694b8fc 100644 --- a/dlls/dmscript/Makefile.in +++ b/dlls/dmscript/Makefile.in @@ -12,7 +12,8 @@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ dmscript_main.c \ regsvr.c \ - script.c + script.c \ + scripttrack.c RC_SRCS = version.rc diff --git a/dlls/dmscript/dmscript_main.c b/dlls/dmscript/dmscript_main.c index 4fe2f99bc53..df9b2dde7ce 100644 --- a/dlls/dmscript/dmscript_main.c +++ b/dlls/dmscript/dmscript_main.c @@ -19,15 +19,8 @@ #include "dmscript_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmscript); - -/****************************************************************** - * DirectMusicScript ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMSCRCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicScriptAutoImplSegment ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplSegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,48 +39,540 @@ static HRESULT WINAPI DMSCRCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LP return E_NOINTERFACE; } -static ULONG WINAPI DMSCRCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI ScriptAutoImplSegmentCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMSCRCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI ScriptAutoImplSegmentCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMSCRCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI ScriptAutoImplSegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicScript)) { - return DMUSIC_CreateDirectMusicScript (riid, (LPDIRECTMUSICSCRIPT*)ppobj, pOuter); - } + + /* nothing here yet */ + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMSCRCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI ScriptAutoImplSegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMSCRCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) ScriptAutoImplSegmentCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMSCRCF_QueryInterface, - DMSCRCF_AddRef, - DMSCRCF_Release, - DMSCRCF_CreateInstance, - DMSCRCF_LockServer + ScriptAutoImplSegmentCF_QueryInterface, + ScriptAutoImplSegmentCF_AddRef, + ScriptAutoImplSegmentCF_Release, + ScriptAutoImplSegmentCF_CreateInstance, + ScriptAutoImplSegmentCF_LockServer }; -static IClassFactoryImpl DMSCRIPT_CF = {&DMSCRCF_Vtbl, 1 }; +static IClassFactoryImpl ScriptAutoImplSegment_CF = {&ScriptAutoImplSegmentCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptTrack ClassFactory + */ +static HRESULT WINAPI ScriptTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicScriptTrack (riid, (LPDIRECTMUSICTRACK8*)ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptTrackCF_QueryInterface, + ScriptTrackCF_AddRef, + ScriptTrackCF_Release, + ScriptTrackCF_CreateInstance, + ScriptTrackCF_LockServer +}; + +static IClassFactoryImpl ScriptTrack_CF = {&ScriptTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicAudioVBScript ClassFactory + */ +static HRESULT WINAPI AudioVBScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI AudioVBScriptCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI AudioVBScriptCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI AudioVBScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI AudioVBScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) AudioVBScriptCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + AudioVBScriptCF_QueryInterface, + AudioVBScriptCF_AddRef, + AudioVBScriptCF_Release, + AudioVBScriptCF_CreateInstance, + AudioVBScriptCF_LockServer +}; + +static IClassFactoryImpl AudioVBScript_CF = {&AudioVBScriptCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScript ClassFactory + */ +static HRESULT WINAPI ScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicScript)) { + return DMUSIC_CreateDirectMusicScript (riid, (LPDIRECTMUSICSCRIPT*)ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicScriptObject (riid, (LPDIRECTMUSICOBJECT*)ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptCF_QueryInterface, + ScriptCF_AddRef, + ScriptCF_Release, + ScriptCF_CreateInstance, + ScriptCF_LockServer +}; + +static IClassFactoryImpl Script_CF = {&ScriptCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptAutoImplPerformance ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplPerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptAutoImplPerformanceCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptAutoImplPerformanceCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptAutoImplPerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptAutoImplPerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptAutoImplPerformanceCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptAutoImplPerformanceCF_QueryInterface, + ScriptAutoImplPerformanceCF_AddRef, + ScriptAutoImplPerformanceCF_Release, + ScriptAutoImplPerformanceCF_CreateInstance, + ScriptAutoImplPerformanceCF_LockServer +}; + +static IClassFactoryImpl ScriptAutoImplPerformance_CF = {&ScriptAutoImplPerformanceCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptSourceCodeLoader ClassFactory + */ +static HRESULT WINAPI ScriptSourceCodeLoaderCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptSourceCodeLoaderCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptSourceCodeLoaderCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptSourceCodeLoaderCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptSourceCodeLoaderCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptSourceCodeLoaderCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptSourceCodeLoaderCF_QueryInterface, + ScriptSourceCodeLoaderCF_AddRef, + ScriptSourceCodeLoaderCF_Release, + ScriptSourceCodeLoaderCF_CreateInstance, + ScriptSourceCodeLoaderCF_LockServer +}; + +static IClassFactoryImpl ScriptSourceCodeLoader_CF = {&ScriptSourceCodeLoaderCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptAutoImplSegmentState ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplSegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptAutoImplSegmentStateCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptAutoImplSegmentStateCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptAutoImplSegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptAutoImplSegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptAutoImplSegmentStateCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptAutoImplSegmentStateCF_QueryInterface, + ScriptAutoImplSegmentStateCF_AddRef, + ScriptAutoImplSegmentStateCF_Release, + ScriptAutoImplSegmentStateCF_CreateInstance, + ScriptAutoImplSegmentStateCF_LockServer +}; + +static IClassFactoryImpl ScriptAutoImplSegmentState_CF = {&ScriptAutoImplSegmentStateCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptAutoImplAudioPathConfig ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptAutoImplAudioPathConfigCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptAutoImplAudioPathConfigCF_QueryInterface, + ScriptAutoImplAudioPathConfigCF_AddRef, + ScriptAutoImplAudioPathConfigCF_Release, + ScriptAutoImplAudioPathConfigCF_CreateInstance, + ScriptAutoImplAudioPathConfigCF_LockServer +}; + +static IClassFactoryImpl ScriptAutoImplAudioPathConfig_CF = {&ScriptAutoImplAudioPathConfigCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptAutoImplAudioPath ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplAudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptAutoImplAudioPathCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptAutoImplAudioPathCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptAutoImplAudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptAutoImplAudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptAutoImplAudioPathCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptAutoImplAudioPathCF_QueryInterface, + ScriptAutoImplAudioPathCF_AddRef, + ScriptAutoImplAudioPathCF_Release, + ScriptAutoImplAudioPathCF_CreateInstance, + ScriptAutoImplAudioPathCF_LockServer +}; + +static IClassFactoryImpl ScriptAutoImplAudioPath_CF = {&ScriptAutoImplAudioPathCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicScriptAutoImplSong ClassFactory + */ +static HRESULT WINAPI ScriptAutoImplSongCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ScriptAutoImplSongCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ScriptAutoImplSongCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ScriptAutoImplSongCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + + /* nothing here yet */ + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ScriptAutoImplSongCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ScriptAutoImplSongCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ScriptAutoImplSongCF_QueryInterface, + ScriptAutoImplSongCF_AddRef, + ScriptAutoImplSongCF_Release, + ScriptAutoImplSongCF_CreateInstance, + ScriptAutoImplSongCF_LockServer +}; + +static IClassFactoryImpl ScriptAutoImplSong_CF = {&ScriptAutoImplSongCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -128,11 +616,48 @@ HRESULT WINAPI DMSCRIPT_DllCanUnloadNow(void) HRESULT WINAPI DMSCRIPT_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMSCRIPT_CF; + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegment) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplSegment_CF; IClassFactory_AddRef((IClassFactory*)*ppv); return S_OK; - } + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_AudioVBScript) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &AudioVBScript_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScript) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Script_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpPerformance) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplPerformance_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScripSourceCodeLoader) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptSourceCodeLoader_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplSegmentState_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPathConfig) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplAudioPathConfig_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplAudioPath_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSong) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ScriptAutoImplSong_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmscript/dmscript_private.h b/dlls/dmscript/dmscript_private.h index 6380edb5771..1964289be0b 100644 --- a/dlls/dmscript/dmscript_private.h +++ b/dlls/dmscript/dmscript_private.h @@ -36,11 +36,23 @@ */ typedef struct IDirectMusicScriptImpl IDirectMusicScriptImpl; +typedef struct IDirectMusicScriptObject IDirectMusicScriptObject; +typedef struct IDirectMusicScriptObjectStream IDirectMusicScriptObjectStream; + +typedef struct IDirectMusicScriptTrack IDirectMusicScriptTrack; +typedef struct IDirectMusicScriptTrackStream IDirectMusicScriptTrackStream; + /***************************************************************************** * Predeclare the interface implementation structures */ extern ICOM_VTABLE(IDirectMusicScript) DirectMusicScript_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicScriptObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicScriptObjectStream_Vtbl; + +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicScriptTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicScriptTrackStream_Vtbl; + /***************************************************************************** * ClassFactory * @@ -49,6 +61,10 @@ extern ICOM_VTABLE(IDirectMusicScript) DirectMusicScript_Vtbl; */ extern HRESULT WINAPI DMUSIC_CreateDirectMusicScript (LPCGUID lpcGUID, LPDIRECTMUSICSCRIPT* ppDMScript, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); + /***************************************************************************** * IDirectMusicScriptImpl implementation structure */ @@ -59,6 +75,7 @@ struct IDirectMusicScriptImpl DWORD ref; /* IDirectMusicScriptImpl fields */ + IDirectMusicScriptObject* pObject; }; /* IUnknown: */ @@ -77,4 +94,115 @@ extern HRESULT WINAPI IDirectMusicScriptImpl_GetVariableObject (LPDIRECTMUSICSCR extern HRESULT WINAPI IDirectMusicScriptImpl_EnumRoutine (LPDIRECTMUSICSCRIPT iface, DWORD dwIndex, WCHAR* pwszName); extern HRESULT WINAPI IDirectMusicScriptImpl_EnumVariable (LPDIRECTMUSICSCRIPT iface, DWORD dwIndex, WCHAR* pwszName); + +/***************************************************************************** + * IDirectMusicScriptObject implementation structure + */ +struct IDirectMusicScriptObject +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicScriptObjectStream* pStream; + IDirectMusicScriptImpl* pScript; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicScriptObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicScriptObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicScriptObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicScriptObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicScriptObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicScriptObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicScriptObjectStream implementation structure + */ +struct IDirectMusicScriptObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicScriptObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicScriptObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicScriptObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicScriptObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicScriptObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicScriptObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicScriptObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicScriptObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicScriptObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicScriptTrack implementation structure + */ +struct IDirectMusicScriptTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicScriptTrack fields */ + IDirectMusicScriptTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicScriptTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicScriptTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicScriptTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicScriptTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicScriptTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicScriptTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicScriptTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicScriptTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicScriptTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicScriptTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicScriptTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicScriptTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicScriptTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicScriptTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicScriptTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicScriptTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicScriptTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicScriptTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicScriptTrackStream implementation structure + */ +struct IDirectMusicScriptTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicScriptTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicScriptTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicScriptTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicScriptTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicScriptTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicScriptTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicScriptTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicScriptTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicScriptTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + #endif /* __WINE_DMSCRIPT_PRIVATE_H */ diff --git a/dlls/dmscript/regsvr.c b/dlls/dmscript/regsvr.c index db9b5973536..0a011b74088 100644 --- a/dlls/dmscript/regsvr.c +++ b/dlls/dmscript/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmscript); /* * Near the bottom of this file are the exported DllRegisterServer and @@ -528,7 +528,7 @@ static struct regsvr_coclass const coclass_list[] = { "DMScript" }, { &CLSID_DirectMusicScript, - "DirectMusic Script Object", + "DirectMusic Script Object", NULL, "dmscript.dll", "Both", diff --git a/dlls/dmscript/script.c b/dlls/dmscript/script.c index 59162f85897..d07607b6685 100644 --- a/dlls/dmscript/script.c +++ b/dlls/dmscript/script.c @@ -25,20 +25,20 @@ #include "dmscript_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmscript); -/* IDirectMusicScript IUnknown parts follow: */ +/* IDirectMusicScript IUnknown part: */ HRESULT WINAPI IDirectMusicScriptImpl_QueryInterface (LPDIRECTMUSICSCRIPT iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicScriptImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicScript)) - { + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IDirectMusicScript)) { IDirectMusicScriptImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,14 +55,13 @@ ULONG WINAPI IDirectMusicScriptImpl_Release (LPDIRECTMUSICSCRIPT iface) ICOM_THIS(IDirectMusicScriptImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicScript Interface follow: */ +/* IDirectMusicScript IDirectMusicScript part: */ HRESULT WINAPI IDirectMusicScriptImpl_Init (LPDIRECTMUSICSCRIPT iface, IDirectMusicPerformance* pPerformance, DMUS_SCRIPT_ERRORINFO* pErrorInfo) { ICOM_THIS(IDirectMusicScriptImpl,iface); @@ -174,12 +173,214 @@ ICOM_VTABLE(IDirectMusicScript) DirectMusicScript_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicScript (LPCGUID lpcGUID, LPDIRECTMUSICSCRIPT* ppDMScript, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicScript)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicScriptImpl* dmscript; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicScript)) { + dmscript = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptImpl)); + if (NULL == dmscript) { + *ppDMScript = (LPDIRECTMUSICSCRIPT) NULL; + return E_OUTOFMEMORY; + } + dmscript->lpVtbl = &DirectMusicScript_Vtbl; + dmscript->ref = 1; + *ppDMScript = (LPDIRECTMUSICSCRIPT) dmscript; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + +/***************************************************************************** + * IDirectMusicScriptObject implementation + */ +/* IDirectMusicScriptObject IUnknown part: */ +HRESULT WINAPI IDirectMusicScriptObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID(riid, &IID_IDirectMusicObject)) { + IDirectMusicScriptObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicScript)) { + IDirectMusicScript_AddRef ((LPDIRECTMUSICSCRIPT)This->pScript); + *ppobj = (LPDIRECTMUSICSCRIPT)This->pScript; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicScriptObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicScriptObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicScriptObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicScriptObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicScriptObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicScriptObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicScriptObject_QueryInterface, + IDirectMusicScriptObject_AddRef, + IDirectMusicScriptObject_Release, + IDirectMusicScriptObject_GetDescriptor, + IDirectMusicScriptObject_SetDescriptor, + IDirectMusicScriptObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicScriptObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicScriptObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicScriptObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptObjectStream)); + obj->pStream->lpVtbl = &DirectMusicScriptObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicScript */ + DMUSIC_CreateDirectMusicScript (&IID_IDirectMusicScript, (LPDIRECTMUSICSCRIPT*)&obj->pScript, NULL); + obj->pScript->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicScriptObjectStream implementation + */ +/* IDirectMusicScriptObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicScriptObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicScriptObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicScriptObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicScriptObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicScriptObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicScriptObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicScriptObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicScriptObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicScriptObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicScriptObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicScriptObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicScriptObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicScriptObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicScriptObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicScriptObjectStream_QueryInterface, + IDirectMusicScriptObjectStream_AddRef, + IDirectMusicScriptObjectStream_Release, + IDirectMusicScriptObjectStream_GetClassID, + IDirectMusicScriptObjectStream_IsDirty, + IDirectMusicScriptObjectStream_Load, + IDirectMusicScriptObjectStream_Save, + IDirectMusicScriptObjectStream_GetSizeMax +}; diff --git a/dlls/dmscript/scripttrack.c b/dlls/dmscript/scripttrack.c new file mode 100644 index 00000000000..79efea6b04d --- /dev/null +++ b/dlls/dmscript/scripttrack.c @@ -0,0 +1,338 @@ +/* IDirectMusicScriptTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmscript_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmscript); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicScriptTrack implementation + */ +/* IDirectMusicScriptTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicScriptTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicScriptTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicScriptTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicScriptTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicScriptTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicScriptTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicScriptTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicScriptTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicScriptTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicScriptTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicScriptTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicScriptTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicScriptTrack_QueryInterface, + IDirectMusicScriptTrack_AddRef, + IDirectMusicScriptTrack_Release, + IDirectMusicScriptTrack_Init, + IDirectMusicScriptTrack_InitPlay, + IDirectMusicScriptTrack_EndPlay, + IDirectMusicScriptTrack_Play, + IDirectMusicScriptTrack_GetParam, + IDirectMusicScriptTrack_SetParam, + IDirectMusicScriptTrack_IsParamSupported, + IDirectMusicScriptTrack_AddNotificationType, + IDirectMusicScriptTrack_RemoveNotificationType, + IDirectMusicScriptTrack_Clone, + IDirectMusicScriptTrack_PlayEx, + IDirectMusicScriptTrack_GetParamEx, + IDirectMusicScriptTrack_SetParamEx, + IDirectMusicScriptTrack_Compose, + IDirectMusicScriptTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicScriptTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicScriptTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptTrackStream)); + track->pStream->lpVtbl = &DirectMusicScriptTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicScriptTrackStream implementation + */ +/* IDirectMusicScriptTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicScriptTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicScriptTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicScriptTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicScriptTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicScriptTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicScriptTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicScriptTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicScriptTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicScriptTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicScriptTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicScriptTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicScriptTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicScriptTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicScriptTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicScriptTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicScriptTrackStream_QueryInterface, + IDirectMusicScriptTrackStream_AddRef, + IDirectMusicScriptTrackStream_Release, + IDirectMusicScriptTrackStream_GetClassID, + IDirectMusicScriptTrackStream_IsDirty, + IDirectMusicScriptTrackStream_Load, + IDirectMusicScriptTrackStream_Save, + IDirectMusicScriptTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/Makefile.in b/dlls/dmstyle/Makefile.in index 8756828a820..a920c861845 100644 --- a/dlls/dmstyle/Makefile.in +++ b/dlls/dmstyle/Makefile.in @@ -10,9 +10,16 @@ LDDLLFLAGS = @LDDLLFLAGS@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ + auditiontrack.c \ + chordtrack.c \ + commandtrack.c \ dmstyle_main.c \ + melodyformulationtrack.c \ + motiftrack.c \ + mutetrack.c \ + regsvr.c \ style.c \ - regsvr.c + styletrack.c RC_SRCS = version.rc diff --git a/dlls/dmstyle/auditiontrack.c b/dlls/dmstyle/auditiontrack.c new file mode 100644 index 00000000000..c674f035f50 --- /dev/null +++ b/dlls/dmstyle/auditiontrack.c @@ -0,0 +1,338 @@ +/* IDirectMusicAuditionTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicAuditionTrack implementation + */ +/* IDirectMusicAuditionTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicAuditionTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicAuditionTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicAuditionTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicAuditionTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicAuditionTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicAuditionTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicAuditionTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + /* didn't find any params */ + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicAuditionTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicAuditionTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicAuditionTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicAuditionTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicAuditionTrack_QueryInterface, + IDirectMusicAuditionTrack_AddRef, + IDirectMusicAuditionTrack_Release, + IDirectMusicAuditionTrack_Init, + IDirectMusicAuditionTrack_InitPlay, + IDirectMusicAuditionTrack_EndPlay, + IDirectMusicAuditionTrack_Play, + IDirectMusicAuditionTrack_GetParam, + IDirectMusicAuditionTrack_SetParam, + IDirectMusicAuditionTrack_IsParamSupported, + IDirectMusicAuditionTrack_AddNotificationType, + IDirectMusicAuditionTrack_RemoveNotificationType, + IDirectMusicAuditionTrack_Clone, + IDirectMusicAuditionTrack_PlayEx, + IDirectMusicAuditionTrack_GetParamEx, + IDirectMusicAuditionTrack_SetParamEx, + IDirectMusicAuditionTrack_Compose, + IDirectMusicAuditionTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicAuditionTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicAuditionTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAuditionTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicAuditionTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAuditionTrackStream)); + track->pStream->lpVtbl = &DirectMusicAuditionTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicAuditionTrackStream implementation + */ +/* IDirectMusicAuditionTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicAuditionTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicAuditionTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicAuditionTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicAuditionTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicAuditionTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicAuditionTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicAuditionTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicAuditionTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicAuditionTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicAuditionTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicAuditionTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicAuditionTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicAuditionTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicAuditionTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicAuditionTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicAuditionTrackStream_QueryInterface, + IDirectMusicAuditionTrackStream_AddRef, + IDirectMusicAuditionTrackStream_Release, + IDirectMusicAuditionTrackStream_GetClassID, + IDirectMusicAuditionTrackStream_IsDirty, + IDirectMusicAuditionTrackStream_Load, + IDirectMusicAuditionTrackStream_Save, + IDirectMusicAuditionTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/chordtrack.c b/dlls/dmstyle/chordtrack.c new file mode 100644 index 00000000000..34277b5478c --- /dev/null +++ b/dlls/dmstyle/chordtrack.c @@ -0,0 +1,465 @@ +/* IDirectMusicChordTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicChordTrack implementation + */ +/* IDirectMusicChordTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicChordTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicChordTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicChordTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicChordTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_BandParam) + || IsEqualGUID (rguidType, &GUID_ChordParam) + || IsEqualGUID (rguidType, &GUID_RhythmParam)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicChordTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicChordTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicChordTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicChordTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicChordTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordTrack_QueryInterface, + IDirectMusicChordTrack_AddRef, + IDirectMusicChordTrack_Release, + IDirectMusicChordTrack_Init, + IDirectMusicChordTrack_InitPlay, + IDirectMusicChordTrack_EndPlay, + IDirectMusicChordTrack_Play, + IDirectMusicChordTrack_GetParam, + IDirectMusicChordTrack_SetParam, + IDirectMusicChordTrack_IsParamSupported, + IDirectMusicChordTrack_AddNotificationType, + IDirectMusicChordTrack_RemoveNotificationType, + IDirectMusicChordTrack_Clone, + IDirectMusicChordTrack_PlayEx, + IDirectMusicChordTrack_GetParamEx, + IDirectMusicChordTrack_SetParamEx, + IDirectMusicChordTrack_Compose, + IDirectMusicChordTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicChordTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicChordTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrackStream)); + track->pStream->lpVtbl = &DirectMusicChordTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicChordTrackStream implementation + */ +/* IDirectMusicChordTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicChordTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicChordTrackStream,iface); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IPersistStream)) { + IDirectMusicChordTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicChordTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicChordTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicChordTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicChordTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicChordTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicChordTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicChordTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicChordTrackStream,iface); + FOURCC chunkID; + DWORD chunkSize, dwSizeOfStruct, ListSize[1], ListCount[1]; + LARGE_INTEGER liMove; /* used when skipping chunks */ + IDirectMusicChordTrack* pTrack = This->pParentTrack; /* that's where we load data to */ + DMUS_IO_CHORD tempChord; /* temporary, used for reading data */ + DWORD tempSubChords; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[0] = chunkSize - sizeof(FOURCC); + ListCount[0] = 0; + switch (chunkID) { + case DMUS_FOURCC_CHORDTRACK_LIST: { + TRACE_(dmfile)(": chord track list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK: { + TRACE_(dmfile)(": chord track header chunk\n"); + IStream_Read (pStm, &pTrack->dwHeader, chunkSize, NULL); + TRACE_(dmfile)(": (READ): header: chord root = %i; chord scale = %i\n", (pTrack->dwHeader && 0xFF000000) >> 24, pTrack->dwHeader && 0x00FFFFFF); + break; + } + case DMUS_FOURCC_CHORDTRACKBODY_CHUNK: { + TRACE_(dmfile)(": chord track body chunk\n"); + /* make space for one more structure */ + /* pTrack->dwChordKeys++; */ /* moved at the end for correct counting */ + /* FIXME: scheme with HeapReAlloc doesn't work so.. */ + /* pTrack->pChordKeys = HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, pTrack->pChordKeys, sizeof(DMUS_CHORD_KEY) * pTrack->dwChordKeys); */ + /* pTrack->pChordKeysTime = HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, pTrack->pChordKeysTime, sizeof(MUSIC_TIME) *pTrack->dwChordKeys); */ + /* load size of DMUS_IO_CHORD */ + IStream_Read (pStm, &dwSizeOfStruct, sizeof(DWORD), NULL); + if (dwSizeOfStruct != sizeof(DMUS_IO_CHORD)) { + TRACE_(dmfile)(": declared size of struct (=%ld) != actual size (=%i); loading failed\n", dwSizeOfStruct, sizeof(DMUS_IO_CHORD)); + return E_FAIL; + } + /* reset temporary storage and fill it with data */ + ZeroMemory (&tempChord, sizeof(DMUS_IO_CHORD)); + IStream_Read (pStm, &tempChord, dwSizeOfStruct, NULL); + /* copy data to final destination */ + strncpyW (pTrack->pChordKeys[pTrack->dwChordKeys].wszName, tempChord.wszName, 16); + /*pTrack->pChordKeys[pTrack->dwChordKeys].wszName = tempChord.wszName; */ + pTrack->pChordKeys[pTrack->dwChordKeys].wMeasure = tempChord.wMeasure; + pTrack->pChordKeys[pTrack->dwChordKeys].bBeat = tempChord.bBeat; + pTrack->pChordKeys[pTrack->dwChordKeys].bFlags = tempChord.bFlags; + /* this one is my invention */ + pTrack->pChordKeysTime[pTrack->dwChordKeys] = tempChord.mtTime; + /* FIXME: are these two are derived from header? */ + pTrack->pChordKeys[pTrack->dwChordKeys].dwScale = pTrack->dwHeader && 0x00FFFFFF; + pTrack->pChordKeys[pTrack->dwChordKeys].bKey = (pTrack->dwHeader && 0xFF000000) >> 24; + /* now here comes number of subchords */ + IStream_Read (pStm, &tempSubChords, sizeof(DWORD), NULL); + pTrack->pChordKeys[pTrack->dwChordKeys].bSubChordCount = tempSubChords; + /* load size of DMUS_IO_SUBCHORD */ + IStream_Read (pStm, &dwSizeOfStruct, sizeof(DWORD), NULL); + if (dwSizeOfStruct != sizeof(DMUS_IO_SUBCHORD)) { + TRACE_(dmfile)(": declared size of struct (=%ld) != actual size (=%i); loading failed\n", dwSizeOfStruct, sizeof(DMUS_IO_SUBCHORD)); + return E_FAIL; + } + IStream_Read (pStm, pTrack->pChordKeys[pTrack->dwChordKeys].SubChordList, dwSizeOfStruct * tempSubChords, NULL); + /* well, this should be it :) */ + pTrack->dwChordKeys++; + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = ListSize[0]; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + /* in the end, let's see what we got */ + TRACE_(dmfile)(": reading finished\n"); + if (TRACE_ON(dmfile)) { + int i,j; + TRACE_(dmfile)(": (READ): number of chord keys in track = %ld\n", pTrack->dwChordKeys); + for (i = 0; i < pTrack->dwChordKeys; i++) { + TRACE_(dmfile)(": (READ): chord key[%i]: associated mtTime = %li\n", i, pTrack->pChordKeysTime[i]); + TRACE_(dmfile)(": (READ): chord key[%i]: wszName = %s; wMeasure = %d; bBeat = %i; dwScale = %ld; \ +bKey = %i; bFlags = %i; bSubChordCount = %i\n", i, debugstr_w (pTrack->pChordKeys[i].wszName), \ + pTrack->pChordKeys[i].wMeasure, pTrack->pChordKeys[i].bBeat, pTrack->pChordKeys[i].dwScale, \ + pTrack->pChordKeys[i].bKey, pTrack->pChordKeys[i].bFlags, pTrack->pChordKeys[i].bSubChordCount); + for (j = 0; j < pTrack->pChordKeys[i].bSubChordCount; j++) { + TRACE_(dmfile)(": (READ): chord key[%i]: subchord[%i]: dwChordPattern = %ld; \ +dwScalePattern = %ld; dwInversionPoints = %ld; dwLevels = %ld; bChordRoot = %i; \ +bScaleRoot = %i\n", i, j, pTrack->pChordKeys[i].SubChordList[j].dwChordPattern, \ + pTrack->pChordKeys[i].SubChordList[j].dwScalePattern, pTrack->pChordKeys[i].SubChordList[j].dwInversionPoints, \ + pTrack->pChordKeys[i].SubChordList[j].dwLevels, pTrack->pChordKeys[i].SubChordList[j].bChordRoot, \ + pTrack->pChordKeys[i].SubChordList[j].bScaleRoot); + } + } + } + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicChordTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicChordTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicChordTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicChordTrackStream_QueryInterface, + IDirectMusicChordTrackStream_AddRef, + IDirectMusicChordTrackStream_Release, + IDirectMusicChordTrackStream_GetClassID, + IDirectMusicChordTrackStream_IsDirty, + IDirectMusicChordTrackStream_Load, + IDirectMusicChordTrackStream_Save, + IDirectMusicChordTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/commandtrack.c b/dlls/dmstyle/commandtrack.c new file mode 100644 index 00000000000..4214f7dc14e --- /dev/null +++ b/dlls/dmstyle/commandtrack.c @@ -0,0 +1,387 @@ +/* IDirectMusicCommandTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicCommandTrack implementation + */ +/* IDirectMusicCommandTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicCommandTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicCommandTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicCommandTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicCommandTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicCommandTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicCommandTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicCommandTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_CommandParam) + || IsEqualGUID (rguidType, &GUID_CommandParam2) + || IsEqualGUID (rguidType, &GUID_CommandParamNext)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicCommandTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicCommandTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicCommandTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + /* implement code for sending PMsgs */ + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicCommandTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicCommandTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicCommandTrack_QueryInterface, + IDirectMusicCommandTrack_AddRef, + IDirectMusicCommandTrack_Release, + IDirectMusicCommandTrack_Init, + IDirectMusicCommandTrack_InitPlay, + IDirectMusicCommandTrack_EndPlay, + IDirectMusicCommandTrack_Play, + IDirectMusicCommandTrack_GetParam, + IDirectMusicCommandTrack_SetParam, + IDirectMusicCommandTrack_IsParamSupported, + IDirectMusicCommandTrack_AddNotificationType, + IDirectMusicCommandTrack_RemoveNotificationType, + IDirectMusicCommandTrack_Clone, + IDirectMusicCommandTrack_PlayEx, + IDirectMusicCommandTrack_GetParamEx, + IDirectMusicCommandTrack_SetParamEx, + IDirectMusicCommandTrack_Compose, + IDirectMusicCommandTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicCommandTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicCommandTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCommandTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicCommandTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCommandTrackStream)); + track->pStream->lpVtbl = &DirectMusicCommandTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicCommandTrackStream implementation + */ +/* IDirectMusicCommandTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicCommandTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicCommandTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicCommandTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicCommandTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicCommandTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicCommandTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicCommandTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicCommandTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicCommandTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicCommandTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicCommandTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicCommandTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicCommandTrackStream,iface); + FOURCC chunkID; + DWORD chunkSize, dwSizeOfStruct; + LARGE_INTEGER liMove; /* used when skipping chunks */ + IDirectMusicCommandTrack* pTrack = This->pParentTrack; /* that's where we load data to */ + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_COMMANDTRACK_CHUNK: { + TRACE_(dmfile)(": command track chunk\n"); + IStream_Read (pStm, &dwSizeOfStruct, sizeof(DWORD), NULL); + if (dwSizeOfStruct != sizeof(DMUS_IO_COMMAND)) { + TRACE_(dmfile)(": declared size of struct (=%ld) != actual size (=%i); loading failed\n", dwSizeOfStruct, sizeof(DMUS_IO_COMMAND)); + liMove.QuadPart = chunkSize - sizeof(DWORD); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + chunkSize -= sizeof(DWORD); /* now chunk size is one DWORD shorter */ + pTrack->pCommands = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->pCommands, chunkSize, NULL); + pTrack->dwCommands = chunkSize/dwSizeOfStruct; + /* in the end, let's see what we got */ + TRACE_(dmfile)(": reading finished\n"); + if (TRACE_ON(dmfile)) { + int i; + TRACE_(dmfile)(": (READ): number of commands in track = %ld\n", pTrack->dwCommands); + for (i = 0; i < pTrack->dwCommands; i++) { + TRACE_(dmfile)(": (READ): command[%i]: mtTime = %li; wMeasure = %d; bBeat = %i; bCommand = %i; bGrooveLevel = %i; bGrooveRange = %i; bRepeatMode = %i\n", \ + i, pTrack->pCommands[i].mtTime, pTrack->pCommands[i].wMeasure, pTrack->pCommands[i].bBeat, pTrack->pCommands[i].bCommand, \ + pTrack->pCommands[i].bGrooveLevel, pTrack->pCommands[i].bGrooveRange, pTrack->pCommands[i].bRepeatMode); + } + } + } + break; + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCommandTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicCommandTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicCommandTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicCommandTrackStream_QueryInterface, + IDirectMusicCommandTrackStream_AddRef, + IDirectMusicCommandTrackStream_Release, + IDirectMusicCommandTrackStream_GetClassID, + IDirectMusicCommandTrackStream_IsDirty, + IDirectMusicCommandTrackStream_Load, + IDirectMusicCommandTrackStream_Save, + IDirectMusicCommandTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/dmstyle_main.c b/dlls/dmstyle/dmstyle_main.c index 415dd3e3980..d85c7d5f8cb 100644 --- a/dlls/dmstyle/dmstyle_main.c +++ b/dlls/dmstyle/dmstyle_main.c @@ -19,15 +19,8 @@ #include "dmstyle_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); - -/****************************************************************** - * DirectMusicStyle ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMSTYLCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicSection ClassFactory + */ +static HRESULT WINAPI SectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,50 +39,498 @@ static HRESULT WINAPI DMSTYLCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,L return E_NOINTERFACE; } -static ULONG WINAPI DMSTYLCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI SectionCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMSTYLCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI SectionCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMSTYLCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI SectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicStyle) || - IsEqualGUID (riid, &IID_IDirectMusicStyle8)) { - return DMUSIC_CreateDirectMusicStyle (riid, (LPDIRECTMUSICSTYLE*)ppobj, pOuter); - } + + /* nothing here yet */ WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMSTYLCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI SectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMSTYLCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) SectionCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMSTYLCF_QueryInterface, - DMSTYLCF_AddRef, - DMSTYLCF_Release, - DMSTYLCF_CreateInstance, - DMSTYLCF_LockServer + SectionCF_QueryInterface, + SectionCF_AddRef, + SectionCF_Release, + SectionCF_CreateInstance, + SectionCF_LockServer }; -static IClassFactoryImpl DMSTYLE_CF = {&DMSTYLCF_Vtbl, 1 }; +static IClassFactoryImpl Section_CF = {&SectionCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicStyle ClassFactory + */ +static HRESULT WINAPI StyleCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI StyleCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI StyleCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI StyleCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicStyle) || + IsEqualIID (riid, &IID_IDirectMusicStyle8)) { + return DMUSIC_CreateDirectMusicStyle (riid, (LPDIRECTMUSICSTYLE8*)ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicStyleObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI StyleCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) StyleCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + StyleCF_QueryInterface, + StyleCF_AddRef, + StyleCF_Release, + StyleCF_CreateInstance, + StyleCF_LockServer +}; + +static IClassFactoryImpl Style_CF = {&StyleCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicChordTrack ClassFactory + */ +static HRESULT WINAPI ChordTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI ChordTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI ChordTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI ChordTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicChordTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI ChordTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) ChordTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + ChordTrackCF_QueryInterface, + ChordTrackCF_AddRef, + ChordTrackCF_Release, + ChordTrackCF_CreateInstance, + ChordTrackCF_LockServer +}; + +static IClassFactoryImpl ChordTrack_CF = {&ChordTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicCommandTrack ClassFactory + */ +static HRESULT WINAPI CommandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI CommandTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI CommandTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI CommandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicCommandTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI CommandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) CommandTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + CommandTrackCF_QueryInterface, + CommandTrackCF_AddRef, + CommandTrackCF_Release, + CommandTrackCF_CreateInstance, + CommandTrackCF_LockServer +}; + +static IClassFactoryImpl CommandTrack_CF = {&CommandTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicStyleTrack ClassFactory + */ +static HRESULT WINAPI StyleTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI StyleTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI StyleTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI StyleTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicStyleTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI StyleTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) StyleTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + StyleTrackCF_QueryInterface, + StyleTrackCF_AddRef, + StyleTrackCF_Release, + StyleTrackCF_CreateInstance, + StyleTrackCF_LockServer +}; + +static IClassFactoryImpl StyleTrack_CF = {&StyleTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicMotifTrack ClassFactory + */ +static HRESULT WINAPI MotifTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI MotifTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI MotifTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI MotifTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicMotifTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI MotifTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) MotifTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + MotifTrackCF_QueryInterface, + MotifTrackCF_AddRef, + MotifTrackCF_Release, + MotifTrackCF_CreateInstance, + MotifTrackCF_LockServer +}; + +static IClassFactoryImpl MotifTrack_CF = {&MotifTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicAuditionTrack ClassFactory + */ +static HRESULT WINAPI AuditionTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI AuditionTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI AuditionTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI AuditionTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicAuditionTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI AuditionTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) AuditionTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + AuditionTrackCF_QueryInterface, + AuditionTrackCF_AddRef, + AuditionTrackCF_Release, + AuditionTrackCF_CreateInstance, + AuditionTrackCF_LockServer +}; + +static IClassFactoryImpl AuditionTrack_CF = {&AuditionTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicMuteTrack ClassFactory + */ +static HRESULT WINAPI MuteTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI MuteTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI MuteTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI MuteTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicMuteTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI MuteTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) MuteTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + MuteTrackCF_QueryInterface, + MuteTrackCF_AddRef, + MuteTrackCF_Release, + MuteTrackCF_CreateInstance, + MuteTrackCF_LockServer +}; + +static IClassFactoryImpl MuteTrack_CF = {&MuteTrackCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicMelodyFormulationTrack ClassFactory + */ +static HRESULT WINAPI MelodyFormulationTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI MelodyFormulationTrackCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI MelodyFormulationTrackCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI MelodyFormulationTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicTrack) + || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + return DMUSIC_CreateDirectMusicMelodyFormulationTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI MelodyFormulationTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) MelodyFormulationTrackCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + MelodyFormulationTrackCF_QueryInterface, + MelodyFormulationTrackCF_AddRef, + MelodyFormulationTrackCF_Release, + MelodyFormulationTrackCF_CreateInstance, + MelodyFormulationTrackCF_LockServer +}; + +static IClassFactoryImpl MelodyFormulationTrack_CF = {&MelodyFormulationTrackCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -130,11 +574,45 @@ HRESULT WINAPI DMSTYLE_DllCanUnloadNow(void) HRESULT WINAPI DMSTYLE_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMSTYLE_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSection) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Section_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyle) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Style_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &ChordTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCommandTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &CommandTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyleTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &StyleTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMotifTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &MotifTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAuditionTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &AuditionTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMuteTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &MuteTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMelodyFormulationTrack) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &MelodyFormulationTrack_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmstyle/dmstyle_private.h b/dlls/dmstyle/dmstyle_private.h index 9f838811358..0b6a68009bd 100644 --- a/dlls/dmstyle/dmstyle_private.h +++ b/dlls/dmstyle/dmstyle_private.h @@ -36,19 +36,64 @@ */ typedef struct IDirectMusicStyle8Impl IDirectMusicStyle8Impl; +typedef struct IDirectMusicStyleObject IDirectMusicStyleObject; +typedef struct IDirectMusicStyleObjectStream IDirectMusicStyleObjectStream; +typedef struct IDirectMusicAuditionTrack IDirectMusicAuditionTrack; +typedef struct IDirectMusicAuditionTrackStream IDirectMusicAuditionTrackStream; +typedef struct IDirectMusicChordTrack IDirectMusicChordTrack; +typedef struct IDirectMusicChordTrackStream IDirectMusicChordTrackStream; +typedef struct IDirectMusicCommandTrack IDirectMusicCommandTrack; +typedef struct IDirectMusicCommandTrackStream IDirectMusicCommandTrackStream; +typedef struct IDirectMusicMelodyFormulationTrack IDirectMusicMelodyFormulationTrack; +typedef struct IDirectMusicMelodyFormulationTrackStream IDirectMusicMelodyFormulationTrackStream; +typedef struct IDirectMusicMotifTrack IDirectMusicMotifTrack; +typedef struct IDirectMusicMotifTrackStream IDirectMusicMotifTrackStream; +typedef struct IDirectMusicMuteTrack IDirectMusicMuteTrack; +typedef struct IDirectMusicMuteTrackStream IDirectMusicMuteTrackStream; +typedef struct IDirectMusicStyleTrack IDirectMusicStyleTrack; +typedef struct IDirectMusicStyleTrackStream IDirectMusicStyleTrackStream; + /***************************************************************************** * Predeclare the interface implementation structures */ extern ICOM_VTABLE(IDirectMusicStyle8) DirectMusicStyle8_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicStyleObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicStyleObjectStream_Vtbl; + +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicAuditionTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicAuditionTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicChordTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicChordTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicCommandTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicCommandTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMelodyFormulationTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicMelodyFormulationTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMotifTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicMotifTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMuteTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicMuteTrackStream_Vtbl; +extern ICOM_VTABLE(IDirectMusicTrack8) DirectMusicStyleTrack_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicStyleTrackStream_Vtbl; + /***************************************************************************** * ClassFactory * * can support IID_IDirectMusicStyle and IID_IDirectMusicStyle8 * return always an IDirectMusicStyle8Impl */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE* ppDMStyle, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE8* ppDMStyle, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicStyleObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + +extern HRESULT WINAPI DMUSIC_CreateDirectMusicAuditionTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicCommandTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicMelodyFormulationTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicMotifTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicMuteTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicStyleTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8* ppTrack, LPUNKNOWN pUnkOuter); /***************************************************************************** * IDirectMusicStyle8Impl implementation structure @@ -60,6 +105,7 @@ struct IDirectMusicStyle8Impl DWORD ref; /* IDirectMusicStyle8Impl fields */ + IDirectMusicStyleObject* pObject; }; /* IUnknown: */ @@ -81,4 +127,507 @@ extern HRESULT WINAPI IDirectMusicStyle8Impl_GetTempo (LPDIRECTMUSICSTYLE8 iface /* IDirectMusicStyle8: */ extern HRESULT WINAPI IDirectMusicStyle8ImplEnumPattern (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, DWORD dwPatternType, WCHAR* pwszName); + +/***************************************************************************** + * IDirectMusicStyleObject implementation structure + */ +struct IDirectMusicStyleObject +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicStyleObjectStream* pStream; + IDirectMusicStyle8Impl* pStyle; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicStyleObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicStyleObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicStyleObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicStyleObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicStyleObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicStyleObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicStyleObjectStream implementation structure + */ +struct IDirectMusicStyleObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicStyleObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicStyleObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicStyleObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicStyleObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicStyleObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicStyleObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicStyleObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicStyleObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicStyleObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicAuditionTrack implementation structure + */ +struct IDirectMusicAuditionTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicAuditionTrack fields */ + IDirectMusicAuditionTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicAuditionTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicAuditionTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicAuditionTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicAuditionTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicAuditionTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicAuditionTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicAuditionTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicAuditionTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicAuditionTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicAuditionTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicAuditionTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicAuditionTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicAuditionTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicAuditionTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicAuditionTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicAuditionTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicAuditionTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicAuditionTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicAuditionTrackStream implementation structure + */ +struct IDirectMusicAuditionTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicAuditionTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicAuditionTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicAuditionTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicAuditionTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicChordTrack implementation structure + */ +struct IDirectMusicChordTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicChordTrack fields */ + IDirectMusicChordTrackStream* pStream; + DWORD dwHeader; + /* FIXME: scheme with HeapReAlloc doesn't work so.. */ +/* + * DMUS_CHORD_KEY* pChordKeys; + * MUSIC_TIME* pChordKeysTime; + */ + DMUS_CHORD_KEY pChordKeys[255]; + MUSIC_TIME pChordKeysTime[255]; + DWORD dwChordKeys; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicChordTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicChordTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicChordTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicChordTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicChordTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicChordTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicChordTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicChordTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicChordTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicChordTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicChordTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicChordTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicChordTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicChordTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicChordTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicChordTrackStream implementation structure + */ +struct IDirectMusicChordTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicChordTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicChordTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicChordTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicChordTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicChordTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicChordTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicChordTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicChordTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicChordTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicCommandTrack implementation structure + */ +struct IDirectMusicCommandTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicCommandTrack fields */ + IDirectMusicCommandTrackStream* pStream; + /* track data */ + DMUS_IO_COMMAND* pCommands; + DWORD dwCommands; /* nr. of DMUS_IO_COMMAND structures in pCommands */ +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicCommandTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicCommandTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicCommandTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicCommandTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicCommandTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicCommandTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicCommandTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicCommandTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicCommandTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicCommandTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicCommandTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicCommandTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicCommandTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicCommandTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicCommandTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicCommandTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicCommandTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicCommandTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicCommandTrackStream implementation structure + */ +struct IDirectMusicCommandTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicCommandTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicCommandTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicCommandTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicCommandTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicCommandTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicCommandTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicCommandTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicCommandTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicCommandTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicMelodyFormulationTrack implementation structure + */ +struct IDirectMusicMelodyFormulationTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicMelodyFormulationTrack fields */ + IDirectMusicMelodyFormulationTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicMelodyFormulationTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicMelodyFormulationTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicMelodyFormulationTrackStream implementation structure + */ +struct IDirectMusicMelodyFormulationTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicMelodyFormulationTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicMelodyFormulationTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicMelodyFormulationTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicMotifTrack implementation structure + */ +struct IDirectMusicMotifTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicMotifTrack fields */ + IDirectMusicMotifTrackStream* pStream; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMotifTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicMotifTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicMotifTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicMotifTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicMotifTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMotifTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicMotifTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMotifTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicMotifTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicMotifTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicMotifTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMotifTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMotifTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicMotifTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMotifTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMotifTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMotifTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicMotifTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicMotifTrackStream implementation structure + */ +struct IDirectMusicMotifTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicMotifTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMotifTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicMotifTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicMotifTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicMotifTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicMotifTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicMotifTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicMotifTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicMotifTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicMuteTrack implementation structure + */ +struct IDirectMusicMuteTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicMuteTrack fields */ + IDirectMusicMuteTrackStream* pStream; + DMUS_IO_MUTE* pMutes; + DWORD dwMutes; /* nr. of DMUS_IO_MUTE structures in pMutes */ +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMuteTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicMuteTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicMuteTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicMuteTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicMuteTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMuteTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicMuteTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMuteTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicMuteTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicMuteTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicMuteTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMuteTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicMuteTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicMuteTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicMuteTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMuteTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicMuteTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicMuteTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicMuteTrackStream implementation structure + */ +struct IDirectMusicMuteTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicMuteTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicMuteTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicMuteTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicMuteTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicMuteTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicMuteTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicMuteTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicMuteTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicMuteTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + +/***************************************************************************** + * IDirectMusicStyleTrack implementation structure + */ +struct IDirectMusicStyleTrack +{ + /* IUnknown fields */ + ICOM_VFIELD(IDirectMusicTrack8); + DWORD ref; + + /* IDirectMusicStyleTrack fields */ + IDirectMusicStyleTrackStream* pStream; + /* FIXME: implement it with HeapReAlloc */ + DWORD pStampTimes[255]; /* stamp times for styles */ + IDirectMusicStyle8Impl* ppStyles[255]; + DWORD dwStyles; /* nr. of IDirectMusicStyle8Impl* and DWORD */ +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicStyleTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicStyleTrack_AddRef (LPDIRECTMUSICTRACK8 iface); +extern ULONG WINAPI IDirectMusicStyleTrack_Release (LPDIRECTMUSICTRACK8 iface); +/* IDirectMusicTrack: */ +extern HRESULT WINAPI IDirectMusicStyleTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment); +extern HRESULT WINAPI IDirectMusicStyleTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrackID, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicStyleTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData); +extern HRESULT WINAPI IDirectMusicStyleTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicStyleTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam); +extern HRESULT WINAPI IDirectMusicStyleTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam); +extern HRESULT WINAPI IDirectMusicStyleTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType); +extern HRESULT WINAPI IDirectMusicStyleTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicStyleTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType); +extern HRESULT WINAPI IDirectMusicStyleTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack); +/* IDirectMusicTrack8: */ +extern HRESULT WINAPI IDirectMusicStyleTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID); +extern HRESULT WINAPI IDirectMusicStyleTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicStyleTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags); +extern HRESULT WINAPI IDirectMusicStyleTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); +extern HRESULT WINAPI IDirectMusicStyleTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack); + +/***************************************************************************** + * IDirectMusicStyleTrackStream implementation structure + */ +struct IDirectMusicStyleTrackStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicStyleTrack* pParentTrack; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicStyleTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicStyleTrackStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicStyleTrackStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicStyleTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicStyleTrackStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicStyleTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicStyleTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicStyleTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + +static inline const char *debugstr_fourcc( DWORD fourcc ) +{ + if (!fourcc) return "'null'"; + return wine_dbg_sprintf( "\'%c%c%c%c\'", + (char)(fourcc), (char)(fourcc >> 8), + (char)(fourcc >> 16), (char)(fourcc >> 24) ); +} + #endif /* __WINE_DMSTYLE_PRIVATE_H */ diff --git a/dlls/dmstyle/melodyformulationtrack.c b/dlls/dmstyle/melodyformulationtrack.c new file mode 100644 index 00000000000..ab0152c5fdc --- /dev/null +++ b/dlls/dmstyle/melodyformulationtrack.c @@ -0,0 +1,343 @@ +/* IDirectMusicMelodyFormulationTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicMelodyFormulationTrack implementation + */ +/* IDirectMusicMelodyFormulationTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicMelodyFormulationTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMelodyFormulationTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMelodyFormulationTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMelodyFormulationTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMelodyFormulationTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_BandParam) + || IsEqualGUID (rguidType, &GUID_Clear_All_MelodyFragments) + || IsEqualGUID (rguidType, &GUID_MelodyFragment)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicMelodyFormulationTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMelodyFormulationTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMelodyFormulationTrack_QueryInterface, + IDirectMusicMelodyFormulationTrack_AddRef, + IDirectMusicMelodyFormulationTrack_Release, + IDirectMusicMelodyFormulationTrack_Init, + IDirectMusicMelodyFormulationTrack_InitPlay, + IDirectMusicMelodyFormulationTrack_EndPlay, + IDirectMusicMelodyFormulationTrack_Play, + IDirectMusicMelodyFormulationTrack_GetParam, + IDirectMusicMelodyFormulationTrack_SetParam, + IDirectMusicMelodyFormulationTrack_IsParamSupported, + IDirectMusicMelodyFormulationTrack_AddNotificationType, + IDirectMusicMelodyFormulationTrack_RemoveNotificationType, + IDirectMusicMelodyFormulationTrack_Clone, + IDirectMusicMelodyFormulationTrack_PlayEx, + IDirectMusicMelodyFormulationTrack_GetParamEx, + IDirectMusicMelodyFormulationTrack_SetParamEx, + IDirectMusicMelodyFormulationTrack_Compose, + IDirectMusicMelodyFormulationTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicMelodyFormulationTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicMelodyFormulationTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMelodyFormulationTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicMelodyFormulationTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMelodyFormulationTrackStream)); + track->pStream->lpVtbl = &DirectMusicMelodyFormulationTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicMelodyFormulationTrackStream implementation + */ +/* IDirectMusicMelodyFormulationTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrackStream,iface); + + if (IsEqualIID(riid, &IID_IUnknown) + || IsEqualIID(riid, &IID_IPersistStream)) { + IDirectMusicMelodyFormulationTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMelodyFormulationTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMelodyFormulationTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMelodyFormulationTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMelodyFormulationTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicMelodyFormulationTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMelodyFormulationTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicMelodyFormulationTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMelodyFormulationTrackStream_QueryInterface, + IDirectMusicMelodyFormulationTrackStream_AddRef, + IDirectMusicMelodyFormulationTrackStream_Release, + IDirectMusicMelodyFormulationTrackStream_GetClassID, + IDirectMusicMelodyFormulationTrackStream_IsDirty, + IDirectMusicMelodyFormulationTrackStream_Load, + IDirectMusicMelodyFormulationTrackStream_Save, + IDirectMusicMelodyFormulationTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/motiftrack.c b/dlls/dmstyle/motiftrack.c new file mode 100644 index 00000000000..a9deee3c9ef --- /dev/null +++ b/dlls/dmstyle/motiftrack.c @@ -0,0 +1,344 @@ +/* IDirectMusicMotifTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicMotifTrack implementation + */ +/* IDirectMusicMotifTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicMotifTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicMotifTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMotifTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMotifTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMotifTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMotifTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicMotifTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_DisableTimeSig) + || IsEqualGUID (rguidType, &GUID_EnableTimeSig) + || IsEqualGUID (rguidType, &GUID_SeedVariations) + || IsEqualGUID (rguidType, &GUID_Valid_Start_Time)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicMotifTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicMotifTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicMotifTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMotifTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMotifTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMotifTrack_QueryInterface, + IDirectMusicMotifTrack_AddRef, + IDirectMusicMotifTrack_Release, + IDirectMusicMotifTrack_Init, + IDirectMusicMotifTrack_InitPlay, + IDirectMusicMotifTrack_EndPlay, + IDirectMusicMotifTrack_Play, + IDirectMusicMotifTrack_GetParam, + IDirectMusicMotifTrack_SetParam, + IDirectMusicMotifTrack_IsParamSupported, + IDirectMusicMotifTrack_AddNotificationType, + IDirectMusicMotifTrack_RemoveNotificationType, + IDirectMusicMotifTrack_Clone, + IDirectMusicMotifTrack_PlayEx, + IDirectMusicMotifTrack_GetParamEx, + IDirectMusicMotifTrack_SetParamEx, + IDirectMusicMotifTrack_Compose, + IDirectMusicMotifTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicMotifTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicMotifTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMotifTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicMotifTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMotifTrackStream)); + track->pStream->lpVtbl = &DirectMusicMotifTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicMotifTrackStream implementation + */ +/* IDirectMusicMotifTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicMotifTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMotifTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMotifTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMotifTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMotifTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMotifTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMotifTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMotifTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicMotifTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicMotifTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicMotifTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMotifTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicMotifTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMotifTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicMotifTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMotifTrackStream_QueryInterface, + IDirectMusicMotifTrackStream_AddRef, + IDirectMusicMotifTrackStream_Release, + IDirectMusicMotifTrackStream_GetClassID, + IDirectMusicMotifTrackStream_IsDirty, + IDirectMusicMotifTrackStream_Load, + IDirectMusicMotifTrackStream_Save, + IDirectMusicMotifTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/mutetrack.c b/dlls/dmstyle/mutetrack.c new file mode 100644 index 00000000000..280dd1fc722 --- /dev/null +++ b/dlls/dmstyle/mutetrack.c @@ -0,0 +1,384 @@ +/* IDirectMusicMuteTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicMuteTrack implementation + */ +/* IDirectMusicMuteTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicMuteTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicMuteTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMuteTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMuteTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMuteTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMuteTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicMuteTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_MuteParam)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicMuteTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicMuteTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicMuteTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicMuteTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicMuteTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMuteTrack_QueryInterface, + IDirectMusicMuteTrack_AddRef, + IDirectMusicMuteTrack_Release, + IDirectMusicMuteTrack_Init, + IDirectMusicMuteTrack_InitPlay, + IDirectMusicMuteTrack_EndPlay, + IDirectMusicMuteTrack_Play, + IDirectMusicMuteTrack_GetParam, + IDirectMusicMuteTrack_SetParam, + IDirectMusicMuteTrack_IsParamSupported, + IDirectMusicMuteTrack_AddNotificationType, + IDirectMusicMuteTrack_RemoveNotificationType, + IDirectMusicMuteTrack_Clone, + IDirectMusicMuteTrack_PlayEx, + IDirectMusicMuteTrack_GetParamEx, + IDirectMusicMuteTrack_SetParamEx, + IDirectMusicMuteTrack_Compose, + IDirectMusicMuteTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicMuteTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicMuteTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMuteTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicMuteTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMuteTrackStream)); + track->pStream->lpVtbl = &DirectMusicMuteTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicMuteTrackStream implementation + */ +/* IDirectMusicMuteTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicMuteTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicMuteTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicMuteTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicMuteTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMuteTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicMuteTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicMuteTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicMuteTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicMuteTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicMuteTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicMuteTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMuteTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicMuteTrackStream,iface); + FOURCC chunkID; + DWORD chunkSize, dwSizeOfStruct; + LARGE_INTEGER liMove; /* used when skipping chunks */ + IDirectMusicMuteTrack* pTrack = This->pParentTrack; /* that's where we load data to */ + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_MUTE_CHUNK: { + TRACE_(dmfile)(": mute track chunk\n"); + IStream_Read (pStm, &dwSizeOfStruct, sizeof(DWORD), NULL); + if (dwSizeOfStruct != sizeof(DMUS_IO_MUTE)) { + TRACE_(dmfile)(": declared size of struct (=%ld) != actual size (=%i); loading failed\n", dwSizeOfStruct, sizeof(DMUS_IO_MUTE)); + liMove.QuadPart = chunkSize - sizeof(DWORD); + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + chunkSize -= sizeof(DWORD); /* now chunk size is one DWORD shorter */ + pTrack->pMutes = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, chunkSize); + IStream_Read (pStm, pTrack->pMutes, chunkSize, NULL); + pTrack->dwMutes = chunkSize/dwSizeOfStruct; + /* in the end, let's see what we got */ + TRACE_(dmfile)(": reading finished\n"); + if (TRACE_ON(dmfile)) { + int i; + TRACE_(dmfile)(": (READ): number of mutes in track = %ld\n", pTrack->dwMutes); + for (i = 0; i < pTrack->dwMutes; i++) { + TRACE_(dmfile)(": (READ): mute[%i]: mtTime = %li; dwPChannel = %ld; dwPChannelMap = %ld\n", \ + i, pTrack->pMutes[i].mtTime, pTrack->pMutes[i].dwPChannel, pTrack->pMutes[i].dwPChannelMap); + } + } + } + TRACE_(dmfile)(": reading finished\n"); + break; + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicMuteTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicMuteTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicMuteTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicMuteTrackStream_QueryInterface, + IDirectMusicMuteTrackStream_AddRef, + IDirectMusicMuteTrackStream_Release, + IDirectMusicMuteTrackStream_GetClassID, + IDirectMusicMuteTrackStream_IsDirty, + IDirectMusicMuteTrackStream_Load, + IDirectMusicMuteTrackStream_Save, + IDirectMusicMuteTrackStream_GetSizeMax +}; diff --git a/dlls/dmstyle/regsvr.c b/dlls/dmstyle/regsvr.c index f1210d64f88..f165b728e02 100644 --- a/dlls/dmstyle/regsvr.c +++ b/dlls/dmstyle/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); /* * Near the bottom of this file are the exported DllRegisterServer and diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index 58577fbd378..85037816f35 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -25,22 +25,21 @@ #include "dmstyle_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); - -/* IDirectMusicStyle8 IUnknown parts follow: */ +/* IDirectMusicStyle8 IUnknown part: */ HRESULT WINAPI IDirectMusicStyle8Impl_QueryInterface (LPDIRECTMUSICSTYLE8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicStyle8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicStyle) || - IsEqualGUID(riid, &IID_IDirectMusicStyle8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicStyle) || + IsEqualIID (riid, &IID_IDirectMusicStyle8)) { IDirectMusicStyle8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -57,14 +56,13 @@ ULONG WINAPI IDirectMusicStyle8Impl_Release (LPDIRECTMUSICSTYLE8 iface) ICOM_THIS(IDirectMusicStyle8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicStyle Interface part follow: */ +/* IDirectMusicStyle8 IDirectMusicStyle part: */ HRESULT WINAPI IDirectMusicStyle8Impl_GetBand (LPDIRECTMUSICSTYLE8 iface, WCHAR* pwszName, IDirectMusicBand** ppBand) { ICOM_THIS(IDirectMusicStyle8Impl,iface); @@ -164,7 +162,7 @@ HRESULT WINAPI IDirectMusicStyle8Impl_GetTempo (LPDIRECTMUSICSTYLE8 iface, doubl return S_OK; } -/* IDirectMusicStyle8 Interface part follow: */ +/* IDirectMusicStyle8 IDirectMusicStyle8 part: */ HRESULT WINAPI IDirectMusicStyle8ImplEnumPattern (LPDIRECTMUSICSTYLE8 iface, DWORD dwIndex, DWORD dwPatternType, WCHAR* pwszName) { ICOM_THIS(IDirectMusicStyle8Impl,iface); @@ -195,15 +193,219 @@ ICOM_VTABLE(IDirectMusicStyle8) DirectMusicStyle8_Vtbl = }; /* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE* ppDMStyle, LPUNKNOWN pUnkOuter) +HRESULT WINAPI DMUSIC_CreateDirectMusicStyle (LPCGUID lpcGUID, LPDIRECTMUSICSTYLE8* ppDMStyle, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicStyle) || - IsEqualGUID (lpcGUID, &IID_IDirectMusicStyle8)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicStyle8Impl* dmstlye; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicStyle) + || IsEqualIID (lpcGUID, &IID_IDirectMusicStyle8)) { + dmstlye = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyle8Impl)); + if (NULL == dmstlye) { + *ppDMStyle = (LPDIRECTMUSICSTYLE8) NULL; + return E_OUTOFMEMORY; + } + dmstlye->lpVtbl = &DirectMusicStyle8_Vtbl; + dmstlye->ref = 1; + *ppDMStyle = (LPDIRECTMUSICSTYLE8) dmstlye; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicStyleObject implementation + */ +/* IDirectMusicStyleObject IUnknown part: */ +HRESULT WINAPI IDirectMusicStyleObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicStyleObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = (LPPERSISTSTREAM)This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicStyle) + || IsEqualIID (riid, &IID_IDirectMusicStyle8)) { + IDirectMusicStyle8_AddRef ((LPDIRECTMUSICSTYLE8)This->pStyle); + *ppobj = (LPDIRECTMUSICSTYLE8)This->pStyle; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicStyleObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicStyleObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicStyleObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicStyleObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicStyleObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicStyleObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicStyleObject_QueryInterface, + IDirectMusicStyleObject_AddRef, + IDirectMusicStyleObject_Release, + IDirectMusicStyleObject_GetDescriptor, + IDirectMusicStyleObject_SetDescriptor, + IDirectMusicStyleObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicStyleObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicStyleObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicStyleObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleObjectStream)); + obj->pStream->lpVtbl = &DirectMusicStyleObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicStyle */ + DMUSIC_CreateDirectMusicStyle (&IID_IDirectMusicStyle8, (LPDIRECTMUSICSTYLE8*)&obj->pStyle, NULL); + obj->pStyle->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicStyleObjectStream implementation + */ +/* IDirectMusicStyleObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicStyleObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicStyleObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicStyleObjectStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicStyleObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicStyleObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicStyleObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicStyleObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicStyleObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicStyleObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicStyleObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicStyleObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicStyleObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FIXME(": Loading not implemented yet\n"); + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicStyleObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicStyleObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicStyleObjectStream_QueryInterface, + IDirectMusicStyleObjectStream_AddRef, + IDirectMusicStyleObjectStream_Release, + IDirectMusicStyleObjectStream_GetClassID, + IDirectMusicStyleObjectStream_IsDirty, + IDirectMusicStyleObjectStream_Load, + IDirectMusicStyleObjectStream_Save, + IDirectMusicStyleObjectStream_GetSizeMax +}; diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c new file mode 100644 index 00000000000..d0b12896301 --- /dev/null +++ b/dlls/dmstyle/styletrack.c @@ -0,0 +1,531 @@ +/* IDirectMusicStyleTrack Implementation + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" + +#include "dmstyle_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); +WINE_DECLARE_DEBUG_CHANNEL(dmfile); + +/***************************************************************************** + * IDirectMusicStyleTrack implementation + */ +/* IDirectMusicStyleTrack IUnknown part: */ +HRESULT WINAPI IDirectMusicStyleTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicTrack) || + IsEqualIID (riid, &IID_IDirectMusicTrack8)) { + IDirectMusicStyleTrack_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicStyleTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicStyleTrack_AddRef (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicStyleTrack_Release (LPDIRECTMUSICTRACK8 iface) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicStyleTrack IDirectMusicTrack part: */ +HRESULT WINAPI IDirectMusicStyleTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p): stub\n", This, pSegment); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p): stub\n", This, pStateData); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + TRACE("(%p, %s): ", This, debugstr_guid(rguidType)); + if (IsEqualGUID (rguidType, &GUID_DisableTimeSig) + || IsEqualGUID (rguidType, &GUID_EnableTimeSig) + || IsEqualGUID (rguidType, &GUID_IDirectMusicStyle) + || IsEqualGUID (rguidType, &GUID_SeedVariations) + || IsEqualGUID (rguidType, &GUID_TimeSignature)) { + TRACE("param supported\n"); + return S_OK; + } + + TRACE("param unsupported\n"); + return DMUS_E_TYPE_UNSUPPORTED; +} + +HRESULT WINAPI IDirectMusicStyleTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType)); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack); + + return S_OK; +} + +/* IDirectMusicStyleTrack IDirectMusicTrack8 part: */ +HRESULT WINAPI IDirectMusicStyleTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) +{ + ICOM_THIS(IDirectMusicStyleTrack,iface); + + FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicTrack8) DirectMusicStyleTrack_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicStyleTrack_QueryInterface, + IDirectMusicStyleTrack_AddRef, + IDirectMusicStyleTrack_Release, + IDirectMusicStyleTrack_Init, + IDirectMusicStyleTrack_InitPlay, + IDirectMusicStyleTrack_EndPlay, + IDirectMusicStyleTrack_Play, + IDirectMusicStyleTrack_GetParam, + IDirectMusicStyleTrack_SetParam, + IDirectMusicStyleTrack_IsParamSupported, + IDirectMusicStyleTrack_AddNotificationType, + IDirectMusicStyleTrack_RemoveNotificationType, + IDirectMusicStyleTrack_Clone, + IDirectMusicStyleTrack_PlayEx, + IDirectMusicStyleTrack_GetParamEx, + IDirectMusicStyleTrack_SetParamEx, + IDirectMusicStyleTrack_Compose, + IDirectMusicStyleTrack_Join +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicStyleTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter) +{ + IDirectMusicStyleTrack* track; + + if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack) + || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) { + track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleTrack)); + if (NULL == track) { + *ppTrack = (LPDIRECTMUSICTRACK8) NULL; + return E_OUTOFMEMORY; + } + track->lpVtbl = &DirectMusicStyleTrack_Vtbl; + track->ref = 1; + track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleTrackStream)); + track->pStream->lpVtbl = &DirectMusicStyleTrackStream_Vtbl; + track->pStream->ref = 1; + track->pStream->pParentTrack = track; + *ppTrack = (LPDIRECTMUSICTRACK8) track; + return S_OK; + } + WARN("No interface found\n"); + + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicStyleTrackStream implementation + */ +/* IDirectMusicStyleTrackStream IUnknown part follow: */ +HRESULT WINAPI IDirectMusicStyleTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicStyleTrackStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicStyleTrackStream_AddRef(iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicStyleTrackStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicStyleTrackStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicStyleTrackStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicStyleTrackStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicStyleTrackStream IPersist part: */ +HRESULT WINAPI IDirectMusicStyleTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicStyleTrackStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicStyleTrackStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicStyleTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + ICOM_THIS(IDirectMusicStyleTrackStream,iface); + FOURCC chunkID; + DWORD chunkSize, ListSize[3], ListCount[3]; + LARGE_INTEGER liMove; /* used when skipping chunks */ + DMUS_IO_REFERENCE tempReferenceHeader; + DMUS_OBJECTDESC ObjDesc; + IDirectMusicStyleTrack* pTrack = This->pParentTrack; /* that's where we load data to */ + LPDIRECTMUSICLOADER pLoader; + LPDIRECTMUSICGETLOADER pGetLoader; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL); + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[0] = chunkSize - sizeof(FOURCC); + ListCount[0] = 0; + switch (chunkID) { + case DMUS_FOURCC_STYLE_TRACK_LIST: { + TRACE_(dmfile)(": style track list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[1] = chunkSize - sizeof(FOURCC); + ListCount[1] = 0; + switch (chunkID) { + case DMUS_FOURCC_STYLE_REF_LIST: { + TRACE_(dmfile)(": style reference list\n"); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_TIME_STAMP_CHUNK: { + TRACE_(dmfile)(": time stamp chunk\n"); + IStream_Read (pStm, &pTrack->pStampTimes[pTrack->dwStyles], sizeof(DWORD), NULL); + TRACE_(dmfile)(": (READ): time stamp = %ld\n", pTrack->pStampTimes[pTrack->dwStyles]); + break; + } + case FOURCC_LIST: { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID)); + ListSize[2] = chunkSize - sizeof(FOURCC); + ListCount[2] = 0; + switch (chunkID) { + case DMUS_FOURCC_REF_LIST: { + TRACE_(dmfile)(": reference list\n"); + ZeroMemory ((LPVOID)&ObjDesc, sizeof(DMUS_OBJECTDESC)); + do { + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + ListCount[2] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize; + TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); + switch (chunkID) { + case DMUS_FOURCC_REF_CHUNK: { + TRACE_(dmfile)(": reference header chunk\n"); + IStream_Read (pStm, &tempReferenceHeader, chunkSize, NULL); + /* copy retrieved data to DMUS_OBJECTDESC */ + ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC); + ObjDesc.guidClass = tempReferenceHeader.guidClassID; + ObjDesc.dwValidData = tempReferenceHeader.dwValidData; + break; + } + case DMUS_FOURCC_GUID_CHUNK: { + TRACE_(dmfile)(": guid chunk\n"); + IStream_Read (pStm, &ObjDesc.guidObject, chunkSize, NULL); + break; + } + case DMUS_FOURCC_DATE_CHUNK: { + TRACE_(dmfile)(": file date chunk\n"); + IStream_Read (pStm, &ObjDesc.ftDate, chunkSize, NULL); + break; + } + case DMUS_FOURCC_NAME_CHUNK: { + TRACE_(dmfile)(": name chunk\n"); + IStream_Read (pStm, &ObjDesc.wszName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_FILE_CHUNK: { + TRACE_(dmfile)(": file name chunk\n"); + IStream_Read (pStm, &ObjDesc.wszFileName, chunkSize, NULL); + break; + } + case DMUS_FOURCC_CATEGORY_CHUNK: { + TRACE_(dmfile)(": category chunk\n"); + IStream_Read (pStm, &ObjDesc.wszCategory, chunkSize, NULL); + break; + } + case DMUS_FOURCC_VERSION_CHUNK: { + TRACE_(dmfile)(": version chunk\n"); + IStream_Read (pStm, &ObjDesc.vVersion, chunkSize, NULL); + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[2] = %ld < ListSize[2] = %ld\n", ListCount[2], ListSize[2]); + } while (ListCount[2] < ListSize[2]); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + return E_FAIL; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[1] = %ld < ListSize[1] = %ld\n", ListCount[1], ListSize[1]); + } while (ListCount[1] < ListSize[1]); + /* let's see what we have */ + TRACE_(dmfile)(": (READ): reference: dwSize = %ld; dwValidData = %ld; guidObject = %s; guidClass = %s; \ +vVersion = %08lx,%08lx; wszName = %s; wszCategory = %s; wszFileName = %s\n", ObjDesc.dwSize, ObjDesc.dwValidData, debugstr_guid(&ObjDesc.guidObject), debugstr_guid(&ObjDesc.guidClass), \ +ObjDesc.vVersion.dwVersionMS, ObjDesc.vVersion.dwVersionLS, debugstr_w(ObjDesc.wszName), debugstr_w(ObjDesc.wszCategory), debugstr_w(ObjDesc.wszFileName)); + /* now, let's convience loader to load reference */ + if (IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader) == S_OK) { + if (IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader) == S_OK) { + /* load referenced object */ + IDirectMusicObject* pObject; + IDirectMusicLoader_GetObject (pLoader, &ObjDesc, &IID_IDirectMusicObject, (LPVOID*)&pObject); + /* acquire style from loaded referenced object */ + IDirectMusicObject_QueryInterface (pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pTrack->ppStyles[pTrack->dwStyles]); + IDirectMusicLoader_Release (pLoader); + } + IDirectMusicGetLoader_Release (pGetLoader); + } else { + ERR("Could not get IDirectMusicGetLoader... reference will not be loaded :(\n"); + /* E_FAIL */ + } + pTrack->dwStyles++; /* add reference count */ + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + return E_FAIL; + } + } + break; + } + default: { + TRACE_(dmfile)(": unknown chunk (skipping)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip this chunk */ + break; + } + } + TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); + } while (ListCount[0] < ListSize[0]); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = ListSize[0]; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + TRACE_(dmfile)(": reading finished\n"); + break; + } + default: { + TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); + liMove.QuadPart = chunkSize; + IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicStyleTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicStyleTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicStyleTrackStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicStyleTrackStream_QueryInterface, + IDirectMusicStyleTrackStream_AddRef, + IDirectMusicStyleTrackStream_Release, + IDirectMusicStyleTrackStream_GetClassID, + IDirectMusicStyleTrackStream_IsDirty, + IDirectMusicStyleTrackStream_Load, + IDirectMusicStyleTrackStream_Save, + IDirectMusicStyleTrackStream_GetSizeMax +}; diff --git a/dlls/dmsynth/dmsynth_main.c b/dlls/dmsynth/dmsynth_main.c index d7df8bede34..c529981740c 100644 --- a/dlls/dmsynth/dmsynth_main.c +++ b/dlls/dmsynth/dmsynth_main.c @@ -19,15 +19,8 @@ #include "dmsynth_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); - -/****************************************************************** - * DirectMusicSynthesizer ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMSYCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusicSynth ClassFactory + */ +static HRESULT WINAPI SynthCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,52 +39,106 @@ static HRESULT WINAPI DMSYCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPV return E_NOINTERFACE; } -static ULONG WINAPI DMSYCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI SynthCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMSYCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI SynthCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMSYCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI SynthCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusicSynth) || - IsEqualGUID (riid, &IID_IDirectMusicSynth8)) { + if (IsEqualIID (riid, &IID_IDirectMusicSynth) || + IsEqualIID (riid, &IID_IDirectMusicSynth8)) { return DMUSIC_CreateDirectMusicSynth (riid, (LPDIRECTMUSICSYNTH8*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicSynthSink)) { - return DMUSIC_CreateDirectMusicSynthSink (riid, (LPDIRECTMUSICSYNTHSINK*)ppobj, pOuter); - } + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMSYCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI SynthCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMSYCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) SynthCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMSYCF_QueryInterface, - DMSYCF_AddRef, - DMSYCF_Release, - DMSYCF_CreateInstance, - DMSYCF_LockServer + SynthCF_QueryInterface, + SynthCF_AddRef, + SynthCF_Release, + SynthCF_CreateInstance, + SynthCF_LockServer }; -static IClassFactoryImpl DMSYNTH_CF = {&DMSYCF_Vtbl, 1 }; +static IClassFactoryImpl Synth_CF = {&SynthCF_Vtbl, 1 }; +/****************************************************************** + * DirectMusicSynthSink ClassFactory + */ +static HRESULT WINAPI SynthSinkCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI SynthSinkCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI SynthSinkCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI SynthSinkCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicSynthSink)) { + return DMUSIC_CreateDirectMusicSynthSink (riid, (LPDIRECTMUSICSYNTHSINK*)ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI SynthSinkCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) SynthSinkCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + SynthSinkCF_QueryInterface, + SynthSinkCF_AddRef, + SynthSinkCF_Release, + SynthSinkCF_CreateInstance, + SynthSinkCF_LockServer +}; + +static IClassFactoryImpl SynthSink_CF = {&SynthSinkCF_Vtbl, 1 }; + /****************************************************************** * DllMain * @@ -131,11 +181,16 @@ HRESULT WINAPI DMSYNTH_DllCanUnloadNow(void) HRESULT WINAPI DMSYNTH_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMSYNTH_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSynth) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Synth_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSynth) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &SynthSink_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmsynth/regsvr.c b/dlls/dmsynth/regsvr.c index 9a23de94441..eb9c5a7cc22 100644 --- a/dlls/dmsynth/regsvr.c +++ b/dlls/dmsynth/regsvr.c @@ -32,7 +32,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); /* * Near the bottom of this file are the exported DllRegisterServer and diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 10a965cda3b..6e2ad14e790 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -26,21 +26,21 @@ #include "dmsynth_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); -/* IDirectMusicSynth8 IUnknown parts follow: */ +/* IDirectMusicSynth8 IUnknown part: */ HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicSynth8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicSynth) || - IsEqualGUID(riid, &IID_IDirectMusicSynth8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicSynth) || + IsEqualIID (riid, &IID_IDirectMusicSynth8)) { IDirectMusicSynth8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -57,14 +57,13 @@ ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface) ICOM_THIS(IDirectMusicSynth8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicSynth Interface parts follow: */ +/* IDirectMusicSynth8 IDirectMusicSynth part: */ HRESULT WINAPI IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTPARAMS pPortParams) { ICOM_THIS(IDirectMusicSynth8Impl,iface); @@ -223,7 +222,7 @@ HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface, DWOR return S_OK; } -/* IDirectMusicSynth8 Interface parts follow: */ +/* IDirectMusicSynth8 IDirectMusicSynth8 part: */ HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd) { ICOM_THIS(IDirectMusicSynth8Impl,iface); @@ -305,8 +304,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicSynth (LPCGUID lpcGUID, LPDIRECTMUSICSYNT IDirectMusicSynth8Impl *dmsynth; TRACE("(%p,%p,%p)\n", lpcGUID, ppDMSynth, pUnkOuter); - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicSynth) || - IsEqualGUID (lpcGUID, &IID_IDirectMusicSynth8)) { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicSynth) || + IsEqualIID (lpcGUID, &IID_IDirectMusicSynth8)) { dmsynth = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynth8Impl)); if (NULL == dmsynth) { *ppDMSynth = (LPDIRECTMUSICSYNTH8) NULL; diff --git a/dlls/dmsynth/synthsink.c b/dlls/dmsynth/synthsink.c index 0432f650c27..683ddd824a4 100644 --- a/dlls/dmsynth/synthsink.c +++ b/dlls/dmsynth/synthsink.c @@ -25,20 +25,20 @@ #include "dmsynth_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); -/* IDirectMusicSynthSink IUnknown parts follow: */ +/* IDirectMusicSynthSink IUnknown part: */ HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IDirectMusicSynthSinkImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicSynthSink)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicSynthSink)) { IDirectMusicSynthSinkImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,14 +55,13 @@ ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) ICOM_THIS(IDirectMusicSynthSinkImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirectMusicSynth Interface follow: */ +/* IDirectMusicSynth IDirectMusicSynth part: */ HRESULT WINAPI IDirectMusicSynthSinkImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth) { ICOM_THIS(IDirectMusicSynthSinkImpl,iface); @@ -157,7 +156,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSink (LPCGUID lpcGUID, LPDIRECTMUSIC IDirectMusicSynthSinkImpl *dmsink; TRACE("(%p,%p,%p)\n", lpcGUID, ppDMSynthSink, pUnkOuter); - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicSynthSink)) { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicSynthSink)) { dmsink = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl)); if (NULL == dmsink) { *ppDMSynthSink = (LPDIRECTMUSICSYNTHSINK) NULL; @@ -168,7 +167,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSink (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDMSynthSink = (LPDIRECTMUSICSYNTHSINK) dmsink; return S_OK; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/Makefile.in b/dlls/dmusic/Makefile.in index 43adab81874..3b866feb37e 100644 --- a/dlls/dmusic/Makefile.in +++ b/dlls/dmusic/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmusic.dll -IMPORTS = winmm ole32 msacm32 dsound rpcrt4 user32 advapi32 kernel32 +IMPORTS = winmm ole32 msacm32 dsound rpcrt4 user32 advapi32 kernel32 ntdll EXTRALIBS = $(LIBUUID) LDDLLFLAGS = @LDDLLFLAGS@ @@ -17,9 +17,7 @@ C_SRCS = \ dmusic_main.c \ download.c \ downloadedinstrument.c \ - helper.c \ instrument.c \ - object.c \ port.c \ portdownload.c \ regsvr.c \ diff --git a/dlls/dmusic/buffer.c b/dlls/dmusic/buffer.c index 952ded22d46..f1fc22381c5 100644 --- a/dlls/dmusic/buffer.c +++ b/dlls/dmusic/buffer.c @@ -43,12 +43,13 @@ HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface, { ICOM_THIS(IDirectMusicBufferImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicBuffer)) - { + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicBuffer)) { IDirectMusicBufferImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -65,8 +66,7 @@ ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) ICOM_THIS(IDirectMusicBufferImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -214,12 +214,11 @@ ICOM_VTABLE(IDirectMusicBuffer) DirectMusicBuffer_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicBuffer (LPCGUID lpcGUID, LPDIRECTMUSICBUFFER* ppDMBuff, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicBuffer)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicBuffer)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/clock.c b/dlls/dmusic/clock.c index 452e6439327..6f89f9317df 100644 --- a/dlls/dmusic/clock.c +++ b/dlls/dmusic/clock.c @@ -32,13 +32,13 @@ HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFII { ICOM_THIS(IReferenceClockImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IReferenceClock)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IReferenceClock)) { IReferenceClockImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,8 +55,7 @@ ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) ICOM_THIS(IReferenceClockImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -117,7 +116,7 @@ HRESULT WINAPI DMUSIC_CreateReferenceClock (LPCGUID lpcGUID, IReferenceClock** p { IReferenceClockImpl* clock; - if (IsEqualGUID (lpcGUID, &IID_IReferenceClock)) + if (IsEqualIID (lpcGUID, &IID_IReferenceClock)) { clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl)); if (NULL == clock) { @@ -132,7 +131,7 @@ HRESULT WINAPI DMUSIC_CreateReferenceClock (LPCGUID lpcGUID, IReferenceClock** p *ppRC = (IReferenceClock *) clock; return S_OK; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 39dd9454173..1c8da31244f 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -32,12 +32,13 @@ HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface (LPDIRECTMUSICCOLLECTIO { ICOM_THIS(IDirectMusicCollectionImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicCollection)) - { + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicCollection)) { IDirectMusicCollectionImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -54,8 +55,7 @@ ULONG WINAPI IDirectMusicCollectionImpl_Release (LPDIRECTMUSICCOLLECTION iface) ICOM_THIS(IDirectMusicCollectionImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -65,18 +65,34 @@ ULONG WINAPI IDirectMusicCollectionImpl_Release (LPDIRECTMUSICCOLLECTION iface) HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwPatch, IDirectMusicInstrument** ppInstrument) { ICOM_THIS(IDirectMusicCollectionImpl,iface); - - FIXME("(%p, %ld, %p): stub\n", This, dwPatch, ppInstrument); - - return S_OK; + int i; + + TRACE("(%p, %ld, %p)\n", This, dwPatch, ppInstrument); + for (i = 0; i < This->nrofinstruments; i++) { + if (This->ppInstruments[i]->dwPatch == dwPatch) { + *ppInstrument = (LPDIRECTMUSICINSTRUMENT)This->ppInstruments[i]; + return S_OK; + } + } + + return DMUS_E_INVALIDPATCH; } HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwIndex, DWORD* pdwPatch, LPWSTR pwszName, DWORD dwNameLen) { ICOM_THIS(IDirectMusicCollectionImpl,iface); - FIXME("(%p, %ld, %p, %p, %ld): stub\n", This, dwIndex, pdwPatch, pwszName, dwNameLen); - + TRACE("(%p, %ld, %p, %p, %ld)\n", This, dwIndex, pdwPatch, pwszName, dwNameLen); + if (dwIndex > This->nrofinstruments) + return S_FALSE; + *pdwPatch = This->ppInstruments[dwIndex]->dwPatch; + if (pwszName != NULL) { + /* + *pwszName = (LPWSTR)This->ppInstruments[dwIndex]->pwszName; + *dwNameLen = wcslen (This->ppInstruments[dwIndex]->pwszName); + */ + } + return S_OK; } @@ -93,12 +109,228 @@ ICOM_VTABLE(IDirectMusicCollection) DirectMusicCollection_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicCollection (LPCGUID lpcGUID, LPDIRECTMUSICCOLLECTION* ppDMColl, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicCollection)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; + IDirectMusicCollectionImpl *collection; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppDMColl, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicCollection)) { + collection = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionImpl)); + if (NULL == collection) { + *ppDMColl = (LPDIRECTMUSICCOLLECTION) NULL; + return E_OUTOFMEMORY; + } + collection->lpVtbl = &DirectMusicCollection_Vtbl; + collection->ref = 1; + *ppDMColl = (LPDIRECTMUSICCOLLECTION) collection; + return S_OK; + } + + WARN("No interface found\n"); + return E_NOINTERFACE; +} + + +/***************************************************************************** + * IDirectMusicCollectionObject implementation + */ +/* IDirectMusicCollectionObject IUnknown part: */ +HRESULT WINAPI IDirectMusicCollectionObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicObject)) { + IDirectMusicCollectionObject_AddRef(iface); + *ppobj = This; + return S_OK; + } else if (IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicCollectionObjectStream_AddRef ((LPPERSISTSTREAM)This->pStream); + *ppobj = This->pStream; + return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicCollection)) { + IDirectMusicCollectionImpl_AddRef ((LPDIRECTMUSICCOLLECTION)This->pCollection); + *ppobj = This->pCollection; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicCollectionObject_AddRef (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicCollectionObject_Release (LPDIRECTMUSICOBJECT iface) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicCollectionObject IDirectMusicObject part: */ +HRESULT WINAPI IDirectMusicCollectionObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + pDesc = This->pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCollectionObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + + TRACE("(%p, %p)\n", This, pDesc); + This->pDesc = pDesc; + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCollectionObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ + ICOM_THIS(IDirectMusicCollectionObject,iface); + + FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); + + return S_OK; +} + +ICOM_VTABLE(IDirectMusicObject) DirectMusicCollectionObject_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicCollectionObject_QueryInterface, + IDirectMusicCollectionObject_AddRef, + IDirectMusicCollectionObject_Release, + IDirectMusicCollectionObject_GetDescriptor, + IDirectMusicCollectionObject_SetDescriptor, + IDirectMusicCollectionObject_ParseDescriptor +}; + +/* for ClassFactory */ +HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter) +{ + IDirectMusicCollectionObject *obj; + + TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter); + if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) { + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionObject)); + if (NULL == obj) { + *ppObject = (LPDIRECTMUSICOBJECT) NULL; + return E_OUTOFMEMORY; + } + obj->lpVtbl = &DirectMusicCollectionObject_Vtbl; + obj->ref = 1; + /* prepare IPersistStream */ + obj->pStream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionObjectStream)); + obj->pStream->lpVtbl = &DirectMusicCollectionObjectStream_Vtbl; + obj->pStream->ref = 1; + obj->pStream->pParentObject = obj; + /* prepare IDirectMusicCollection */ + DMUSIC_CreateDirectMusicCollection (&IID_IDirectMusicCollection, (LPDIRECTMUSICCOLLECTION*)&obj->pCollection, NULL); + obj->pCollection->pObject = obj; + *ppObject = (LPDIRECTMUSICOBJECT) obj; + return S_OK; } WARN("No interface found\n"); - return E_NOINTERFACE; + return E_NOINTERFACE; } + +/***************************************************************************** + * IDirectMusicCollectionObjectStream implementation + */ +/* IDirectMusicCollectionObjectStream IUnknown part: */ +HRESULT WINAPI IDirectMusicCollectionObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IDirectMusicCollectionObjectStream,iface); + + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IPersistStream)) { + IDirectMusicCollectionObjectStream_AddRef (iface); + *ppobj = This; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IDirectMusicCollectionObjectStream_AddRef (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicCollectionObjectStream,iface); + TRACE("(%p) : AddRef from %ld\n", This, This->ref); + return ++(This->ref); +} + +ULONG WINAPI IDirectMusicCollectionObjectStream_Release (LPPERSISTSTREAM iface) +{ + ICOM_THIS(IDirectMusicCollectionObjectStream,iface); + ULONG ref = --This->ref; + TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +/* IDirectMusicCollectionObjectStream IPersist part: */ +HRESULT WINAPI IDirectMusicCollectionObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) +{ + return E_NOTIMPL; +} + +/* IDirectMusicCollectionObjectStream IPersistStream part: */ +HRESULT WINAPI IDirectMusicCollectionObjectStream_IsDirty (LPPERSISTSTREAM iface) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicCollectionObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm) +{ + FOURCC chunkID; + DWORD chunkSize; + + IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL); + IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL); + + if (chunkID == FOURCC_RIFF) { + FIXME(": Loading not implemented yet\n"); + } else { + WARN("Not a RIFF file\n"); + return E_FAIL; + } + + return S_OK; +} + +HRESULT WINAPI IDirectMusicCollectionObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI IDirectMusicCollectionObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) +{ + return E_NOTIMPL; +} + +ICOM_VTABLE(IPersistStream) DirectMusicCollectionObjectStream_Vtbl = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDirectMusicCollectionObjectStream_QueryInterface, + IDirectMusicCollectionObjectStream_AddRef, + IDirectMusicCollectionObjectStream_Release, + IDirectMusicCollectionObjectStream_GetClassID, + IDirectMusicCollectionObjectStream_IsDirty, + IDirectMusicCollectionObjectStream_Load, + IDirectMusicCollectionObjectStream_Save, + IDirectMusicCollectionObjectStream_GetSizeMax +}; diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index 9674a82a649..21e3414656e 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -22,7 +22,6 @@ #include "winreg.h" #include "winuser.h" #include "wingdi.h" -#include "winuser.h" #include "winerror.h" #include "mmsystem.h" #include "winternl.h" @@ -41,14 +40,14 @@ HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID ri { ICOM_THIS(IDirectMusic8Impl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusic2) || - IsEqualGUID(riid, &IID_IDirectMusic8)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusic2) || + IsEqualIID (riid, &IID_IDirectMusic8)) { IDirectMusic8Impl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -65,8 +64,7 @@ ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) ICOM_THIS(IDirectMusic8Impl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -132,7 +130,7 @@ HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rcls TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter); for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) { - if (IsEqualGUID(rclsidPort, &PortCaps.guidPort)) { + if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) { This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports); if (NULL == This->ppPorts[This->nrofports]) { *ppPort = (LPDIRECTMUSICPORT)NULL; @@ -310,9 +308,9 @@ HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC8 *ppDM, IDirectMusic8Impl *dmusic; TRACE("(%p,%p,%p)\n",lpcGUID, ppDM, pUnkOuter); - if (IsEqualGUID(lpcGUID, &IID_IDirectMusic) || - IsEqualGUID(lpcGUID, &IID_IDirectMusic2) || - IsEqualGUID(lpcGUID, &IID_IDirectMusic8)) { + if (IsEqualIID (lpcGUID, &IID_IDirectMusic) || + IsEqualIID (lpcGUID, &IID_IDirectMusic2) || + IsEqualIID (lpcGUID, &IID_IDirectMusic8)) { dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl)); if (NULL == dmusic) { *ppDM = (LPDIRECTMUSIC8) NULL; @@ -328,7 +326,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC8 *ppDM, *ppDM = (LPDIRECTMUSIC8) dmusic; return S_OK; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/dmusic_main.c b/dlls/dmusic/dmusic_main.c index 53614bdca56..b258888cb1c 100644 --- a/dlls/dmusic/dmusic_main.c +++ b/dlls/dmusic/dmusic_main.c @@ -21,13 +21,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/****************************************************************** - * DirectMusic ClassFactory - * - * - */ - typedef struct { /* IUnknown fields */ @@ -35,7 +28,10 @@ typedef struct DWORD ref; } IClassFactoryImpl; -static HRESULT WINAPI DMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +/****************************************************************** + * DirectMusic ClassFactory + */ +static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); @@ -43,71 +39,108 @@ static HRESULT WINAPI DMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOI return E_NOINTERFACE; } -static ULONG WINAPI DMCF_AddRef(LPCLASSFACTORY iface) +static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); return ++(This->ref); } -static ULONG WINAPI DMCF_Release(LPCLASSFACTORY iface) +static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); /* static class, won't be freed */ return --(This->ref); } -static HRESULT WINAPI DMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { ICOM_THIS(IClassFactoryImpl,iface); TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); - if (IsEqualGUID (riid, &IID_IDirectMusic) || - IsEqualGUID (riid, &IID_IDirectMusic2) || - IsEqualGUID (riid, &IID_IDirectMusic8)) { + if (IsEqualIID (riid, &IID_IDirectMusic) || + IsEqualIID (riid, &IID_IDirectMusic2) || + IsEqualIID (riid, &IID_IDirectMusic8)) { return DMUSIC_CreateDirectMusic (riid, (LPDIRECTMUSIC8*) ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicBuffer)) { - return DMUSIC_CreateDirectMusicBuffer (riid, (LPDIRECTMUSICBUFFER*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicInstrument)) { - return DMUSIC_CreateDirectMusicInstrument (riid, (LPDIRECTMUSICINSTRUMENT*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicDownloadedInstrument)) { - return DMUSIC_CreateDirectMusicDownloadedInstrument (riid, (LPDIRECTMUSICDOWNLOADEDINSTRUMENT*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicCollection)) { - return DMUSIC_CreateDirectMusicCollection (riid, (LPDIRECTMUSICCOLLECTION*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicDownload)) { - return DMUSIC_CreateDirectMusicDownload (riid, (LPDIRECTMUSICDOWNLOAD*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicPortDownload)) { - return DMUSIC_CreateDirectMusicPortDownload (riid, (LPDIRECTMUSICPORTDOWNLOAD*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicPort)) { - return DMUSIC_CreateDirectMusicPort (riid, (LPDIRECTMUSICPORT*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicThru)) { - return DMUSIC_CreateDirectMusicThru (riid, (LPDIRECTMUSICTHRU*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IDirectMusicObject)) { - return DMUSIC_CreateDirectMusicObject (riid, (LPDIRECTMUSICOBJECT*)ppobj, pOuter); - } else if (IsEqualGUID (riid, &IID_IReferenceClock)) { - return DMUSIC_CreateReferenceClock (riid, (IReferenceClock**)ppobj, pOuter); } WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } -static HRESULT WINAPI DMCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { ICOM_THIS(IClassFactoryImpl,iface); FIXME("(%p)->(%d),stub!\n", This, dolock); return S_OK; } -static ICOM_VTABLE(IClassFactory) DMCF_Vtbl = { +static ICOM_VTABLE(IClassFactory) DirectMusicCF_Vtbl = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - DMCF_QueryInterface, - DMCF_AddRef, - DMCF_Release, - DMCF_CreateInstance, - DMCF_LockServer + DirectMusicCF_QueryInterface, + DirectMusicCF_AddRef, + DirectMusicCF_Release, + DirectMusicCF_CreateInstance, + DirectMusicCF_LockServer }; -static IClassFactoryImpl DMUSIC_CF = {&DMCF_Vtbl, 1 }; +static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl, 1 }; + +/****************************************************************** + * DirectMusicCollection ClassFactory + */ +static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + return ++(This->ref); +} + +static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) +{ + ICOM_THIS(IClassFactoryImpl,iface); + /* static class, won't be freed */ + return --(This->ref); +} + +static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + ICOM_THIS(IClassFactoryImpl,iface); + + TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj); + if (IsEqualIID (riid, &IID_IDirectMusicCollection)) { + return DMUSIC_CreateDirectMusicCollection (riid, (LPDIRECTMUSICCOLLECTION*)ppobj, pOuter); + } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { + return DMUSIC_CreateDirectMusicCollectionObject (riid, (LPDIRECTMUSICOBJECT*)ppobj, pOuter); + } + + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI CollectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) +{ + ICOM_THIS(IClassFactoryImpl,iface); + FIXME("(%p)->(%d),stub!\n", This, dolock); + return S_OK; +} + +static ICOM_VTABLE(IClassFactory) CollectionCF_Vtbl = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + CollectionCF_QueryInterface, + CollectionCF_AddRef, + CollectionCF_Release, + CollectionCF_CreateInstance, + CollectionCF_LockServer +}; + +static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl, 1 }; /****************************************************************** * DllMain @@ -150,12 +183,17 @@ HRESULT WINAPI DMUSIC_DllCanUnloadNow(void) */ HRESULT WINAPI DMUSIC_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { - TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - if (IsEqualCLSID (&IID_IClassFactory, riid)) { - *ppv = (LPVOID) &DMUSIC_CF; - IClassFactory_AddRef((IClassFactory*)*ppv); - return S_OK; - } + TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + if (IsEqualCLSID (rclsid, &CLSID_DirectMusic) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &DirectMusic_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCollection) && IsEqualIID (riid, &IID_IClassFactory)) { + *ppv = (LPVOID) &Collection_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 4299b0ae47b..71fd3108bf2 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -43,9 +43,11 @@ typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl; typedef struct IDirectMusicPortImpl IDirectMusicPortImpl; typedef struct IDirectMusicThruImpl IDirectMusicThruImpl; -typedef struct IDirectMusicObjectImpl IDirectMusicObjectImpl; typedef struct IReferenceClockImpl IReferenceClockImpl; +typedef struct IDirectMusicCollectionObject IDirectMusicCollectionObject; +typedef struct IDirectMusicCollectionObjectStream IDirectMusicCollectionObjectStream; + /***************************************************************************** * Predeclare the interface implementation structures */ @@ -58,9 +60,11 @@ extern ICOM_VTABLE(IDirectMusicDownload) DirectMusicDownload_Vtbl; extern ICOM_VTABLE(IDirectMusicPortDownload) DirectMusicPortDownload_Vtbl; extern ICOM_VTABLE(IDirectMusicPort) DirectMusicPort_Vtbl; extern ICOM_VTABLE(IDirectMusicThru) DirectMusicThru_Vtbl; -extern ICOM_VTABLE(IDirectMusicObject) DirectMusicObject_Vtbl; extern ICOM_VTABLE(IReferenceClock) ReferenceClock_Vtbl; +extern ICOM_VTABLE(IDirectMusicObject) DirectMusicCollectionObject_Vtbl; +extern ICOM_VTABLE(IPersistStream) DirectMusicCollectionObjectStream_Vtbl; + /***************************************************************************** * Some stuff to make my life easier :=) */ @@ -241,12 +245,11 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicThru (LPCGUID lpcGUID, LPDIRECTMUS /* can support IID_IDirectMusicObject * return always an IDirectMusicObjectImpl */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppDMObj, LPUNKNOWN pUnkOuter); -/* can support IID_IReferenceClock - * return always an IReferenceClockImpl - */ + extern HRESULT WINAPI DMUSIC_CreateReferenceClock (LPCGUID lpcGUID, IReferenceClock** ppDM, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter); + /***************************************************************************** * IDirectMusic8Impl implementation structure */ @@ -320,7 +323,8 @@ struct IDirectMusicInstrumentImpl DWORD ref; /* IDirectMusicInstrumentImpl fields */ - DWORD patch; + DWORD dwPatch; + LPWSTR pwszName; }; /* IUnknown: */ @@ -360,6 +364,9 @@ struct IDirectMusicCollectionImpl DWORD ref; /* IDirectMusicCollectionImpl fields */ + IDirectMusicCollectionObject* pObject; + DWORD nrofinstruments; + IDirectMusicInstrumentImpl** ppInstruments; }; /* IUnknown: */ @@ -474,28 +481,6 @@ extern ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface); /* IDirectMusicPortDownloadImpl: */ extern HRESULT WINAPI ThruChannel (LPDIRECTMUSICTHRU iface, DWORD dwSourceChannelGroup, DWORD dwSourceChannel, DWORD dwDestinationChannelGroup, DWORD dwDestinationChannel, LPDIRECTMUSICPORT pDestinationPort); -/***************************************************************************** - * IDirectMusicObjectImpl implementation structure - */ -struct IDirectMusicObjectImpl -{ - /* IUnknown fields */ - ICOM_VFIELD(IDirectMusicObject); - DWORD ref; - - /* IDirectMusicObjectImpl fields */ - LPDMUS_OBJECTDESC pDesc; -}; - -/* IUnknown: */ -extern HRESULT WINAPI IDirectMusicObjectImpl_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); -extern ULONG WINAPI IDirectMusicObjectImpl_AddRef (LPDIRECTMUSICOBJECT iface); -extern ULONG WINAPI IDirectMusicObjectImpl_Release (LPDIRECTMUSICOBJECT iface); -/* IDirectMusicObject: */ -extern HRESULT WINAPI IDirectMusicObjectImpl_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); -extern HRESULT WINAPI IDirectMusicObjectImpl_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); -extern HRESULT WINAPI IDirectMusicObjectImpl_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); - /***************************************************************************** * IReferenceClockImpl implementation structure */ @@ -521,6 +506,56 @@ extern HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface extern HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie); +/***************************************************************************** + * IDirectMusicCollectionObject implementation structure + */ +struct IDirectMusicCollectionObject +{ + /* IUnknown fields */ + ICOM_VFIELD (IDirectMusicObject); + DWORD ref; + + /* IDirectMusicObjectImpl fields */ + LPDMUS_OBJECTDESC pDesc; + IDirectMusicCollectionObjectStream* pStream; + IDirectMusicCollectionImpl* pCollection; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicCollectionObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); +extern ULONG WINAPI IDirectMusicCollectionObject_AddRef (LPDIRECTMUSICOBJECT iface); +extern ULONG WINAPI IDirectMusicCollectionObject_Release (LPDIRECTMUSICOBJECT iface); +/* IDirectMusicObject: */ +extern HRESULT WINAPI IDirectMusicCollectionObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicCollectionObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); +extern HRESULT WINAPI IDirectMusicCollectionObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); + +/***************************************************************************** + * IDirectMusicCollectionObjectStream implementation structure + */ +struct IDirectMusicCollectionObjectStream +{ + /* IUnknown fields */ + ICOM_VFIELD (IPersistStream); + DWORD ref; + + /* IPersistStreamImpl fields */ + IDirectMusicCollectionObject* pParentObject; +}; + +/* IUnknown: */ +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); +extern ULONG WINAPI IDirectMusicCollectionObjectStream_AddRef (LPPERSISTSTREAM iface); +extern ULONG WINAPI IDirectMusicCollectionObjectStream_Release (LPPERSISTSTREAM iface); +/* IPersist: */ +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); +/* IPersistStream: */ +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_IsDirty (LPPERSISTSTREAM iface); +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm); +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); +extern HRESULT WINAPI IDirectMusicCollectionObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); + + /***************************************************************************** * Helper Functions */ diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index e19574e5eb3..816622ca909 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -41,12 +41,13 @@ HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD if { ICOM_THIS(IDirectMusicDownloadImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicDownload)) - { + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicDownload)) { IDirectMusicDownloadImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -63,8 +64,7 @@ ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) ICOM_THIS(IDirectMusicDownloadImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -92,12 +92,11 @@ ICOM_VTABLE(IDirectMusicDownload) DirectMusicDownload_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicDownload (LPCGUID lpcGUID, LPDIRECTMUSICDOWNLOAD* ppDMDL, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicDownload)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicDownload)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/downloadedinstrument.c b/dlls/dmusic/downloadedinstrument.c index 08bf7a73cbd..212bf622e37 100644 --- a/dlls/dmusic/downloadedinstrument.c +++ b/dlls/dmusic/downloadedinstrument.c @@ -32,12 +32,13 @@ HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSI { ICOM_THIS(IDirectMusicDownloadedInstrumentImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicDownloadedInstrument)) - { + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument)) { IDirectMusicDownloadedInstrumentImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -54,8 +55,7 @@ ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOAD ICOM_THIS(IDirectMusicDownloadedInstrumentImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -75,12 +75,11 @@ ICOM_VTABLE(IDirectMusicDownloadedInstrument) DirectMusicDownloadedInstrument_Vt /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrument (LPCGUID lpcGUID, LPDIRECTMUSICDOWNLOADEDINSTRUMENT* ppDMDLInstrument, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicDownloadedInstrument)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicDownloadedInstrument)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); - + + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 3386c46d60f..667f54e8859 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -32,12 +32,13 @@ HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface (LPDIRECTMUSICINSTRUMEN { ICOM_THIS(IDirectMusicInstrumentImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicInstrument)) - { + if (IsEqualIID (riid, &IID_IUnknown) + || IsEqualIID (riid, &IID_IDirectMusicInstrument)) { IDirectMusicInstrumentImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -54,8 +55,7 @@ ULONG WINAPI IDirectMusicInstrumentImpl_Release (LPDIRECTMUSICINSTRUMENT iface) ICOM_THIS(IDirectMusicInstrumentImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -67,7 +67,7 @@ HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch (LPDIRECTMUSICINSTRUMENT ifac ICOM_THIS(IDirectMusicInstrumentImpl,iface); TRACE("(%p, %p)\n", This, pdwPatch); - *pdwPatch = This->patch; + *pdwPatch = This->dwPatch; return S_OK; } @@ -77,7 +77,7 @@ HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch (LPDIRECTMUSICINSTRUMENT ifac ICOM_THIS(IDirectMusicInstrumentImpl,iface); TRACE("(%p, %ld)\n", This, dwPatch); - This->patch = dwPatch; + This->dwPatch = dwPatch; return S_OK; } @@ -95,12 +95,11 @@ ICOM_VTABLE(IDirectMusicInstrument) DirectMusicInstrument_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicInstrument (LPCGUID lpcGUID, LPDIRECTMUSICINSTRUMENT* ppDMInstr, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicInstrument)) - { + if (IsEqualIID (lpcGUID, &IID_IDirectMusicInstrument)) { FIXME("Not yet\n"); return E_NOINTERFACE; } + WARN("No interface found\n"); - return E_NOINTERFACE; } diff --git a/dlls/dmusic/object.c b/dlls/dmusic/object.c deleted file mode 100644 index f0e5f0589c5..00000000000 --- a/dlls/dmusic/object.c +++ /dev/null @@ -1,127 +0,0 @@ -/* IDirectMusicObject Implementation - * - * Copyright (C) 2003 Rok Mandeljc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winuser.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "mmsystem.h" -#include "winternl.h" -#include "mmddk.h" -#include "wine/windef16.h" -#include "wine/winbase16.h" -#include "wine/debug.h" -#include "dsound.h" - -#include "dmusic_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/* IDirectMusicObject IUnknown parts follow: */ -HRESULT WINAPI IDirectMusicObjectImpl_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicObject)) - { - IDirectMusicObjectImpl_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); - return E_NOINTERFACE; -} - -ULONG WINAPI IDirectMusicObjectImpl_AddRef (LPDIRECTMUSICOBJECT iface) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); -} - -ULONG WINAPI IDirectMusicObjectImpl_Release (LPDIRECTMUSICOBJECT iface) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* IDirectMusicObject Interface follow: */ -HRESULT WINAPI IDirectMusicObjectImpl_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - - TRACE("(%p, %p)\n", This, pDesc); - pDesc = This->pDesc; - - return S_OK; -} - -HRESULT WINAPI IDirectMusicObjectImpl_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - - TRACE("(%p, %p)\n", This, pDesc); - This->pDesc = pDesc; - - return S_OK; -} - -HRESULT WINAPI IDirectMusicObjectImpl_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) -{ - ICOM_THIS(IDirectMusicObjectImpl,iface); - - FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc); - - return S_OK; -} - -ICOM_VTABLE(IDirectMusicObject) DirectMusicObject_Vtbl = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - IDirectMusicObjectImpl_QueryInterface, - IDirectMusicObjectImpl_AddRef, - IDirectMusicObjectImpl_Release, - IDirectMusicObjectImpl_GetDescriptor, - IDirectMusicObjectImpl_SetDescriptor, - IDirectMusicObjectImpl_ParseDescriptor -}; - -/* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppDMObj, LPUNKNOWN pUnkOuter) -{ - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicObject)) - { - FIXME("Not yet\n"); - return E_NOINTERFACE; - } - WARN("No interface found\n"); - - return E_NOINTERFACE; -} diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index a2ed0aca058..f18dd03b4cc 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -32,12 +32,12 @@ HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REF { ICOM_THIS(IDirectMusicPortImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort)) - { + if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort)) { IDirectMusicPortImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -54,8 +54,7 @@ ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) ICOM_THIS(IDirectMusicPortImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -246,7 +245,7 @@ ICOM_VTABLE(IDirectMusicPort) DirectMusicPort_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicPort (LPCGUID lpcGUID, LPDIRECTMUSICPORT* ppDMPort, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicPort)) + if (IsEqualIID (lpcGUID, &IID_IDirectMusicPort)) { FIXME("Not yet\n"); return E_NOINTERFACE; diff --git a/dlls/dmusic/portdownload.c b/dlls/dmusic/portdownload.c index 27cd463b342..c839dcde877 100644 --- a/dlls/dmusic/portdownload.c +++ b/dlls/dmusic/portdownload.c @@ -32,12 +32,12 @@ HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOW { ICOM_THIS(IDirectMusicPortDownloadImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPortDownload)) - { + if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPortDownload)) { IDirectMusicPortDownloadImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); return E_NOINTERFACE; } @@ -54,8 +54,7 @@ ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD ifa ICOM_THIS(IDirectMusicPortDownloadImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -133,12 +132,12 @@ ICOM_VTABLE(IDirectMusicPortDownload) DirectMusicPortDownload_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicPortDownload (LPCGUID lpcGUID, LPDIRECTMUSICPORTDOWNLOAD* ppDMPortDL, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicPortDownload)) + if (IsEqualIID (lpcGUID, &IID_IDirectMusicPortDownload)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); - + + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic/thru.c b/dlls/dmusic/thru.c index 7853857df2a..169679f19a0 100644 --- a/dlls/dmusic/thru.c +++ b/dlls/dmusic/thru.c @@ -32,13 +32,13 @@ HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REF { ICOM_THIS(IDirectMusicThruImpl,iface); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDirectMusicThru)) - { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualIID (riid, &IID_IDirectMusicThru)) { IDirectMusicThruImpl_AddRef(iface); *ppobj = This; return S_OK; } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); return E_NOINTERFACE; } @@ -55,8 +55,7 @@ ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) ICOM_THIS(IDirectMusicThruImpl,iface); ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) - { + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -84,12 +83,12 @@ ICOM_VTABLE(IDirectMusicThru) DirectMusicThru_Vtbl = /* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicThru (LPCGUID lpcGUID, LPDIRECTMUSICTHRU* ppDMThru, LPUNKNOWN pUnkOuter) { - if (IsEqualGUID (lpcGUID, &IID_IDirectMusicThru)) + if (IsEqualIID (lpcGUID, &IID_IDirectMusicThru)) { FIXME("Not yet\n"); return E_NOINTERFACE; } - WARN("No interface found\n"); + WARN("No interface found\n"); return E_NOINTERFACE; } diff --git a/dlls/dmusic32/dmusic32.spec b/dlls/dmusic32/dmusic32.spec index 7fb7e9dfd0b..82b0fc30b91 100644 --- a/dlls/dmusic32/dmusic32.spec +++ b/dlls/dmusic32/dmusic32.spec @@ -1,2 +1,2 @@ -1 stub CreateCDirectMusicEmulatePort -2 stub EnumLegacyDevices +1 stdcall CreateCDirectMusicEmulatePort (ptr ptr ptr) DMUSIC32_CreateCDirectMusicEmulatePort +2 stdcall EnumLegacyDevices (ptr ptr) DMUSIC32_EnumLegacyDevices diff --git a/dlls/dmusic32/dmusic32_main.c b/dlls/dmusic32/dmusic32_main.c index 67a01ed518c..cc10d1174dd 100644 --- a/dlls/dmusic32/dmusic32_main.c +++ b/dlls/dmusic32/dmusic32_main.c @@ -1 +1,37 @@ -/* nothing here yet */ +/* DirectMusic32 Main + * + * Copyright (C) 2003 Rok Mandeljc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "windef.h" +#include "wine/debug.h" +#include "winbase.h" +#include "winnt.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmusic); + +HRESULT WINAPI DMUSIC32_CreateCDirectMusicEmulatePort (LPVOID ptr1, LPVOID ptr2, LPVOID ptr3) +{ + FIXME("stub (undocumented function); if you see this, you're probably using native dmusic.dll. Use native dmusic32.dll as well!\n"); + return S_OK; +} + +HRESULT WINAPI DMUSIC32_EnumLegacyDevices (LPVOID ptr1, LPVOID ptr2) +{ + FIXME("stub (undocumented function); if you see this, you're probably using native dmusic.dll. Use native dmusic32.dll as well!\n"); + return S_OK; +} diff --git a/winedefault.reg b/winedefault.reg index f416c00d029..0203d3e5798 100644 --- a/winedefault.reg +++ b/winedefault.reg @@ -2086,6 +2086,9 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Microsoft.DirectMusicBandTrack.1\CLSID] @="{D2AC2894-B39B-11D1-8704-00600893B1BD}" +[HKEY_LOCAL_MACHINE\Software\Microsoft\DirectMusic] +@="" +"GMFilePath"="c:\\windows\\system32\\drivers\\gm.dls" [HKEY_LOCAL_MACHINE\Software\Microsoft\DirectMusic\SoftwareSynths\{58C2B4D0-46E7-11D1-89AC-00A0C9054129}] @="" "Description"="Microsoft Software Synthesizer"