- import dmusic from Wine, it's mostly stubs but it should be enough for now

svn path=/trunk/; revision=41417
This commit is contained in:
Kamil Hornicek 2009-06-15 13:52:04 +00:00
parent 098b2bd1c3
commit adfe334f22
18 changed files with 3667 additions and 0 deletions

View file

@ -148,6 +148,7 @@ dll\cpl\timedate\timedate.cpl 1
dll\directx\amstream\amstream.dll 1
dll\directx\dinput\dinput.dll 1
dll\directx\dinput8\dinput8.dll 1
dll\directx\dmusic\dmusic.dll 1
dll\directx\dplay\dplay.dll 1
dll\directx\dplayx\dplayx.dll 1
dll\directx\dsound\dsound.dll 1

View file

@ -16,6 +16,9 @@
<directory name="dinput8">
<xi:include href="dinput8/dinput8.rbuild" />
</directory>
<directory name="dmusic">
<xi:include href="dmusic/dmusic.rbuild" />
</directory>
<directory name="dplay">
<xi:include href="dplay/dplay.rbuild" />
</directory>

View file

@ -0,0 +1,175 @@
/* IDirectMusicBuffer Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusicBufferImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
TRACE("(%p, (%s, %p)\n",This,debugstr_dmguid(riid),ppobj);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicBuffer)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, (%s, %p): not found\n",This,debugstr_dmguid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */
static HRESULT WINAPI IDirectMusicBufferImpl_Flush (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p): stub\n", This);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, prtTime);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD dwChannelMessage) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s, %d, %d): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, dwChannelMessage);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p): stub\n", This);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr (LPDIRECTMUSICBUFFER iface, LPBYTE* ppData) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, ppData);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, prt);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pcb);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pcb);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat (LPDIRECTMUSICBUFFER iface, LPGUID pGuidFormat) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pGuidFormat);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s): stub\n", This, wine_dbgstr_longlong(rt));
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes (LPDIRECTMUSICBUFFER iface, DWORD cb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %d): stub\n", This, cb);
return S_OK;
}
static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
IDirectMusicBufferImpl_QueryInterface,
IDirectMusicBufferImpl_AddRef,
IDirectMusicBufferImpl_Release,
IDirectMusicBufferImpl_Flush,
IDirectMusicBufferImpl_TotalTime,
IDirectMusicBufferImpl_PackStructured,
IDirectMusicBufferImpl_PackUnstructured,
IDirectMusicBufferImpl_ResetReadPtr,
IDirectMusicBufferImpl_GetNextEvent,
IDirectMusicBufferImpl_GetRawBufferPtr,
IDirectMusicBufferImpl_GetStartTime,
IDirectMusicBufferImpl_GetUsedBytes,
IDirectMusicBufferImpl_GetMaxBytes,
IDirectMusicBufferImpl_GetBufferFormat,
IDirectMusicBufferImpl_SetStartTime,
IDirectMusicBufferImpl_SetUsedBytes
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicBufferImpl* dmbuff;
dmbuff = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
if (NULL == dmbuff) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmbuff->lpVtbl = &DirectMusicBuffer_Vtbl;
dmbuff->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicBufferImpl_QueryInterface ((LPDIRECTMUSICBUFFER)dmbuff, lpcGUID, ppobj);
}

View file

@ -0,0 +1,116 @@
/* IReferenceClock Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IReferenceClockImpl IUnknown part: */
static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) ||
IsEqualIID (riid, &IID_IReferenceClock)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IReferenceClockImpl IReferenceClock part: */
static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
TRACE("(%p, %p)\n", This, pTime);
*pTime = This->rtTime;
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, %d): stub\n", This, dwAdviseCookie);
return S_OK;
}
static const IReferenceClockVtbl ReferenceClock_Vtbl = {
IReferenceClockImpl_QueryInterface,
IReferenceClockImpl_AddRef,
IReferenceClockImpl_Release,
IReferenceClockImpl_GetTime,
IReferenceClockImpl_AdviseTime,
IReferenceClockImpl_AdvisePeriodic,
IReferenceClockImpl_Unadvise
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IReferenceClockImpl* clock;
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
if (NULL == clock) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
clock->lpVtbl = &ReferenceClock_Vtbl;
clock->ref = 0; /* will be inited by QueryInterface */
clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj);
}

View file

@ -0,0 +1,778 @@
/* IDirectMusicCollection Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
static ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_AddRef (LPUNKNOWN iface);
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef (LPDIRECTMUSICCOLLECTION iface);
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
/*****************************************************************************
* IDirectMusicCollectionImpl implementation
*/
/* IDirectMusicCollectionImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = &This->UnknownVtbl;
IDirectMusicCollectionImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicCollection)) {
*ppobj = &This->CollectionVtbl;
IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef ((LPDIRECTMUSICCOLLECTION)&This->CollectionVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
*ppobj = &This->ObjectVtbl;
IDirectMusicCollectionImpl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = &This->PersistStreamVtbl;
IDirectMusicCollectionImpl_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
static const IUnknownVtbl DirectMusicCollection_Unknown_Vtbl = {
IDirectMusicCollectionImpl_IUnknown_QueryInterface,
IDirectMusicCollectionImpl_IUnknown_AddRef,
IDirectMusicCollectionImpl_IUnknown_Release
};
/* IDirectMusicCollectionImpl IDirectMusicCollection part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInterface (LPDIRECTMUSICCOLLECTION iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, CollectionVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef (LPDIRECTMUSICCOLLECTION iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, CollectionVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_Release (LPDIRECTMUSICCOLLECTION iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, CollectionVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
/* IDirectMusicCollection Interface follow: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwPatch, IDirectMusicInstrument** ppInstrument) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, CollectionVtbl, iface);
DMUS_PRIVATE_INSTRUMENTENTRY *tmpEntry;
struct list *listEntry;
DWORD dwInstPatch;
TRACE("(%p, %d, %p)\n", This, dwPatch, ppInstrument);
LIST_FOR_EACH (listEntry, &This->Instruments) {
tmpEntry = LIST_ENTRY(listEntry, DMUS_PRIVATE_INSTRUMENTENTRY, entry);
IDirectMusicInstrument_GetPatch (tmpEntry->pInstrument, &dwInstPatch);
if (dwPatch == dwInstPatch) {
*ppInstrument = tmpEntry->pInstrument;
IDirectMusicInstrument_AddRef (tmpEntry->pInstrument);
IDirectMusicInstrumentImpl_Custom_Load (tmpEntry->pInstrument, This->pStm); /* load instrument before returning it */
TRACE(": returning instrument %p\n", *ppInstrument);
return S_OK;
}
}
TRACE(": instrument not found\n");
return DMUS_E_INVALIDPATCH;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_EnumInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwIndex, DWORD* pdwPatch, LPWSTR pwszName, DWORD dwNameLen) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, CollectionVtbl, iface);
unsigned int r = 0;
DMUS_PRIVATE_INSTRUMENTENTRY *tmpEntry;
struct list *listEntry;
DWORD dwLen;
TRACE("(%p, %d, %p, %p, %d)\n", This, dwIndex, pdwPatch, pwszName, dwNameLen);
LIST_FOR_EACH (listEntry, &This->Instruments) {
tmpEntry = LIST_ENTRY(listEntry, DMUS_PRIVATE_INSTRUMENTENTRY, entry);
if (r == dwIndex) {
ICOM_NAME_MULTI (IDirectMusicInstrumentImpl, InstrumentVtbl, tmpEntry->pInstrument, pInstrument);
IDirectMusicInstrument_GetPatch (tmpEntry->pInstrument, pdwPatch);
if (pwszName) {
dwLen = min(strlenW(pInstrument->wszName),dwNameLen-1);
memcpy (pwszName, pInstrument->wszName, dwLen * sizeof(WCHAR));
pwszName[dwLen] = '\0';
}
return S_OK;
}
r++;
}
return S_FALSE;
}
static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl = {
IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInterface,
IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef,
IDirectMusicCollectionImpl_IDirectMusicCollection_Release,
IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument,
IDirectMusicCollectionImpl_IDirectMusicCollection_EnumInstrument
};
/* IDirectMusicCollectionImpl IDirectMusicObject part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
TRACE("(%p, %p)\n", This, pDesc);
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
return S_OK;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
/* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
This->pDesc->guidClass = pDesc->guidClass;
if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW(This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW(This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW(This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE)
This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
}
if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
/* according to MSDN, we copy the stream */
IStream_Clone (pDesc->pStream, &This->pDesc->pStream);
}
/* add new flags */
This->pDesc->dwValidData |= pDesc->dwValidData;
return S_OK;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */
TRACE("(%p, %p, %p)\n", This, pStream, pDesc);
/* FIXME: should this be determined from stream? */
pDesc->dwValidData |= DMUS_OBJ_CLASS;
pDesc->guidClass = CLSID_DirectMusicCollection;
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
StreamSize = Chunk.dwSize - sizeof(FOURCC);
StreamCount = 0;
if (Chunk.fccID == mmioFOURCC('D','L','S',' ')) {
TRACE_(dmfile)(": collection form\n");
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_DLID: {
TRACE_(dmfile)(": GUID chunk\n");
pDesc->dwValidData |= DMUS_OBJ_OBJECT;
IStream_Read (pStream, &pDesc->guidObject, Chunk.dwSize, NULL);
break;
}
case DMUS_FOURCC_VERSION_CHUNK: {
TRACE_(dmfile)(": version chunk\n");
pDesc->dwValidData |= DMUS_OBJ_VERSION;
IStream_Read (pStream, &pDesc->vVersion, Chunk.dwSize, NULL);
break;
}
case DMUS_FOURCC_CATEGORY_CHUNK: {
TRACE_(dmfile)(": category chunk\n");
pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
IStream_Read (pStream, pDesc->wszCategory, Chunk.dwSize, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
ListCount[0] = 0;
switch (Chunk.fccID) {
/* pure INFO list, such can be found in dls collections */
case mmioFOURCC('I','N','F','O'): {
TRACE_(dmfile)(": INFO list\n");
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case mmioFOURCC('I','N','A','M'):{
CHAR szName[DMUS_MAX_NAME];
TRACE_(dmfile)(": name chunk\n");
pDesc->dwValidData |= DMUS_OBJ_NAME;
IStream_Read (pStream, szName, Chunk.dwSize, NULL);
MultiByteToWideChar (CP_ACP, 0, szName, -1, pDesc->wszName, DMUS_MAX_NAME);
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
liMove.QuadPart = 1;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
}
break;
}
case mmioFOURCC('I','A','R','T'): {
TRACE_(dmfile)(": artist chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','O','P'): {
TRACE_(dmfile)(": copyright chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','S','B','J'): {
TRACE_(dmfile)(": subject chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','M','T'): {
TRACE_(dmfile)(": comment chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize);
} else {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = StreamSize;
IStream_Seek (pStream, 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 = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return DMUS_E_INVALIDFILE;
}
}
TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc));
return S_OK;
}
static const IDirectMusicObjectVtbl DirectMusicCollection_Object_Vtbl = {
IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface,
IDirectMusicCollectionImpl_IDirectMusicObject_AddRef,
IDirectMusicCollectionImpl_IDirectMusicObject_Release,
IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor,
IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor,
IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor
};
/* IDirectMusicCollectionImpl IPersistStream part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, PersistStreamVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, PersistStreamVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, PersistStreamVtbl, iface);
return IDirectMusicCollectionImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, PersistStreamVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[3], ListCount[3];
LARGE_INTEGER liMove; /* used when skipping chunks */
ULARGE_INTEGER dlibCollectionPosition, dlibInstrumentPosition, dlibWavePoolPosition;
IStream_AddRef (pStm); /* add count for later references */
liMove.QuadPart = 0;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, &dlibCollectionPosition); /* store offset, in case it'll be needed later */
This->liCollectionPosition.QuadPart = dlibCollectionPosition.QuadPart;
This->pStm = pStm;
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
StreamSize = Chunk.dwSize - sizeof(FOURCC);
StreamCount = 0;
switch (Chunk.fccID) {
case FOURCC_DLS: {
TRACE_(dmfile)(": collection form\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_COLH: {
TRACE_(dmfile)(": collection header chunk\n");
This->pHeader = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, Chunk.dwSize);
IStream_Read (pStm, This->pHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_DLID: {
TRACE_(dmfile)(": DLID (GUID) chunk\n");
This->pDesc->dwValidData |= DMUS_OBJ_OBJECT;
IStream_Read (pStm, &This->pDesc->guidObject, Chunk.dwSize, NULL);
break;
}
case FOURCC_VERS: {
TRACE_(dmfile)(": version chunk\n");
This->pDesc->dwValidData |= DMUS_OBJ_VERSION;
IStream_Read (pStm, &This->pDesc->vVersion, Chunk.dwSize, NULL);
break;
}
case FOURCC_PTBL: {
TRACE_(dmfile)(": pool table chunk\n");
This->pPoolTable = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(POOLTABLE));
IStream_Read (pStm, This->pPoolTable, sizeof(POOLTABLE), NULL);
Chunk.dwSize -= sizeof(POOLTABLE);
This->pPoolCues = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, This->pPoolTable->cCues*sizeof(POOLCUE));
IStream_Read (pStm, This->pPoolCues, Chunk.dwSize, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
ListCount[0] = 0;
switch (Chunk.fccID) {
case mmioFOURCC('I','N','F','O'): {
TRACE_(dmfile)(": INFO list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case mmioFOURCC('I','N','A','M'): {
CHAR szName[DMUS_MAX_NAME];
TRACE_(dmfile)(": name chunk\n");
This->pDesc->dwValidData |= DMUS_OBJ_NAME;
IStream_Read (pStm, szName, Chunk.dwSize, NULL);
MultiByteToWideChar (CP_ACP, 0, szName, -1, This->pDesc->wszName, DMUS_MAX_NAME);
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
liMove.QuadPart = 1;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
}
break;
}
case mmioFOURCC('I','A','R','T'): {
TRACE_(dmfile)(": artist chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','O','P'): {
TRACE_(dmfile)(": copyright chunk\n");
This->szCopyright = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, Chunk.dwSize);
IStream_Read (pStm, This->szCopyright, Chunk.dwSize, NULL);
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
liMove.QuadPart = 1;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
}
break;
}
case mmioFOURCC('I','S','B','J'): {
TRACE_(dmfile)(": subject chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','M','T'): {
TRACE_(dmfile)(": comment chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[0] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
case FOURCC_WVPL: {
TRACE_(dmfile)(": wave pool list (mark & skip)\n");
liMove.QuadPart = 0;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, &dlibWavePoolPosition); /* store position */
This->liWavePoolTablePosition.QuadPart = dlibWavePoolPosition.QuadPart;
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case FOURCC_LINS: {
TRACE_(dmfile)(": instruments list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
ListCount[1] = 0;
switch (Chunk.fccID) {
case FOURCC_INS: {
LPDMUS_PRIVATE_INSTRUMENTENTRY pNewInstrument = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
TRACE_(dmfile)(": instrument list\n");
DMUSIC_CreateDirectMusicInstrumentImpl (&IID_IDirectMusicInstrument, (LPVOID*)&pNewInstrument->pInstrument, NULL); /* only way to create this one... even M$ does it discretely */
{
ICOM_NAME_MULTI (IDirectMusicInstrumentImpl, InstrumentVtbl, pNewInstrument->pInstrument, pInstrument);
liMove.QuadPart = 0;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, &dlibInstrumentPosition);
pInstrument->liInstrumentPosition.QuadPart = dlibInstrumentPosition.QuadPart - (2*sizeof(FOURCC) + sizeof(DWORD)); /* store offset, it'll be needed later */
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_INSH: {
TRACE_(dmfile)(": instrument header chunk\n");
pInstrument->pHeader = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, Chunk.dwSize);
IStream_Read (pStm, pInstrument->pHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_DLID: {
TRACE_(dmfile)(": DLID (GUID) chunk\n");
pInstrument->pInstrumentID = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, Chunk.dwSize);
IStream_Read (pStm, pInstrument->pInstrumentID, Chunk.dwSize, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[2] = Chunk.dwSize - sizeof(FOURCC);
ListCount[2] = 0;
switch (Chunk.fccID) {
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
/* DEBUG: dumps whole instrument object tree: */
if (TRACE_ON(dmusic)) {
TRACE("*** IDirectMusicInstrument (%p) ***\n", pInstrument);
if (pInstrument->pInstrumentID)
TRACE(" - GUID = %s\n", debugstr_dmguid(pInstrument->pInstrumentID));
TRACE(" - Instrument header:\n");
TRACE(" - cRegions: %d\n", pInstrument->pHeader->cRegions);
TRACE(" - Locale:\n");
TRACE(" - ulBank: %d\n", pInstrument->pHeader->Locale.ulBank);
TRACE(" - ulInstrument: %d\n", pInstrument->pHeader->Locale.ulInstrument);
TRACE(" => dwPatch: %d\n", MIDILOCALE2Patch(&pInstrument->pHeader->Locale));
}
list_add_tail (&This->Instruments, &pNewInstrument->entry);
}
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": StreamCount = %d < StreamSize = %d\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 = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return E_FAIL;
}
}
/* DEBUG: dumps whole collection object tree: */
if (TRACE_ON(dmusic)) {
int r = 0;
DMUS_PRIVATE_INSTRUMENTENTRY *tmpEntry;
struct list *listEntry;
TRACE("*** IDirectMusicCollection (%p) ***\n", This->CollectionVtbl);
if (This->pDesc->dwValidData & DMUS_OBJ_OBJECT)
TRACE(" - GUID = %s\n", debugstr_dmguid(&This->pDesc->guidObject));
if (This->pDesc->dwValidData & DMUS_OBJ_VERSION)
TRACE(" - Version = %i,%i,%i,%i\n", (This->pDesc->vVersion.dwVersionMS >> 8) & 0x0000FFFF, This->pDesc->vVersion.dwVersionMS & 0x0000FFFF,
(This->pDesc->vVersion.dwVersionLS >> 8) & 0x0000FFFF, This->pDesc->vVersion.dwVersionLS & 0x0000FFFF);
if (This->pDesc->dwValidData & DMUS_OBJ_NAME)
TRACE(" - Name = %s\n", debugstr_w(This->pDesc->wszName));
TRACE(" - Collection header:\n");
TRACE(" - cInstruments: %d\n", This->pHeader->cInstruments);
TRACE(" - Instruments:\n");
LIST_FOR_EACH (listEntry, &This->Instruments) {
tmpEntry = LIST_ENTRY( listEntry, DMUS_PRIVATE_INSTRUMENTENTRY, entry );
TRACE(" - Instrument[%i]: %p\n", r, tmpEntry->pInstrument);
r++;
}
}
return S_OK;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
return E_NOTIMPL;
}
static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = {
IDirectMusicCollectionImpl_IPersistStream_QueryInterface,
IDirectMusicCollectionImpl_IPersistStream_AddRef,
IDirectMusicCollectionImpl_IPersistStream_Release,
IDirectMusicCollectionImpl_IPersistStream_GetClassID,
IDirectMusicCollectionImpl_IPersistStream_IsDirty,
IDirectMusicCollectionImpl_IPersistStream_Load,
IDirectMusicCollectionImpl_IPersistStream_Save,
IDirectMusicCollectionImpl_IPersistStream_GetSizeMax
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicCollectionImpl* obj;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionImpl));
if (NULL == obj) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->UnknownVtbl = &DirectMusicCollection_Unknown_Vtbl;
obj->CollectionVtbl = &DirectMusicCollection_Collection_Vtbl;
obj->ObjectVtbl = &DirectMusicCollection_Object_Vtbl;
obj->PersistStreamVtbl = &DirectMusicCollection_PersistStream_Vtbl;
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
obj->pDesc->guidClass = CLSID_DirectMusicCollection;
obj->ref = 0; /* will be inited by QueryInterface */
list_init (&obj->Instruments);
return IDirectMusicCollectionImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);
}

View file

@ -0,0 +1,260 @@
/* IDirectMusic8 Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusic8Impl IUnknown part: */
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) ||
IsEqualIID (riid, &IID_IDirectMusic) ||
IsEqualIID (riid, &IID_IDirectMusic2) ||
IsEqualIID (riid, &IID_IDirectMusic8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusic8Impl IDirectMusic part: */
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %d, %p)\n", This, dwIndex, pPortCaps);
if (NULL == pPortCaps) { return E_POINTER; }
/* i guess the first port shown is always software synthesizer */
if (dwIndex == 0)
{
IDirectMusicSynth8* synth;
TRACE("enumerating 'Microsoft Software Synthesizer' port\n");
CoCreateInstance (&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
IDirectMusicSynth8_GetPortCaps (synth, pPortCaps);
IDirectMusicSynth8_Release (synth);
return S_OK;
}
/* it seems that the rest of devices are obtained thru dmusic32.EnumLegacyDevices...*sigh*...which is undocumented*/
#if 0
int numMIDI = midiOutGetNumDevs();
int numWAVE = waveOutGetNumDevs();
int i;
/* then return digital sound ports */
for (i = 1; i <= numWAVE; i++)
{
TRACE("enumerating 'digital sound' ports\n");
if (i == dwIndex)
{
DirectSoundEnumerateA(register_waveport, pPortCaps);
return S_OK;
}
}
/* finally, list all *real* MIDI ports*/
for (i = numWAVE + 1; i <= numWAVE + numMIDI; i++)
{
TRACE("enumerating 'real MIDI' ports\n");
if (i == dwIndex)
FIXME("Found MIDI port, but *real* MIDI ports not supported yet\n");
}
#endif
return S_FALSE;
}
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER** ppBuffer, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %p, %p, %p)\n", This, pBufferDesc, ppBuffer, pUnkOuter);
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
if (!pBufferDesc || !ppBuffer)
return E_POINTER;
return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL);
}
static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
int i/*, j*/;
DMUS_PORTCAPS PortCaps;
IDirectMusicPort* pNewPort = NULL;
HRESULT hr = E_FAIL;
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_dmguid(rclsidPort), pPortParams, ppPort, pUnkOuter);
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) {
if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) {
hr = DMUSIC_CreateDirectMusicPortImpl(&IID_IDirectMusicPort, (LPVOID*) &pNewPort, (LPUNKNOWN) This, pPortParams, &PortCaps);
if (FAILED(hr)) {
*ppPort = NULL;
return hr;
}
This->nrofports++;
if (!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
This->ppPorts[This->nrofports - 1] = pNewPort;
*ppPort = pNewPort;
return S_OK;
}
}
/* FIXME: place correct error here */
return E_NOINTERFACE;
}
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %d, %p): stub\n", This, dwIndex, lpClockInfo);
return S_FALSE;
}
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock (LPDIRECTMUSIC8 iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %p, %p)\n", This, pguidClock, ppReferenceClock);
if (pguidClock)
*pguidClock = This->pMasterClock->pClockInfo.guidClock;
if(ppReferenceClock)
*ppReferenceClock = (IReferenceClock *)This->pMasterClock;
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock (LPDIRECTMUSIC8 iface, REFGUID rguidClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidClock));
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_Activate (LPDIRECTMUSIC8 iface, BOOL fEnable) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
int i;
FIXME("(%p, %d): stub\n", This, fEnable);
for (i = 0; i < This->nrofports; i++) {
IDirectMusicPortImpl_Activate(This->ppPorts[i], fEnable);
}
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LPGUID pguidPort) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
HKEY hkGUID;
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
char returnBuffer[51];
GUID defaultPortGUID;
WCHAR buff[51];
TRACE("(%p, %p)\n", This, pguidPort);
if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) ||
(RegQueryValueExA(hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, (LPBYTE)returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
{
WARN(": registry entry missing\n" );
*pguidPort = CLSID_DirectMusicSynth;
return S_OK;
}
/* FIXME: Check return types to ensure we're interpreting data right */
MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
CLSIDFromString(buff, &defaultPortGUID);
*pguidPort = defaultPortGUID;
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %p): stub\n", This, pClock);
return S_OK;
}
static const IDirectMusic8Vtbl DirectMusic8_Vtbl = {
IDirectMusic8Impl_QueryInterface,
IDirectMusic8Impl_AddRef,
IDirectMusic8Impl_Release,
IDirectMusic8Impl_EnumPort,
IDirectMusic8Impl_CreateMusicBuffer,
IDirectMusic8Impl_CreatePort,
IDirectMusic8Impl_EnumMasterClock,
IDirectMusic8Impl_GetMasterClock,
IDirectMusic8Impl_SetMasterClock,
IDirectMusic8Impl_Activate,
IDirectMusic8Impl_GetDefaultPort,
IDirectMusic8Impl_SetDirectSound,
IDirectMusic8Impl_SetExternalMasterClock
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *dmusic;
TRACE("(%p,%p,%p)\n",lpcGUID, ppobj, pUnkOuter);
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
if (NULL == dmusic) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmusic->lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 0; /* will be inited with QueryInterface */
dmusic->pMasterClock = NULL;
dmusic->ppPorts = NULL;
dmusic->nrofports = 0;
DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
return IDirectMusic8Impl_QueryInterface ((LPDIRECTMUSIC8)dmusic, lpcGUID, ppobj);
}

View file

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="dmusic" type="win32dll" entrypoint="0" installbase="system32" installname="dmusic.dll" unicode="yes">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="dmusic.spec" />
<redefine name="_WIN32_WINNT">0x600</redefine>
<define name="__WINESRC__" />
<include base="dmusic">.</include>
<include base="ReactOS">include/reactos/wine</include>
<library>wine</library>
<library>uuid</library>
<library>ntdll</library>
<library>user32</library>
<library>advapi32</library>
<library>ole32</library>
<library>dxguid</library>
<library>dsound</library>
<file>version.rc</file>
<file>buffer.c</file>
<file>clock.c</file>
<file>collection.c</file>
<file>dmusic.c</file>
<file>dmusic_main.c</file>
<file>download.c</file>
<file>downloadedinstrument.c</file>
<file>instrument.c</file>
<file>port.c</file>
<file>regsvr.c</file>
</module>

View file

@ -0,0 +1,4 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View file

@ -0,0 +1,475 @@
/* DirectMusic Main
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
LONG DMUSIC_refCount = 0;
typedef struct {
const IClassFactoryVtbl *lpVtbl;
} IClassFactoryImpl;
/******************************************************************
* DirectMusic ClassFactory
*/
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
DMUSIC_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) {
DMUSIC_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
TRACE("(%d)\n", dolock);
if (dolock)
DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
}
static const IClassFactoryVtbl DirectMusicCF_Vtbl = {
DirectMusicCF_QueryInterface,
DirectMusicCF_AddRef,
DirectMusicCF_Release,
DirectMusicCF_CreateInstance,
DirectMusicCF_LockServer
};
static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl};
/******************************************************************
* DirectMusicCollection ClassFactory
*/
static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) {
DMUSIC_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) {
DMUSIC_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicCollectionImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI CollectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
TRACE("(%d)\n", dolock);
if (dolock)
DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
}
static const IClassFactoryVtbl CollectionCF_Vtbl = {
CollectionCF_QueryInterface,
CollectionCF_AddRef,
CollectionCF_Release,
CollectionCF_CreateInstance,
CollectionCF_LockServer
};
static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
/******************************************************************
* DllMain
*
*
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hinstDLL);
/* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) {
/* FIXME: Cleanup */
}
return TRUE;
}
/******************************************************************
* DllCanUnloadNow (DMUSIC.@)
*
*
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
return DMUSIC_refCount != 0 ? S_FALSE : S_OK;
}
/******************************************************************
* DllGetClassObject (DMUSIC.@)
*
*
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
if (IsEqualCLSID (rclsid, &CLSID_DirectMusic) && IsEqualIID (riid, &IID_IClassFactory)) {
*ppv = &DirectMusic_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCollection) && IsEqualIID (riid, &IID_IClassFactory)) {
*ppv = &Collection_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
/******************************************************************
* Helper functions
*
*
*/
/* dwPatch from MIDILOCALE */
DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale) {
DWORD dwPatch = 0;
if (!pLocale) return 0;
dwPatch |= (pLocale->ulBank & F_INSTRUMENT_DRUMS); /* set drum bit */
dwPatch |= ((pLocale->ulBank & 0x00007F7F) << 8); /* set MIDI bank location */
dwPatch |= (pLocale->ulInstrument & 0x0000007F); /* set PC value */
return dwPatch;
}
/* MIDILOCALE from dwPatch */
void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) {
memset (pLocale, 0, sizeof(MIDILOCALE));
pLocale->ulInstrument = (dwPatch & 0x7F); /* get PC value */
pLocale->ulBank = ((dwPatch & 0x007F7F00) >> 8); /* get MIDI bank location */
pLocale->ulBank |= (dwPatch & F_INSTRUMENT_DRUMS); /* get drum bit */
}
/* check whether the given DWORD is even (return 0) or odd (return 1) */
int even_or_odd (DWORD number) {
return (number & 0x1); /* basically, check if bit 0 is set ;) */
}
/* FOURCC to string conversion for debug messages */
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));
}
/* DMUS_VERSION struct to string conversion for debug messages */
static const char *debugstr_dmversion (const DMUS_VERSION *version) {
if (!version) return "'null'";
return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
(int)((version->dwVersionMS & 0xFFFF0000) >> 8), (int)(version->dwVersionMS & 0x0000FFFF),
(int)((version->dwVersionLS & 0xFFFF0000) >> 8), (int)(version->dwVersionLS & 0x0000FFFF));
}
/* returns name of given GUID */
const char *debugstr_dmguid (const GUID *id) {
static const guid_info guids[] = {
/* CLSIDs */
GE(CLSID_AudioVBScript),
GE(CLSID_DirectMusic),
GE(CLSID_DirectMusicAudioPath),
GE(CLSID_DirectMusicAudioPathConfig),
GE(CLSID_DirectMusicAuditionTrack),
GE(CLSID_DirectMusicBand),
GE(CLSID_DirectMusicBandTrack),
GE(CLSID_DirectMusicChordMapTrack),
GE(CLSID_DirectMusicChordMap),
GE(CLSID_DirectMusicChordTrack),
GE(CLSID_DirectMusicCollection),
GE(CLSID_DirectMusicCommandTrack),
GE(CLSID_DirectMusicComposer),
GE(CLSID_DirectMusicContainer),
GE(CLSID_DirectMusicGraph),
GE(CLSID_DirectMusicLoader),
GE(CLSID_DirectMusicLyricsTrack),
GE(CLSID_DirectMusicMarkerTrack),
GE(CLSID_DirectMusicMelodyFormulationTrack),
GE(CLSID_DirectMusicMotifTrack),
GE(CLSID_DirectMusicMuteTrack),
GE(CLSID_DirectMusicParamControlTrack),
GE(CLSID_DirectMusicPatternTrack),
GE(CLSID_DirectMusicPerformance),
GE(CLSID_DirectMusicScript),
GE(CLSID_DirectMusicScriptAutoImpSegment),
GE(CLSID_DirectMusicScriptAutoImpPerformance),
GE(CLSID_DirectMusicScriptAutoImpSegmentState),
GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
GE(CLSID_DirectMusicScriptAutoImpAudioPath),
GE(CLSID_DirectMusicScriptAutoImpSong),
GE(CLSID_DirectMusicScriptSourceCodeLoader),
GE(CLSID_DirectMusicScriptTrack),
GE(CLSID_DirectMusicSection),
GE(CLSID_DirectMusicSegment),
GE(CLSID_DirectMusicSegmentState),
GE(CLSID_DirectMusicSegmentTriggerTrack),
GE(CLSID_DirectMusicSegTriggerTrack),
GE(CLSID_DirectMusicSeqTrack),
GE(CLSID_DirectMusicSignPostTrack),
GE(CLSID_DirectMusicSong),
GE(CLSID_DirectMusicStyle),
GE(CLSID_DirectMusicStyleTrack),
GE(CLSID_DirectMusicSynth),
GE(CLSID_DirectMusicSynthSink),
GE(CLSID_DirectMusicSysExTrack),
GE(CLSID_DirectMusicTemplate),
GE(CLSID_DirectMusicTempoTrack),
GE(CLSID_DirectMusicTimeSigTrack),
GE(CLSID_DirectMusicWaveTrack),
GE(CLSID_DirectSoundWave),
/* IIDs */
GE(IID_IDirectMusic),
GE(IID_IDirectMusic2),
GE(IID_IDirectMusic8),
GE(IID_IDirectMusicAudioPath),
GE(IID_IDirectMusicBand),
GE(IID_IDirectMusicBuffer),
GE(IID_IDirectMusicChordMap),
GE(IID_IDirectMusicCollection),
GE(IID_IDirectMusicComposer),
GE(IID_IDirectMusicContainer),
GE(IID_IDirectMusicDownload),
GE(IID_IDirectMusicDownloadedInstrument),
GE(IID_IDirectMusicGetLoader),
GE(IID_IDirectMusicGraph),
GE(IID_IDirectMusicInstrument),
GE(IID_IDirectMusicLoader),
GE(IID_IDirectMusicLoader8),
GE(IID_IDirectMusicObject),
GE(IID_IDirectMusicPatternTrack),
GE(IID_IDirectMusicPerformance),
GE(IID_IDirectMusicPerformance2),
GE(IID_IDirectMusicPerformance8),
GE(IID_IDirectMusicPort),
GE(IID_IDirectMusicPortDownload),
GE(IID_IDirectMusicScript),
GE(IID_IDirectMusicSegment),
GE(IID_IDirectMusicSegment2),
GE(IID_IDirectMusicSegment8),
GE(IID_IDirectMusicSegmentState),
GE(IID_IDirectMusicSegmentState8),
GE(IID_IDirectMusicStyle),
GE(IID_IDirectMusicStyle8),
GE(IID_IDirectMusicSynth),
GE(IID_IDirectMusicSynth8),
GE(IID_IDirectMusicSynthSink),
GE(IID_IDirectMusicThru),
GE(IID_IDirectMusicTool),
GE(IID_IDirectMusicTool8),
GE(IID_IDirectMusicTrack),
GE(IID_IDirectMusicTrack8),
GE(IID_IUnknown),
GE(IID_IPersistStream),
GE(IID_IStream),
GE(IID_IClassFactory),
/* GUIDs */
GE(GUID_DirectMusicAllTypes),
GE(GUID_NOTIFICATION_CHORD),
GE(GUID_NOTIFICATION_COMMAND),
GE(GUID_NOTIFICATION_MEASUREANDBEAT),
GE(GUID_NOTIFICATION_PERFORMANCE),
GE(GUID_NOTIFICATION_RECOMPOSE),
GE(GUID_NOTIFICATION_SEGMENT),
GE(GUID_BandParam),
GE(GUID_ChordParam),
GE(GUID_CommandParam),
GE(GUID_CommandParam2),
GE(GUID_CommandParamNext),
GE(GUID_IDirectMusicBand),
GE(GUID_IDirectMusicChordMap),
GE(GUID_IDirectMusicStyle),
GE(GUID_MuteParam),
GE(GUID_Play_Marker),
GE(GUID_RhythmParam),
GE(GUID_TempoParam),
GE(GUID_TimeSignature),
GE(GUID_Valid_Start_Time),
GE(GUID_Clear_All_Bands),
GE(GUID_ConnectToDLSCollection),
GE(GUID_Disable_Auto_Download),
GE(GUID_DisableTempo),
GE(GUID_DisableTimeSig),
GE(GUID_Download),
GE(GUID_DownloadToAudioPath),
GE(GUID_Enable_Auto_Download),
GE(GUID_EnableTempo),
GE(GUID_EnableTimeSig),
GE(GUID_IgnoreBankSelectForGM),
GE(GUID_SeedVariations),
GE(GUID_StandardMIDIFile),
GE(GUID_Unload),
GE(GUID_UnloadFromAudioPath),
GE(GUID_Variations),
GE(GUID_PerfMasterTempo),
GE(GUID_PerfMasterVolume),
GE(GUID_PerfMasterGrooveLevel),
GE(GUID_PerfAutoDownload),
GE(GUID_DefaultGMCollection),
GE(GUID_Synth_Default),
GE(GUID_Buffer_Reverb),
GE(GUID_Buffer_EnvReverb),
GE(GUID_Buffer_Stereo),
GE(GUID_Buffer_3D_Dry),
GE(GUID_Buffer_Mono),
GE(GUID_DMUS_PROP_GM_Hardware),
GE(GUID_DMUS_PROP_GS_Capable),
GE(GUID_DMUS_PROP_GS_Hardware),
GE(GUID_DMUS_PROP_DLS1),
GE(GUID_DMUS_PROP_DLS2),
GE(GUID_DMUS_PROP_Effects),
GE(GUID_DMUS_PROP_INSTRUMENT2),
GE(GUID_DMUS_PROP_LegacyCaps),
GE(GUID_DMUS_PROP_MemorySize),
GE(GUID_DMUS_PROP_SampleMemorySize),
GE(GUID_DMUS_PROP_SamplePlaybackRate),
GE(GUID_DMUS_PROP_SetSynthSink),
GE(GUID_DMUS_PROP_SinkUsesDSound),
GE(GUID_DMUS_PROP_SynthSink_DSOUND),
GE(GUID_DMUS_PROP_SynthSink_WAVE),
GE(GUID_DMUS_PROP_Volume),
GE(GUID_DMUS_PROP_WavesReverb),
GE(GUID_DMUS_PROP_WriteLatency),
GE(GUID_DMUS_PROP_WritePeriod),
GE(GUID_DMUS_PROP_XG_Capable),
GE(GUID_DMUS_PROP_XG_Hardware)
};
unsigned int i;
if (!id) return "(null)";
for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
if (IsEqualGUID(id, guids[i].guid))
return guids[i].name;
}
/* if we didn't find it, act like standard debugstr_guid */
return debugstr_guid(id);
}
/* generic flag-dumping function */
static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
char buffer[128] = "", *ptr = &buffer[0];
unsigned int i;
int size = sizeof(buffer);
for (i=0; i < num_names; i++)
{
if ((flags & names[i].val) || /* standard flag*/
((!flags) && (!names[i].val))) { /* zero value only */
int cnt = snprintf(ptr, size, "%s ", names[i].name);
if (cnt < 0 || cnt >= size) break;
size -= cnt;
ptr += cnt;
}
}
return wine_dbg_sprintf("%s", buffer);
}
/* dump DMUS_OBJ flags */
static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
static const flag_info flags[] = {
FE(DMUS_OBJ_OBJECT),
FE(DMUS_OBJ_CLASS),
FE(DMUS_OBJ_NAME),
FE(DMUS_OBJ_CATEGORY),
FE(DMUS_OBJ_FILENAME),
FE(DMUS_OBJ_FULLPATH),
FE(DMUS_OBJ_URL),
FE(DMUS_OBJ_VERSION),
FE(DMUS_OBJ_DATE),
FE(DMUS_OBJ_LOADED),
FE(DMUS_OBJ_MEMORY),
FE(DMUS_OBJ_STREAM)
};
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
}
/* dump whole DMUS_OBJECTDESC struct */
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
if (pDesc) {
char buffer[1024] = "", *ptr = &buffer[0];
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
return wine_dbg_sprintf("%s", buffer);
} else {
return wine_dbg_sprintf("(NULL)");
}
}

View file

@ -0,0 +1,282 @@
/* DirectMusic Private Include
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DMUSIC_PRIVATE_H
#define __WINE_DMUSIC_PRIVATE_H
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "winreg.h"
#include "objbase.h"
#include "dmusici.h"
#include "dmusicf.h"
#include "dmusics.h"
/*****************************************************************************
* Interfaces
*/
typedef struct IDirectMusic8Impl IDirectMusic8Impl;
typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
typedef struct IReferenceClockImpl IReferenceClockImpl;
typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
/*****************************************************************************
* Some stuff to make my life easier :=)
*/
/* some sort of aux. midi channel: big fake at the moment; accepts only priority
changes... more coming soon */
typedef struct DMUSIC_PRIVATE_MCHANNEL_ {
DWORD priority;
} DMUSIC_PRIVATE_MCHANNEL, *LPDMUSIC_PRIVATE_MCHANNEL;
/* some sort of aux. channel group: collection of 16 midi channels */
typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
} DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
/*****************************************************************************
* ClassFactory
*/
extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
/*****************************************************************************
* IDirectMusic8Impl implementation structure
*/
struct IDirectMusic8Impl {
/* IUnknown fields */
const IDirectMusic8Vtbl *lpVtbl;
LONG ref;
/* IDirectMusicImpl fields */
IReferenceClockImpl* pMasterClock;
IDirectMusicPort** ppPorts;
int nrofports;
};
/*****************************************************************************
* IDirectMusicBufferImpl implementation structure
*/
struct IDirectMusicBufferImpl {
/* IUnknown fields */
const IDirectMusicBufferVtbl *lpVtbl;
LONG ref;
/* IDirectMusicBufferImpl fields */
};
/*****************************************************************************
* IDirectMusicDownloadedInstrumentImpl implementation structure
*/
struct IDirectMusicDownloadedInstrumentImpl {
/* IUnknown fields */
const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
LONG ref;
/* IDirectMusicDownloadedInstrumentImpl fields */
};
/*****************************************************************************
* IDirectMusicDownloadImpl implementation structure
*/
struct IDirectMusicDownloadImpl {
/* IUnknown fields */
const IDirectMusicDownloadVtbl *lpVtbl;
LONG ref;
/* IDirectMusicDownloadImpl fields */
};
/*****************************************************************************
* IDirectMusicPortImpl implementation structure
*/
struct IDirectMusicPortImpl {
/* IUnknown fields */
const IDirectMusicPortVtbl *lpVtbl;
const IDirectMusicPortDownloadVtbl *lpDownloadVtbl;
const IDirectMusicThruVtbl *lpThruVtbl;
LONG ref;
/* IDirectMusicPortImpl fields */
IDirectSound* pDirectSound;
IReferenceClock* pLatencyClock;
BOOL fActive;
DMUS_PORTCAPS caps;
DMUS_PORTPARAMS params;
int nrofgroups;
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
};
extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
/** Internal factory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps);
/*****************************************************************************
* IReferenceClockImpl implementation structure
*/
struct IReferenceClockImpl {
/* IUnknown fields */
const IReferenceClockVtbl *lpVtbl;
LONG ref;
/* IReferenceClockImpl fields */
REFERENCE_TIME rtTime;
DMUS_CLOCKINFO pClockInfo;
};
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
struct list entry; /* for listing elements */
IDirectMusicInstrument* pInstrument;
} DMUS_PRIVATE_INSTRUMENTENTRY, *LPDMUS_PRIVATE_INSTRUMENTENTRY;
typedef struct _DMUS_PRIVATE_POOLCUE {
struct list entry; /* for listing elements */
} DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
/*****************************************************************************
* IDirectMusicCollectionImpl implementation structure
*/
struct IDirectMusicCollectionImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicCollectionVtbl *CollectionVtbl;
const IDirectMusicObjectVtbl *ObjectVtbl;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref;
/* IDirectMusicCollectionImpl fields */
IStream *pStm; /* stream from which we load collection and later instruments */
LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
LPDMUS_OBJECTDESC pDesc;
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
LPDLSHEADER pHeader;
/* pool table */
LPPOOLTABLE pPoolTable;
LPPOOLCUE pPoolCues;
/* instruments */
struct list Instruments;
};
/*****************************************************************************
* IDirectMusicInstrumentImpl implementation structure
*/
struct IDirectMusicInstrumentImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicInstrumentVtbl *InstrumentVtbl;
LONG ref;
/* IDirectMusicInstrumentImpl fields */
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
LPGUID pInstrumentID;
LPINSTHEADER pHeader;
WCHAR wszName[DMUS_MAX_NAME];
/* instrument data */
};
/* custom :) */
extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm);
/**********************************************************************
* Dll lifetime tracking declaration for dmusic.dll
*/
extern LONG DMUSIC_refCount;
static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
/*****************************************************************************
* Misc.
*/
/* my custom ICOM stuff */
#define ICOM_NAME_MULTI(impl,field,iface,name) impl* const name=(impl*)((char*)(iface) - offsetof(impl,field))
#define ICOM_THIS_MULTI(impl,field,iface) ICOM_NAME_MULTI(impl,field,iface,This)
/* for simpler reading */
typedef struct _DMUS_PRIVATE_CHUNK {
FOURCC fccID; /* FOURCC ID of the chunk */
DWORD dwSize; /* size of the chunk */
} DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
/* used for generic dumping (copied from ddraw) */
typedef struct {
DWORD val;
const char* name;
} flag_info;
typedef struct {
const GUID *guid;
const char* name;
} guid_info;
/* used for initialising structs (primarily for DMUS_OBJECTDESC) */
#define DM_STRUCT_INIT(x) \
do { \
memset((x), 0, sizeof(*(x))); \
(x)->dwSize = sizeof(*x); \
} while (0)
#define FE(x) { x, #x }
#define GE(x) { &x, #x }
/* dwPatch from MIDILOCALE */
extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
/* MIDILOCALE from dwPatch */
extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale);
/* check whether the given DWORD is even (return 0) or odd (return 1) */
extern int even_or_odd (DWORD number);
/* FOURCC to string conversion for debug messages */
extern const char *debugstr_fourcc (DWORD fourcc);
/* returns name of given GUID */
extern const char *debugstr_dmguid (const GUID *id);
/* dump whole DMUS_OBJECTDESC struct */
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
#endif /* __WINE_DMUSIC_PRIVATE_H */

View file

@ -0,0 +1,92 @@
/* IDirectMusicDownload Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusicDownloadImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicDownload)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize);
return S_OK;
}
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
IDirectMusicDownloadImpl_QueryInterface,
IDirectMusicDownloadImpl_AddRef,
IDirectMusicDownloadImpl_Release,
IDirectMusicDownloadImpl_GetBuffer
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicDownloadImpl* dmdl;
dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
if (NULL == dmdl) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmdl->lpVtbl = &DirectMusicDownload_Vtbl;
dmdl->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj);
}

View file

@ -0,0 +1,88 @@
/* IDirectMusicDownloadedInstrument Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusicDownloadedInstrumentImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument)
|| IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrument part: */
/* none at this time */
static const IDirectMusicDownloadedInstrumentVtbl DirectMusicDownloadedInstrument_Vtbl = {
IDirectMusicDownloadedInstrumentImpl_QueryInterface,
IDirectMusicDownloadedInstrumentImpl_AddRef,
IDirectMusicDownloadedInstrumentImpl_Release
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicDownloadedInstrumentImpl* dmdlinst;
dmdlinst = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadedInstrumentImpl));
if (NULL == dmdlinst) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmdlinst->lpVtbl = &DirectMusicDownloadedInstrument_Vtbl;
dmdlinst->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicDownloadedInstrumentImpl_QueryInterface ((LPDIRECTMUSICDOWNLOADEDINSTRUMENT)dmdlinst, lpcGUID, ppobj);
}

View file

@ -0,0 +1,429 @@
/* IDirectMusicInstrument Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
static const GUID IID_IDirectMusicInstrumentPRIVATE = {0xbcb20080,0xa40c,0x11d1,{0x86,0xbc,0x00,0xc0,0x4f,0xbf,0x8f,0xef}};
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface);
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface);
/* IDirectMusicInstrument IUnknown part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = &This->UnknownVtbl;
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrument)) {
*ppobj = &This->InstrumentVtbl;
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef ((LPDIRECTMUSICINSTRUMENT)&This->InstrumentVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrumentPRIVATE)) {
/* it seems to me that this interface is only basic IUnknown, without any
other inherited functions... *sigh* this is the worst scenario, since it means
that whoever calls it knows the layout of original implementation table and therefore
tries to get data by direct access... expect crashes */
FIXME("*sigh*... requested private/unspecified interface\n");
*ppobj = &This->UnknownVtbl;
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
static const IUnknownVtbl DirectMusicInstrument_Unknown_Vtbl = {
IDirectMusicInstrumentImpl_IUnknown_QueryInterface,
IDirectMusicInstrumentImpl_IUnknown_AddRef,
IDirectMusicInstrumentImpl_IUnknown_Release
};
/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface (LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release (LPDIRECTMUSICINSTRUMENT iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
TRACE("(%p, %p)\n", This, pdwPatch);
*pdwPatch = MIDILOCALE2Patch(&This->pHeader->Locale);
return S_OK;
}
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
TRACE("(%p, %d): stub\n", This, dwPatch);
Patch2MIDILOCALE(dwPatch, &This->pHeader->Locale);
return S_OK;
}
static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Instrument_Vtbl = {
IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicInstrumentImpl* dminst;
dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl));
if (NULL == dminst) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dminst->UnknownVtbl = &DirectMusicInstrument_Unknown_Vtbl;
dminst->InstrumentVtbl = &DirectMusicInstrument_Instrument_Vtbl;
dminst->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&dminst->UnknownVtbl, lpcGUID, ppobj);
}
/* aux. function that completely loads instrument; my tests indicate that it's
called somewhere around IDirectMusicCollection_GetInstrument */
HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD ListSize[4], ListCount[4];
LARGE_INTEGER liMove; /* used when skipping chunks */
TRACE("(%p, %p, offset = %s)\n", This, pStm, wine_dbgstr_longlong(This->liInstrumentPosition.QuadPart));
/* goto the beginning of chunk */
IStream_Seek (pStm, This->liInstrumentPosition, STREAM_SEEK_SET, NULL);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
ListCount[0] = 0;
switch (Chunk.fccID) {
case FOURCC_INS: {
TRACE_(dmfile)(": instrument list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_INSH: {
TRACE_(dmfile)(": instrument header chunk\n");
/* should be already initialised */
IStream_Read (pStm, This->pHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_DLID: {
TRACE_(dmfile)(": DLID (GUID) chunk\n");
/* should be already initialised */
IStream_Read (pStm, This->pInstrumentID, Chunk.dwSize, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
ListCount[1] = 0;
switch (Chunk.fccID) {
case FOURCC_LRGN: {
TRACE_(dmfile)(": regions list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[2] = Chunk.dwSize - sizeof(FOURCC);
ListCount[2] = 0;
switch (Chunk.fccID) {
case FOURCC_RGN: {
/* temporary structures */
RGNHEADER tmpRegionHeader;
WSMPL tmpWaveSample;
WLOOP tmpWaveLoop;
WAVELINK tmpWaveLink;
TRACE_(dmfile)(": region list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[2] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RGNH: {
TRACE_(dmfile)(": region header chunk\n");
memset (&tmpRegionHeader, 0, sizeof(RGNHEADER)); /* reset */
IStream_Read (pStm, &tmpRegionHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_WSMP: {
TRACE_(dmfile)(": wave sample chunk\n");
memset (&tmpWaveSample, 0, sizeof(WSMPL)); /* reset */
memset (&tmpWaveLoop, 0, sizeof(WLOOP)); /* reset */
if (Chunk.dwSize != (sizeof(WSMPL) + sizeof(WLOOP))) ERR(": incorrect chunk size\n");
IStream_Read (pStm, &tmpWaveSample, sizeof(WSMPL), NULL);
IStream_Read (pStm, &tmpWaveLoop, sizeof(WLOOP), NULL);
break;
}
case FOURCC_WLNK: {
TRACE_(dmfile)(": wave link chunk\n");
memset (&tmpWaveLink, 0, sizeof(WAVELINK)); /* reset */
IStream_Read (pStm, &tmpWaveLink, Chunk.dwSize, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[2] = %d < ListSize[2] = %d\n", ListCount[2], ListSize[2]);
} while (ListCount[2] < ListSize[2]);
FIXME(": need to write temporary data to instrument data\n");
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
case FOURCC_LART: {
TRACE_(dmfile)(": articulators list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_ART1: {
/* temporary structures */
CONNECTIONLIST tmpConnectionList;
LPCONNECTION tmpConnections;
TRACE_(dmfile)(": level 1 articulator chunk\n");
memset (&tmpConnectionList, 0, sizeof(CONNECTIONLIST)); /* reset */
tmpConnections = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(CONNECTION)*tmpConnectionList.cConnections);
if (Chunk.dwSize != (sizeof(CONNECTIONLIST) + sizeof(CONNECTION)*tmpConnectionList.cConnections)) ERR(": incorrect chunk size\n");
IStream_Read (pStm, &tmpConnectionList, sizeof(CONNECTIONLIST), NULL);
IStream_Read (pStm, tmpConnections, sizeof(CONNECTION)*tmpConnectionList.cConnections, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
case mmioFOURCC('I','N','F','O'): {
TRACE_(dmfile)(": INFO list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case mmioFOURCC('I','N','A','M'): {
TRACE_(dmfile)(": name chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','A','R','T'): {
TRACE_(dmfile)(": artist chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','O','P'): {
/* temporary structures */
CHAR tmpCopyright[DMUS_MAX_NAME];
TRACE_(dmfile)(": copyright chunk\n");
IStream_Read (pStm, tmpCopyright, Chunk.dwSize, NULL);
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
liMove.QuadPart = 1;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
}
break;
}
case mmioFOURCC('I','S','B','J'): {
TRACE_(dmfile)(": subject chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','M','T'): {
TRACE_(dmfile)(": comment chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return E_FAIL;
}
}
/* DEBUG: dumps whole instrument object tree: */
/* if (TRACE_ON(dmusic)) {
TRACE("*** IDirectMusicInstrument (%p) ***\n", This);
if (This->pInstrumentID)
TRACE(" - GUID = %s\n", debugstr_dmguid(This->pInstrumentID));
TRACE(" - Instrument header:\n");
TRACE(" - cRegions: %ld\n", This->pHeader->cRegions);
TRACE(" - Locale:\n");
TRACE(" - ulBank: %ld\n", This->pHeader->Locale.ulBank);
TRACE(" - ulInstrument: %ld\n", This->pHeader->Locale.ulInstrument);
TRACE(" => dwPatch: %ld\n", MIDILOCALE2Patch(&This->pHeader->Locale));
}*/
return S_OK;
}

View file

@ -0,0 +1,412 @@
/* IDirectMusicPort Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusicPortImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirectMusicPort) ||
IsEqualGUID(riid, &IID_IDirectMusicPort8)) {
*ppobj = &This->lpVtbl;
IDirectMusicPort_AddRef((LPDIRECTMUSICPORT)*ppobj);
return S_OK;
} else if (IsEqualGUID(riid, &IID_IDirectMusicPortDownload) ||
IsEqualGUID(riid, &IID_IDirectMusicPortDownload8)) {
*ppobj = &This->lpDownloadVtbl;
IDirectMusicPortDownload_AddRef((LPDIRECTMUSICPORTDOWNLOAD)*ppobj);
return S_OK;
} else if (IsEqualGUID(riid, &IID_IDirectMusicThru) ||
IsEqualGUID(riid, &IID_IDirectMusicThru8)) {
*ppobj = &This->lpThruVtbl;
IDirectMusicThru_AddRef((LPDIRECTMUSICTHRU)*ppobj);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusicPortImpl IDirectMusicPort part: */
static HRESULT WINAPI IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p): stub\n", This, pBuffer);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface, HANDLE hEvent) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p): stub\n", This, hEvent);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p): stub\n", This, pBuffer);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p, %p, %p, %d): stub\n", This, pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
if (!pInstrument || !ppDownloadedInstrument || (dwNumNoteRanges && !pNoteRanges))
return E_POINTER;
return DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(&IID_IDirectMusicDownloadedInstrument, (LPVOID*)ppDownloadedInstrument, NULL);
}
static HRESULT WINAPI IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicDownloadedInstrument *pDownloadedInstrument) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p): stub\n", This, pDownloadedInstrument);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface, IReferenceClock** ppClock) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p, %p)\n", This, ppClock);
*ppClock = This->pLatencyClock;
IReferenceClock_AddRef (*ppClock);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LPDMUS_SYNTHSTATS pStats) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p): stub\n", This, pStats);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_Compact (LPDIRECTMUSICPORT iface) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p): stub\n", This);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p, %p)\n", This, pPortCaps);
*pPortCaps = This->caps;
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %d, %p, %d, %p, %d, %p, %p): stub\n", This, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface, DWORD dwChannelGroups) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %d): semi-stub\n", This, dwChannelGroups);
This->nrofgroups = dwChannelGroups;
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface, LPDWORD pdwChannelGroups) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p, %p)\n", This, pdwChannelGroups);
*pdwChannelGroups = This->nrofgroups;
return S_OK;
}
HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p, %d)\n", This, fActive);
This->fActive = fActive;
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %d, %d, %d): semi-stub\n", This, dwChannelGroup, dwChannel, dwPriority);
if (dwChannel > 16) {
WARN("isn't there supposed to be 16 channels (no. %d requested)?! (faking as it is ok)\n", dwChannel);
/*return E_INVALIDARG;*/
}
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p, %d, %d, %p)\n", This, dwChannelGroup, dwChannel, pdwPriority);
*pdwPriority = This->group[dwChannelGroup-1].channel[dwChannel].priority;
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
WAVEFORMATEX format;
FIXME("(%p, %p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSize, pdwBufferSize);
if (pWaveFormatEx == NULL)
{
if (pdwWaveFormatExSize)
*pdwWaveFormatExSize = sizeof(format);
else
return E_POINTER;
}
else
{
if (pdwWaveFormatExSize == NULL)
return E_POINTER;
/* Just fill this in with something that will not crash Direct Sound for now. */
/* It won't be used anyway until Performances are completed */
format.wFormatTag = WAVE_FORMAT_PCM;
format.nChannels = 2; /* This->params.dwAudioChannels; */
format.nSamplesPerSec = 44100; /* This->params.dwSampleRate; */
format.wBitsPerSample = 16; /* FIXME: check this */
format.nBlockAlign = (format.wBitsPerSample * format.nChannels) / 8;
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
format.cbSize = 0;
if (*pdwWaveFormatExSize >= sizeof(format))
{
CopyMemory(pWaveFormatEx, &format, min(sizeof(format), *pdwWaveFormatExSize));
*pdwWaveFormatExSize = sizeof(format); /* FIXME check if this is set */
}
else
return E_POINTER; /* FIXME find right error */
}
if (pdwBufferSize)
*pdwBufferSize = 44100 * 2 * 2;
else
return E_POINTER;
return S_OK;
}
static const IDirectMusicPortVtbl DirectMusicPort_Vtbl = {
IDirectMusicPortImpl_QueryInterface,
IDirectMusicPortImpl_AddRef,
IDirectMusicPortImpl_Release,
IDirectMusicPortImpl_PlayBuffer,
IDirectMusicPortImpl_SetReadNotificationHandle,
IDirectMusicPortImpl_Read,
IDirectMusicPortImpl_DownloadInstrument,
IDirectMusicPortImpl_UnloadInstrument,
IDirectMusicPortImpl_GetLatencyClock,
IDirectMusicPortImpl_GetRunningStats,
IDirectMusicPortImpl_Compact,
IDirectMusicPortImpl_GetCaps,
IDirectMusicPortImpl_DeviceIoControl,
IDirectMusicPortImpl_SetNumChannelGroups,
IDirectMusicPortImpl_GetNumChannelGroups,
IDirectMusicPortImpl_Activate,
IDirectMusicPortImpl_SetChannelPriority,
IDirectMusicPortImpl_GetChannelPriority,
IDirectMusicPortImpl_SetDirectSound,
IDirectMusicPortImpl_GetFormat
};
/* IDirectMusicPortDownload IUnknown parts follow: */
static HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj);
return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj);
}
static ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
TRACE("(%p/%p)->()\n", This, iface);
return IUnknown_AddRef((IUnknown *)&(This->lpVtbl));
}
static ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
TRACE("(%p/%p)->()\n", This, iface);
return IUnknown_Release((IUnknown *)&(This->lpVtbl));
}
/* IDirectMusicPortDownload Interface follow: */
static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwDLId, ppIDMDownload);
if (!ppIDMDownload)
return E_POINTER;
return DMUSIC_CreateDirectMusicDownloadImpl(&IID_IDirectMusicDownload, (LPVOID*)ppIDMDownload, NULL);
}
static HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwSize, ppIDMDownload);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
FIXME("(%p/%p)->(%p, %d): stub\n", This, iface, pdwStartDLId, dwCount);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p/%p)->(%p): stub\n", This, iface, pdwAppend);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload);
return S_OK;
}
static HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload);
return S_OK;
}
static const IDirectMusicPortDownloadVtbl DirectMusicPortDownload_Vtbl = {
IDirectMusicPortDownloadImpl_QueryInterface,
IDirectMusicPortDownloadImpl_AddRef,
IDirectMusicPortDownloadImpl_Release,
IDirectMusicPortDownloadImpl_GetBuffer,
IDirectMusicPortDownloadImpl_AllocateBuffer,
IDirectMusicPortDownloadImpl_GetDLId,
IDirectMusicPortDownloadImpl_GetAppend,
IDirectMusicPortDownloadImpl_Download,
IDirectMusicPortDownloadImpl_Unload
};
/* IDirectMusicThru IUnknown parts follow: */
static HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj);
return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj);
}
static ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
TRACE("(%p/%p)->()\n", This, iface);
return IUnknown_AddRef((IUnknown *)&(This->lpVtbl));
}
static ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
TRACE("(%p/%p)->()\n", This, iface);
return IUnknown_Release((IUnknown *)&(This->lpVtbl));
}
/* IDirectMusicThru Interface follow: */
static HRESULT WINAPI IDirectMusicThruImpl_ThruChannel (LPDIRECTMUSICTHRU iface, DWORD dwSourceChannelGroup, DWORD dwSourceChannel, DWORD dwDestinationChannelGroup, DWORD dwDestinationChannel, LPDIRECTMUSICPORT pDestinationPort) {
ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
FIXME("(%p/%p)->(%d, %d, %d, %d, %p): stub\n", This, iface, dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, dwDestinationChannel, pDestinationPort);
return S_OK;
}
static const IDirectMusicThruVtbl DirectMusicThru_Vtbl = {
IDirectMusicThruImpl_QueryInterface,
IDirectMusicThruImpl_AddRef,
IDirectMusicThruImpl_Release,
IDirectMusicThruImpl_ThruChannel
};
HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps) {
IDirectMusicPortImpl *obj;
HRESULT hr = E_FAIL;
TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPortImpl));
if (NULL == obj) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->lpVtbl = &DirectMusicPort_Vtbl;
obj->lpDownloadVtbl = &DirectMusicPortDownload_Vtbl;
obj->lpThruVtbl = &DirectMusicThru_Vtbl;
obj->ref = 0; /* will be inited by QueryInterface */
obj->fActive = FALSE;
obj->params = *pPortParams;
obj->caps = *pPortCaps;
obj->pDirectSound = NULL;
obj->pLatencyClock = NULL;
hr = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&obj->pLatencyClock, NULL);
#if 0
if (pPortParams->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) {
obj->nrofgroups = pPortParams->dwChannelGroups;
/* setting default priorities */
for (j = 0; j < obj->nrofgroups; j++) {
TRACE ("Setting default channel priorities on channel group %i\n", j + 1);
obj->group[j].channel[0].priority = DAUD_CHAN1_DEF_VOICE_PRIORITY;
obj->group[j].channel[1].priority = DAUD_CHAN2_DEF_VOICE_PRIORITY;
obj->group[j].channel[2].priority = DAUD_CHAN3_DEF_VOICE_PRIORITY;
obj->group[j].channel[3].priority = DAUD_CHAN4_DEF_VOICE_PRIORITY;
obj->group[j].channel[4].priority = DAUD_CHAN5_DEF_VOICE_PRIORITY;
obj->group[j].channel[5].priority = DAUD_CHAN6_DEF_VOICE_PRIORITY;
obj->group[j].channel[6].priority = DAUD_CHAN7_DEF_VOICE_PRIORITY;
obj->group[j].channel[7].priority = DAUD_CHAN8_DEF_VOICE_PRIORITY;
obj->group[j].channel[8].priority = DAUD_CHAN9_DEF_VOICE_PRIORITY;
obj->group[j].channel[9].priority = DAUD_CHAN10_DEF_VOICE_PRIORITY;
obj->group[j].channel[10].priority = DAUD_CHAN11_DEF_VOICE_PRIORITY;
obj->group[j].channel[11].priority = DAUD_CHAN12_DEF_VOICE_PRIORITY;
obj->group[j].channel[12].priority = DAUD_CHAN13_DEF_VOICE_PRIORITY;
obj->group[j].channel[13].priority = DAUD_CHAN14_DEF_VOICE_PRIORITY;
obj->group[j].channel[14].priority = DAUD_CHAN15_DEF_VOICE_PRIORITY;
obj->group[j].channel[15].priority = DAUD_CHAN16_DEF_VOICE_PRIORITY;
}
}
#endif
return IDirectMusicPortImpl_QueryInterface ((LPDIRECTMUSICPORT)obj, lpcGUID, ppobj);
}

View file

@ -0,0 +1,476 @@
/*
* self-registerable dll functions for dmusic.dll
*
* Copyright (C) 2003 John K. Hohm
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/*
* Near the bottom of this file are the exported DllRegisterServer and
* DllUnregisterServer, which make all this worthwhile.
*/
/***********************************************************************
* interface for self-registering
*/
struct regsvr_interface {
IID const *iid; /* NULL for end of list */
LPCSTR name; /* can be NULL to omit */
IID const *base_iid; /* can be NULL to omit */
int num_methods; /* can be <0 to omit */
CLSID const *ps_clsid; /* can be NULL to omit */
CLSID const *ps_clsid32; /* can be NULL to omit */
};
static HRESULT register_interfaces(struct regsvr_interface const *list);
static HRESULT unregister_interfaces(struct regsvr_interface const *list);
struct regsvr_coclass {
CLSID const *clsid; /* NULL for end of list */
LPCSTR name; /* can be NULL to omit */
LPCSTR ips; /* can be NULL to omit */
LPCSTR ips32; /* can be NULL to omit */
LPCSTR ips32_tmodel; /* can be NULL to omit */
LPCSTR progid; /* can be NULL to omit */
LPCSTR viprogid; /* can be NULL to omit */
LPCSTR progid_extra; /* can be NULL to omit */
};
static HRESULT register_coclasses(struct regsvr_coclass const *list);
static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
/***********************************************************************
* static string constants
*/
static WCHAR const interface_keyname[10] = {
'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
static WCHAR const base_ifa_keyname[14] = {
'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
'e', 0 };
static WCHAR const num_methods_keyname[11] = {
'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
static WCHAR const ps_clsid_keyname[15] = {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', 0 };
static WCHAR const ps_clsid32_keyname[17] = {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', '3', '2', 0 };
static WCHAR const clsid_keyname[6] = {
'C', 'L', 'S', 'I', 'D', 0 };
static WCHAR const curver_keyname[7] = {
'C', 'u', 'r', 'V', 'e', 'r', 0 };
static WCHAR const ips_keyname[13] = {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
0 };
static WCHAR const ips32_keyname[15] = {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
'3', '2', 0 };
static WCHAR const progid_keyname[7] = {
'P', 'r', 'o', 'g', 'I', 'D', 0 };
static WCHAR const viprogid_keyname[25] = {
'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
0 };
static char const tmodel_valuename[] = "ThreadingModel";
/***********************************************************************
* static helper functions
*/
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
WCHAR const *value);
static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
char const *value);
static LONG register_progid(WCHAR const *clsid,
char const *progid, char const *curver_progid,
char const *name, char const *extra);
/***********************************************************************
* register_interfaces
*/
static HRESULT register_interfaces(struct regsvr_interface const *list) {
LONG res = ERROR_SUCCESS;
HKEY interface_key;
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->iid; ++list) {
WCHAR buf[39];
HKEY iid_key;
StringFromGUID2(list->iid, buf, 39);
res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_interface_key;
if (list->name) {
res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
(CONST BYTE*)(list->name),
strlen(list->name) + 1);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->base_iid) {
res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (0 <= list->num_methods) {
static WCHAR const fmt[3] = { '%', 'd', 0 };
HKEY key;
res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
sprintfW(buf, fmt, list->num_methods);
res = RegSetValueExW(key, NULL, 0, REG_SZ,
(CONST BYTE*)buf,
(lstrlenW(buf) + 1) * sizeof(WCHAR));
RegCloseKey(key);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->ps_clsid) {
res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->ps_clsid32) {
res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
error_close_iid_key:
RegCloseKey(iid_key);
}
error_close_interface_key:
RegCloseKey(interface_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* unregister_interfaces
*/
static HRESULT unregister_interfaces(struct regsvr_interface const *list) {
LONG res = ERROR_SUCCESS;
HKEY interface_key;
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
KEY_READ | KEY_WRITE, &interface_key);
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->iid; ++list) {
WCHAR buf[39];
StringFromGUID2(list->iid, buf, 39);
res = RegDeleteTreeW(interface_key, buf);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
}
RegCloseKey(interface_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* register_coclasses
*/
static HRESULT register_coclasses(struct regsvr_coclass const *list) {
LONG res = ERROR_SUCCESS;
HKEY coclass_key;
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
WCHAR buf[39];
HKEY clsid_key;
StringFromGUID2(list->clsid, buf, 39);
res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->name) {
res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
(CONST BYTE*)(list->name),
strlen(list->name) + 1);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->ips) {
res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->ips32) {
HKEY ips32_key;
res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL,
&ips32_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
(CONST BYTE*)list->ips32,
lstrlenA(list->ips32) + 1);
if (res == ERROR_SUCCESS && list->ips32_tmodel)
res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
(CONST BYTE*)list->ips32_tmodel,
strlen(list->ips32_tmodel) + 1);
RegCloseKey(ips32_key);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->progid) {
res = register_key_defvalueA(clsid_key, progid_keyname,
list->progid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->progid, NULL,
list->name, list->progid_extra);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->viprogid) {
res = register_key_defvalueA(clsid_key, viprogid_keyname,
list->viprogid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->viprogid, list->progid,
list->name, list->progid_extra);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
error_close_clsid_key:
RegCloseKey(clsid_key);
}
error_close_coclass_key:
RegCloseKey(coclass_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* unregister_coclasses
*/
static HRESULT unregister_coclasses(struct regsvr_coclass const *list) {
LONG res = ERROR_SUCCESS;
HKEY coclass_key;
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
KEY_READ | KEY_WRITE, &coclass_key);
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
WCHAR buf[39];
StringFromGUID2(list->clsid, buf, 39);
res = RegDeleteTreeW(coclass_key, buf);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->progid) {
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
}
if (list->viprogid) {
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
}
}
error_close_coclass_key:
RegCloseKey(coclass_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* regsvr_key_guid
*/
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) {
WCHAR buf[39];
StringFromGUID2(guid, buf, 39);
return register_key_defvalueW(base, name, buf);
}
/***********************************************************************
* regsvr_key_defvalueW
*/
static LONG register_key_defvalueW(
HKEY base,
WCHAR const *name,
WCHAR const *value) {
LONG res;
HKEY key;
res = RegCreateKeyExW(base, name, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) return res;
res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
(lstrlenW(value) + 1) * sizeof(WCHAR));
RegCloseKey(key);
return res;
}
/***********************************************************************
* regsvr_key_defvalueA
*/
static LONG register_key_defvalueA(
HKEY base,
WCHAR const *name,
char const *value) {
LONG res;
HKEY key;
res = RegCreateKeyExW(base, name, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) return res;
res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
lstrlenA(value) + 1);
RegCloseKey(key);
return res;
}
/***********************************************************************
* regsvr_progid
*/
static LONG register_progid(
WCHAR const *clsid,
char const *progid,
char const *curver_progid,
char const *name,
char const *extra) {
LONG res;
HKEY progid_key;
res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&progid_key, NULL);
if (res != ERROR_SUCCESS) return res;
if (name) {
res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
(CONST BYTE*)name, strlen(name) + 1);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (clsid) {
res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (curver_progid) {
res = register_key_defvalueA(progid_key, curver_keyname,
curver_progid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (extra) {
HKEY extra_key;
res = RegCreateKeyExA(progid_key, extra, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&extra_key, NULL);
if (res == ERROR_SUCCESS)
RegCloseKey(extra_key);
}
error_close_progid_key:
RegCloseKey(progid_key);
return res;
}
/***********************************************************************
* coclass list
*/
static struct regsvr_coclass const coclass_list[] = {
{ &CLSID_DirectMusic,
"DirectMusic",
NULL,
"dmusic.dll",
"Both",
"Microsoft.DirectMusic.1",
"Microsoft.DirectMusic"
},
{ &CLSID_DirectMusicCollection,
"DirectMusicCollection",
NULL,
"dmusic.dll",
"Both",
"Microsoft.DirectMusicCollection.1",
"Microsoft.DirectMusicCollection"
},
{ NULL } /* list terminator */
};
/***********************************************************************
* interface list
*/
static struct regsvr_interface const interface_list[] = {
{ NULL } /* list terminator */
};
/***********************************************************************
* DllRegisterServer (DMUSIC.3)
*/
HRESULT WINAPI DllRegisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = register_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = register_interfaces(interface_list);
return hr;
}
/***********************************************************************
* DllUnregisterServer (DMUSIC.4)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
return hr;
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2003-2004 Rok Mandeljc <rok.mandeljc@gimb.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_OLESELFREGISTER
#define WINE_FILEDESCRIPTION_STR "Wine DirectMusic"
#define WINE_FILENAME_STR "dmusic.dll"
#define WINE_FILEVERSION 5,3,1,904
#define WINE_FILEVERSION_STR "5.3.1.904"
#define WINE_PRODUCTVERSION 5,3,1,904
#define WINE_PRODUCTVERSION_STR "5.3.1.904"
#include "wine/wine_common_ver.rc"

View file

@ -24,8 +24,23 @@ DEFINE_GUID(IID_IDirectDrawKernel, 0x8D56C120, 0x6A08, 0x11D0, 0x9B, 0x06, 0x00,
DEFINE_GUID(IID_IDirectDrawSurfaceKernel, 0x60755DA0, 0x6A40, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
/* These GUIDs do not exist in ms dxsdk 2004 dec in dxguid, tested by Magnus Olsen */
DEFINE_GUID(CLSID_AudioVBScript,0x4ee17959,0x931e,0x49e4,0xa2,0xc6,0x97,0x7e,0xcf,0x36,0x28,0xf3);
DEFINE_GUID(CLSID_DirectMusicAuditionTrack,0xd2ac2897,0xb39b,0x11d1,0x87,0x04,0x00,0x60,0x08,0x93,0xb1,0xbd);
DEFINE_GUID(CLSID_DirectMusicMelodyFormulationTrack,0xb0684266,0xb57f,0x11d2,0x97,0xf9,0x0,0xc0,0x4f,0xa3,0x6e,0x58);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpAudioPathConfig,0x1cebde3e,0x6b91,0x484a,0xaf,0x48,0x5e,0x4f,0x4e,0xd6,0xb1,0xe1);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpAudioPath,0x2c5f9b72,0x7148,0x4d97,0xbf,0xc9,0x68,0xa0,0xe0,0x76,0xbe,0xbd);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpPerformance,0xa861c6e2,0xfcfc,0x11d2,0x8b,0xc9,0x00,0x60,0x08,0x93,0xb1,0xb6);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpSegment,0x4062c116,0x0270,0x11d3,0x8b,0xcb,0x00,0x60,0x08,0x93,0xb1,0xb6);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpSegmentState,0xebf2320a,0x2502,0x11d3,0x8b,0xd1,0x00,0x60,0x08,0x93,0xb1,0xb6);
DEFINE_GUID(CLSID_DirectMusicScriptAutoImpSong,0xa16f1761,0xb6d8,0x42eb,0x8d,0x57,0x4a,0x44,0xfe,0xdd,0x3b,0xd2);
DEFINE_GUID(CLSID_DirectMusicScriptSourceCodeLoader,0xc70eb77f,0xefd4,0x4678,0xa2,0x7b,0xbf,0x16,0x48,0xf3,0x0d,0x04);
DEFINE_GUID(CLSID_DirectMusicSection,0x3f037241,0x414e,0x11d1,0xa7,0xce,0x00,0xa0,0xc9,0x13,0xf7,0x3c);
DEFINE_GUID(CLSID_DirectMusicSegTriggerTrack,0xbae4d665,0x4ea1,0x11d3,0x8b,0xda,0x00,0x60,0x08,0x93,0xb1,0xb6);
DEFINE_GUID(CLSID_DirectMusicSynthSink,0xaec17ce3,0xa514,0x11d1,0xaf,0xa6,0x00,0xaa,0x00,0x24,0xd8,0xb6);
DEFINE_GUID(CLSID_DirectMusicTemplate,0xd30bcc65,0x60e8,0x11d1,0xa7,0xce,0x00,0xa0,0xc9,0x13,0xf7,0x3c);
DEFINE_GUID(CLSID_DirectMusicSong,0xaed5f0a5,0xd972,0x483d,0xa3,0x84,0x64,0x9d,0xfe,0xb9,0xc1,0x81);
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink,0x0a3a5ba5,0x37b6,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12);
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound,0xbe208857,0x8952,0x11d2,0xba,0x1c,0x00,0x00,0xf8,0x75,0xac,0x12);
DEFINE_GUID(GUID_Clear_All_MelodyFragments,0x8509fee6,0xb617,0x11d2,0x97,0xfa,0x0,0xc0,0x4f,0xa3,0x6e,0x58);
DEFINE_GUID(GUID_MelodyFragment,0xb291c7f2,0xb616,0x11d2,0x97,0xfa,0x0,0xc0,0x4f,0xa3,0x6e,0x58);
DEFINE_GUID(IID_ID3DXAnimationController,0x3a714d34,0xff61,0x421e,0x90,0x9f,0x63,0x9f,0x38,0x35,0x67,0x8);
@ -46,6 +61,9 @@ DEFINE_GUID(IID_ID3DXSPMesh,0x4e3ca05c,0xd4ff,0x4d11,0x8a,0x2,0x16,0x45,0x9e,0x8
DEFINE_GUID(IID_ID3DXTechnique,0xa00f378d,0xaf79,0x4917,0x90,0x7e,0x4d,0x63,0x5e,0xe6,0x38,0x44);
DEFINE_GUID(IID_IDirectDraw3, 0x618F8AD4,0x8b7A,0x11D0,0x8F,0xCC,0x00,0xC0,0x4F,0xd9,0x18,0x9D);
DEFINE_GUID(IID_IDirectMusicSong,0xa862b2ec,0x3676,0x4982,0x85,0xa,0x78,0x42,0x77,0x5e,0x1d,0x86);
DEFINE_GUID(IID_IDirectMusicSynth,0x09823661,0x5c85,0x11d2,0xaf,0xa6,0x00,0xaa,0x00,0x24,0xd8,0xb6);
DEFINE_GUID(IID_IDirectMusicSynth8,0x53cab625,0x2711,0x4c9f,0x9d,0xe7,0x1b,0x7f,0x92,0x5f,0x6f,0xc8);
DEFINE_GUID(IID_IDirectMusicSynthSink,0x09823663,0x5c85,0x11d2,0xaf,0xa6,0x00,0xaa,0x00,0x24,0xd8,0xb6);
DEFINE_GUID(IID_IKsFastClock,0xc9902485,0xc180,0x11d2,0x84,0x73,0xd4,0x23,0x94,0x45,0x9e,0x5e);
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
@ -84,6 +102,7 @@ DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4, 0xB259, 0x11CF,
DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1, 0xB259, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
DEFINE_GUID(CLSID_DirectInputDevice8, 0x25E609E5, 0xB259, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
DEFINE_GUID(CLSID_DirectMusic, 0x636B9F10, 0x0C7D, 0x11D1, 0x95, 0xB2, 0x00, 0x20, 0xAF, 0xDC, 0x74, 0x21);
DEFINE_GUID(CLSID_DirectMusicAudioPath, 0xEE0B9CA0, 0xA81E, 0x11D3, 0x9B, 0xD1, 0x00, 0x80, 0xC7, 0x15, 0x0A, 0x74);
DEFINE_GUID(CLSID_DirectMusicBand, 0x79BA9E00, 0xB6EE, 0x11D1, 0x86, 0xBE, 0x00, 0xC0, 0x4F, 0xBF, 0x8F, 0xEF);
DEFINE_GUID(CLSID_DirectMusicBandTrack, 0xD2AC2894, 0xB39B, 0x11D1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xB1, 0xBD);
DEFINE_GUID(CLSID_DirectMusicChordMap, 0xD2AC288F, 0xB39B, 0x11D1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xB1, 0xBD);

View file

@ -33,6 +33,7 @@ The following libraries are shared with Wine.
reactos/dll/directx/amstream # Autosync
reactos/dll/directx/dinput # Synced to Wine-1_1_4
reactos/dll/directx/dinput8 # Synced to Wine-1_1_4
reactos/dll/directx/dmusic # Synced to Wine-1_1_23
reactos/dll/directx/dplay # Synced to Wine-0_9_5
reactos/dll/directx/dplayx # Synced to Wine-0_9_5
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5