* Sync with Wine 1.5.26.

svn path=/trunk/; revision=58739
This commit is contained in:
Amine Khaldi 2013-04-13 17:29:01 +00:00
parent 12eabcde28
commit c2d5094a67
18 changed files with 3075 additions and 2117 deletions

View file

@ -1,44 +1,27 @@
add_definitions(-D__WINESRC__)
remove_definitions(-D_WIN32_WINNT=0x502) remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600) add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(dmusic.dll dmusic.spec) spec2def(dmusic.dll dmusic.spec)
add_library(dmusic SHARED list(APPEND SOURCE
buffer.c buffer.c
clock.c clock.c
collection.c collection.c
dmusic.c dmusic.c
dmusic_main.c dmusic_main.c
download.c download.c
downloadedinstrument.c
instrument.c instrument.c
port.c port.c
regsvr.c
version.rc version.rc
${CMAKE_CURRENT_BINARY_DIR}/dmusic.def) ${CMAKE_CURRENT_BINARY_DIR}/dmusic.def)
add_library(dmusic SHARED ${SOURCE})
set_module_type(dmusic win32dll UNICODE) set_module_type(dmusic win32dll UNICODE)
target_link_libraries(dmusic dxguid uuid wine)
target_link_libraries(dmusic add_importlibs(dmusic ole32 advapi32 winmm msvcrt kernel32 ntdll)
dxguid
uuid
wine)
add_importlibs(dmusic
msvcrt
user32
advapi32
ole32
dsound
kernel32
ntdll)
add_dependencies(dmusic psdk) add_dependencies(dmusic psdk)
add_pch(dmusic dmusic_private.h) add_pch(dmusic dmusic_private.h)
add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all) add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all)

View file

@ -1,6 +1,8 @@
/* IDirectMusicBuffer Implementation /*
* IDirectMusicBuffer Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,126 +20,241 @@
*/ */
#include "dmusic_private.h" #include "dmusic_private.h"
//#include "initguid.h"
#include "dmksctrl.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusicBufferImpl *impl_from_IDirectMusicBuffer(IDirectMusicBuffer *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicBufferImpl, IDirectMusicBuffer_iface);
}
/* IDirectMusicBufferImpl IUnknown part: */ /* IDirectMusicBufferImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface(LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ret_iface)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
TRACE("(%p, (%s, %p)\n",This,debugstr_dmguid(riid),ppobj); TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicBuffer)) { if (IsEqualIID(riid, &IID_IUnknown) ||
IUnknown_AddRef(iface); IsEqualIID(riid, &IID_IDirectMusicBuffer))
*ppobj = This; {
return S_OK; IDirectMusicBuffer_AddRef(iface);
} *ret_iface = iface;
WARN("(%p, (%s, %p): not found\n",This,debugstr_dmguid(riid),ppobj); return S_OK;
return E_NOINTERFACE; }
*ret_iface = NULL;
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
} }
static ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface) { static ULONG WINAPI IDirectMusicBufferImpl_AddRef(LPDIRECTMUSICBUFFER iface)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
ULONG refCount = InterlockedIncrement(&This->ref); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule(); DMUSIC_LockModule();
return refCount; return ref;
} }
static ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) { static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
ULONG refCount = InterlockedDecrement(&This->ref); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) { if (!ref) {
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This->data);
} HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule(); DMUSIC_UnlockModule();
return refCount; return ref;
} }
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */ /* IDirectMusicBufferImpl IDirectMusicBuffer part: */
static HRESULT WINAPI IDirectMusicBufferImpl_Flush (LPDIRECTMUSICBUFFER iface) { static HRESULT WINAPI IDirectMusicBufferImpl_Flush(LPDIRECTMUSICBUFFER iface)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p): stub\n", This); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->()\n", iface);
This->write_pos = 0;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime) { static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, prtTime); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
FIXME("(%p, %p): stub\n", This, prtTime);
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD dwChannelMessage) { static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time, DWORD channel_group, DWORD channel_message)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, 0x%s, %d, %d): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, dwChannelMessage); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK; DWORD new_write_pos = This->write_pos + sizeof(DMUS_EVENTHEADER) + sizeof(DWORD);
DMUS_EVENTHEADER header;
TRACE("(%p)->(0x%s, %u, 0x%x)\n", iface, wine_dbgstr_longlong(ref_time), channel_group, channel_message);
if (new_write_pos > This->size)
return DMUS_E_BUFFER_FULL;
/* Channel_message 0xZZYYXX (3 bytes) is a midi message where XX = status byte, YY = byte 1 and ZZ = byte 2 */
if (!(channel_message & 0x80))
{
/* Status byte MSB is always set */
return DMUS_E_INVALID_EVENT;
}
if (!This->write_pos)
This->start_time = ref_time;
header.cbEvent = 3; /* Midi message takes 4 bytes space but only 3 are relevant */
header.dwChannelGroup = channel_group;
header.rtDelta = ref_time - This->start_time;
header.dwFlags = DMUS_EVENT_STRUCTURED;
memcpy(This->data + This->write_pos, &header, sizeof(header));
*(DWORD*)(This->data + This->write_pos + sizeof(header)) = channel_message;
This->write_pos = new_write_pos;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb) { 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); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
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) { static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr(LPDIRECTMUSICBUFFER iface)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p): stub\n", This); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
FIXME("(%p): stub\n", This);
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData) { 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); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
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) { static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr(LPDIRECTMUSICBUFFER iface, LPBYTE* data)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, ppData); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%p)\n", iface, data);
if (!data)
return E_POINTER;
*data = This->data;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt) { static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME ref_time)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, prt); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%p)\n", iface, ref_time);
if (!ref_time)
return E_POINTER;
if (!This->write_pos)
return DMUS_E_BUFFER_EMPTY;
*ref_time = This->start_time;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) { static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes(LPDIRECTMUSICBUFFER iface, LPDWORD used_bytes)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, pcb); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%p)\n", iface, used_bytes);
if (!used_bytes)
return E_POINTER;
*used_bytes = This->write_pos;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) { static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes(LPDIRECTMUSICBUFFER iface, LPDWORD max_bytes)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, pcb); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%p)\n", iface, max_bytes);
if (!max_bytes)
return E_POINTER;
*max_bytes = This->size;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat (LPDIRECTMUSICBUFFER iface, LPGUID pGuidFormat) { static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat(LPDIRECTMUSICBUFFER iface, LPGUID format)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %p): stub\n", This, pGuidFormat); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%p)\n", iface, format);
if (!format)
return E_POINTER;
*format = This->format;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt) { static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, 0x%s): stub\n", This, wine_dbgstr_longlong(rt)); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(0x%s)\n", This, wine_dbgstr_longlong(ref_time));
This->start_time = ref_time;
return S_OK;
} }
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes (LPDIRECTMUSICBUFFER iface, DWORD cb) { static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes(LPDIRECTMUSICBUFFER iface, DWORD used_bytes)
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface; {
FIXME("(%p, %d): stub\n", This, cb); IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
return S_OK;
TRACE("(%p)->(%u)\n", iface, used_bytes);
if (used_bytes > This->size)
return DMUS_E_BUFFER_FULL;
This->write_pos = used_bytes;
return S_OK;
} }
static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = { static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
@ -159,17 +276,40 @@ static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
IDirectMusicBufferImpl_SetUsedBytes IDirectMusicBufferImpl_SetUsedBytes
}; };
/* for ClassFactory */ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface)
HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { {
IDirectMusicBufferImpl* dmbuff; IDirectMusicBufferImpl* dmbuffer;
HRESULT hr;
dmbuff = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
if (NULL == dmbuff) { TRACE("(%p, %p)\n", desc, ret_iface);
*ppobj = NULL;
return E_OUTOFMEMORY; *ret_iface = NULL;
}
dmbuff->lpVtbl = &DirectMusicBuffer_Vtbl; dmbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
dmbuff->ref = 0; /* will be inited by QueryInterface */ if (!dmbuffer)
return E_OUTOFMEMORY;
return IDirectMusicBufferImpl_QueryInterface ((LPDIRECTMUSICBUFFER)dmbuff, lpcGUID, ppobj);
dmbuffer->IDirectMusicBuffer_iface.lpVtbl = &DirectMusicBuffer_Vtbl;
dmbuffer->ref = 0; /* Will be inited by QueryInterface */
if (IsEqualGUID(&desc->guidBufferFormat, &GUID_NULL))
dmbuffer->format = KSDATAFORMAT_SUBTYPE_MIDI;
else
dmbuffer->format = desc->guidBufferFormat;
dmbuffer->size = (desc->cbBuffer + 3) & ~3; /* Buffer size must be multiple of 4 bytes */
dmbuffer->data = HeapAlloc(GetProcessHeap(), 0, dmbuffer->size);
if (!dmbuffer->data) {
HeapFree(GetProcessHeap(), 0, dmbuffer);
return E_OUTOFMEMORY;
}
hr = IDirectMusicBufferImpl_QueryInterface((LPDIRECTMUSICBUFFER)dmbuffer, &IID_IDirectMusicBuffer, ret_iface);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, dmbuffer->data);
HeapFree(GetProcessHeap(), 0, dmbuffer);
}
return hr;
} }

View file

@ -1,4 +1,5 @@
/* IReferenceClock Implementation /*
* IReferenceClock Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* *
@ -21,9 +22,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
{
return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
}
/* IReferenceClockImpl IUnknown part: */ /* IReferenceClockImpl IUnknown part: */
static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) || if (IsEqualIID (riid, &IID_IUnknown) ||
@ -36,56 +43,70 @@ static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) { static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
ULONG refCount = InterlockedIncrement(&This->ref); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); TRACE("(%p)->(): new ref = %u\n", This, ref);
DMUSIC_LockModule(); DMUSIC_LockModule();
return refCount; return ref;
} }
static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) { static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
ULONG refCount = InterlockedDecrement(&This->ref); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!refCount) { if (!ref)
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule(); DMUSIC_UnlockModule();
return refCount; return ref;
} }
/* IReferenceClockImpl IReferenceClock part: */ /* IReferenceClockImpl IReferenceClock part: */
static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) { static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
TRACE("(%p, %p)\n", This, pTime); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
*pTime = This->rtTime;
return S_OK; 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) { 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); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
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) { 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); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
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) { static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
FIXME("(%p, %d): stub\n", This, dwAdviseCookie); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
return S_OK;
} }
static const IReferenceClockVtbl ReferenceClock_Vtbl = { static const IReferenceClockVtbl ReferenceClock_Vtbl = {
@ -99,18 +120,22 @@ static const IReferenceClockVtbl ReferenceClock_Vtbl = {
}; };
/* for ClassFactory */ /* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
IReferenceClockImpl* clock; {
IReferenceClockImpl* clock;
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl)); TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter);
if (NULL == clock) {
*ppobj = NULL; clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
return E_OUTOFMEMORY; if (!clock) {
} *ret_iface = NULL;
clock->lpVtbl = &ReferenceClock_Vtbl; return E_OUTOFMEMORY;
clock->ref = 0; /* will be inited by QueryInterface */ }
clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
clock->ref = 0; /* Will be inited by QueryInterface */
return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj); clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
return IReferenceClockImpl_QueryInterface((IReferenceClock*)clock, riid, ret_iface);
} }

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,8 @@
/* IDirectMusic8 Implementation /*
* IDirectMusic8 Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -16,245 +18,420 @@
* License along with this program; if not, write to the Free Software * License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
//#include <stdio.h>
#include "dmusic_private.h" #include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusic8Impl *impl_from_IDirectMusic8(IDirectMusic8 *iface)
{
return CONTAINING_RECORD(iface, IDirectMusic8Impl, IDirectMusic8_iface);
}
/* IDirectMusic8Impl IUnknown part: */ /* IDirectMusic8Impl IUnknown part: */
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusic8Impl_QueryInterface(LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ret_iface)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
if (IsEqualIID (riid, &IID_IUnknown) || TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
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); if (IsEqualIID (riid, &IID_IUnknown) ||
return E_NOINTERFACE; IsEqualIID (riid, &IID_IDirectMusic) ||
IsEqualIID (riid, &IID_IDirectMusic2) ||
IsEqualIID (riid, &IID_IDirectMusic8))
{
IDirectMusic8_AddRef(iface);
*ret_iface = iface;
return S_OK;
}
*ret_iface = NULL;
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
} }
static ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) { static ULONG WINAPI IDirectMusic8Impl_AddRef(LPDIRECTMUSIC8 iface)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
ULONG refCount = InterlockedIncrement(&This->ref); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); TRACE("(%p)->(): new ref = %u\n", This, ref);
DMUSIC_LockModule(); DMUSIC_LockModule();
return refCount; return ref;
} }
static ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) { static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
ULONG refCount = InterlockedDecrement(&This->ref); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!refCount) { if (!ref) {
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This->system_ports);
} HeapFree(GetProcessHeap(), 0, This->ppPorts);
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule(); DMUSIC_UnlockModule();
return refCount; return ref;
} }
/* IDirectMusic8Impl IDirectMusic part: */ /* IDirectMusic8Impl IDirectMusic part: */
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) { static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_PORTCAPS port_caps)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
TRACE("(%p, %d, %p)\n", This, dwIndex, pPortCaps); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
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*/ TRACE("(%p, %d, %p)\n", This, index, port_caps);
#if 0
int numMIDI = midiOutGetNumDevs(); if (!port_caps)
int numWAVE = waveOutGetNumDevs(); return E_POINTER;
int i;
/* then return digital sound ports */ if (index >= This->nb_system_ports)
for (i = 1; i <= numWAVE; i++) return S_FALSE;
{
TRACE("enumerating 'digital sound' ports\n"); *port_caps = This->system_ports[index].caps;
if (i == dwIndex)
{ return S_OK;
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) { static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer(LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC buffer_desc, LPDIRECTMUSICBUFFER* buffer, LPUNKNOWN unkouter)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
TRACE("(%p, %p, %p, %p)\n", This, pBufferDesc, ppBuffer, pUnkOuter); TRACE("(%p)->(%p, %p, %p)\n", This, buffer_desc, buffer, unkouter);
if (pUnkOuter) if (unkouter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
if (!pBufferDesc || !ppBuffer) if (!buffer_desc || !buffer)
return E_POINTER; return E_POINTER;
return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL); return DMUSIC_CreateDirectMusicBufferImpl(buffer_desc, (LPVOID)buffer);
} }
static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) { static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsid_port, LPDMUS_PORTPARAMS port_params, LPDIRECTMUSICPORT* port, LPUNKNOWN unkouter)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
int i/*, j*/; IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
DMUS_PORTCAPS PortCaps; int i;
IDirectMusicPort* pNewPort = NULL; DMUS_PORTCAPS port_caps;
HRESULT hr = E_FAIL; IDirectMusicPort* new_port = NULL;
HRESULT hr;
GUID default_port;
const GUID *request_port = rclsid_port;
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_dmguid(rclsidPort), pPortParams, ppPort, pUnkOuter); TRACE("(%p)->(%s, %p, %p, %p)\n", This, debugstr_dmguid(rclsid_port), port_params, port, unkouter);
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) { if (!rclsid_port)
if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) { return E_POINTER;
hr = DMUSIC_CreateDirectMusicPortImpl(&IID_IDirectMusicPort, (LPVOID*) &pNewPort, (LPUNKNOWN) This, pPortParams, &PortCaps); if (!port_params)
if (FAILED(hr)) { return E_INVALIDARG;
*ppPort = NULL; if (!port)
return hr; return E_POINTER;
} if (unkouter)
This->nrofports++; return CLASS_E_NOAGGREGATION;
if (!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports); if (TRACE_ON(dmusic))
This->ppPorts[This->nrofports - 1] = pNewPort; dump_DMUS_PORTPARAMS(port_params);
*ppPort = pNewPort;
return S_OK; ZeroMemory(&port_caps, sizeof(DMUS_PORTCAPS));
} port_caps.dwSize = sizeof(DMUS_PORTCAPS);
}
/* FIXME: place correct error here */ if (IsEqualGUID(request_port, &GUID_NULL)) {
return E_NOINTERFACE; hr = IDirectMusic8_GetDefaultPort(iface, &default_port);
if(FAILED(hr))
return hr;
request_port = &default_port;
}
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &port_caps); i++) {
if (IsEqualCLSID(request_port, &port_caps.guidPort)) {
hr = This->system_ports[i].create(&IID_IDirectMusicPort, (LPVOID*)&new_port, (LPUNKNOWN)This, port_params, &port_caps, This->system_ports[i].device);
if (FAILED(hr)) {
*port = 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] = new_port;
*port = new_port;
return S_OK;
}
}
return E_NOINTERFACE;
} }
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) { static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_CLOCKINFO clock_info)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
FIXME("(%p, %d, %p): stub\n", This, dwIndex, lpClockInfo); TRACE("(%p)->(%d, %p)\n", iface, index, clock_info);
return S_FALSE;
if (!clock_info)
return E_POINTER;
if (index > 1)
return S_FALSE;
if (!index)
{
static const GUID guid_system_clock = { 0x58d58419, 0x71b4, 0x11d1, { 0xa7, 0x4c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12 } };
static const WCHAR name_system_clock[] = { 'S','y','s','t','e','m',' ','C','l','o','c','k',0 };
clock_info->ctType = 0;
clock_info->guidClock = guid_system_clock;
strcpyW(clock_info->wszDescription, name_system_clock);
}
else
{
static const GUID guid_dsound_clock = { 0x58d58420, 0x71b4, 0x11d1, { 0xa7, 0x4c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12 } };
static const WCHAR name_dsound_clock[] = { 'D','i','r','e','c','t','S','o','u','n','d',' ','C','l','o','c','k',0 };
clock_info->ctType = 0;
clock_info->guidClock = guid_dsound_clock;
strcpyW(clock_info->wszDescription, name_dsound_clock);
}
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock (LPDIRECTMUSIC8 iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock) { static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock(LPDIRECTMUSIC8 iface, LPGUID guid_clock, IReferenceClock** reference_clock)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
TRACE("(%p, %p, %p)\n", This, pguidClock, ppReferenceClock); TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock);
if (pguidClock)
*pguidClock = This->pMasterClock->pClockInfo.guidClock;
if(ppReferenceClock)
*ppReferenceClock = (IReferenceClock *)This->pMasterClock;
return S_OK; if (guid_clock)
*guid_clock = This->pMasterClock->pClockInfo.guidClock;
if (reference_clock)
*reference_clock = (IReferenceClock*)This->pMasterClock;
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock (LPDIRECTMUSIC8 iface, REFGUID rguidClock) { static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock(LPDIRECTMUSIC8 iface, REFGUID rguidClock)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidClock)); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
return S_OK;
FIXME("(%p)->(%s): stub\n", This, debugstr_dmguid(rguidClock));
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_Activate (LPDIRECTMUSIC8 iface, BOOL fEnable) { static HRESULT WINAPI IDirectMusic8Impl_Activate(LPDIRECTMUSIC8 iface, BOOL enable)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
int i; IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
int i;
FIXME("(%p, %d): stub\n", This, fEnable); HRESULT hr;
for (i = 0; i < This->nrofports; i++) {
IDirectMusicPortImpl_Activate(This->ppPorts[i], fEnable); TRACE("(%p)->(%u)\n", This, enable);
}
for (i = 0; i < This->nrofports; i++)
return S_OK; {
hr = IDirectMusicPort_Activate(This->ppPorts[i], enable);
if (FAILED(hr))
return hr;
}
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LPGUID pguidPort) { static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort(LPDIRECTMUSIC8 iface, LPGUID guid_port)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
HKEY hkGUID; IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
DWORD returnTypeGUID, sizeOfReturnBuffer = 50; HKEY hkGUID;
char returnBuffer[51]; DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
GUID defaultPortGUID; char returnBuffer[51];
WCHAR buff[51]; GUID defaultPortGUID;
WCHAR buff[51];
TRACE("(%p, %p)\n", This, pguidPort); TRACE("(%p)->(%p)\n", This, guid_port);
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)) 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; WARN(": registry entry missing\n" );
return S_OK; *guid_port = 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)); /* FIXME: Check return types to ensure we're interpreting data right */
CLSIDFromString(buff, &defaultPortGUID); MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
*pguidPort = defaultPortGUID; CLSIDFromString(buff, &defaultPortGUID);
*guid_port = defaultPortGUID;
return S_OK;
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) { static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(LPDIRECTMUSIC8 iface, LPDIRECTSOUND dsound, HWND wnd)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
return S_OK;
FIXME("(%p)->(%p, %p): stub\n", This, dsound, wnd);
return S_OK;
} }
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) { static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock(LPDIRECTMUSIC8 iface, IReferenceClock* clock)
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; {
FIXME("(%p, %p): stub\n", This, pClock); IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
return S_OK;
FIXME("(%p)->(%p): stub\n", This, clock);
return S_OK;
} }
static const IDirectMusic8Vtbl DirectMusic8_Vtbl = { static const IDirectMusic8Vtbl DirectMusic8_Vtbl = {
IDirectMusic8Impl_QueryInterface, IDirectMusic8Impl_QueryInterface,
IDirectMusic8Impl_AddRef, IDirectMusic8Impl_AddRef,
IDirectMusic8Impl_Release, IDirectMusic8Impl_Release,
IDirectMusic8Impl_EnumPort, IDirectMusic8Impl_EnumPort,
IDirectMusic8Impl_CreateMusicBuffer, IDirectMusic8Impl_CreateMusicBuffer,
IDirectMusic8Impl_CreatePort, IDirectMusic8Impl_CreatePort,
IDirectMusic8Impl_EnumMasterClock, IDirectMusic8Impl_EnumMasterClock,
IDirectMusic8Impl_GetMasterClock, IDirectMusic8Impl_GetMasterClock,
IDirectMusic8Impl_SetMasterClock, IDirectMusic8Impl_SetMasterClock,
IDirectMusic8Impl_Activate, IDirectMusic8Impl_Activate,
IDirectMusic8Impl_GetDefaultPort, IDirectMusic8Impl_GetDefaultPort,
IDirectMusic8Impl_SetDirectSound, IDirectMusic8Impl_SetDirectSound,
IDirectMusic8Impl_SetExternalMasterClock IDirectMusic8Impl_SetExternalMasterClock
}; };
/* for ClassFactory */ static void create_system_ports_list(IDirectMusic8Impl* object)
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { {
IDirectMusic8Impl *dmusic; port_info * port;
const WCHAR emulated[] = {' ','[','E','m','u','l','a','t','e','d',']',0};
ULONG nb_ports;
ULONG nb_midi_out;
ULONG nb_midi_in;
MIDIOUTCAPSW caps_out;
MIDIINCAPSW caps_in;
IDirectMusicSynth8* synth;
HRESULT hr;
ULONG i;
TRACE("(%p,%p,%p)\n",lpcGUID, ppobj, pUnkOuter); TRACE("(%p)\n", object);
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl)); /* NOTE:
if (NULL == dmusic) { - it seems some native versions get the rest of devices through dmusic32.EnumLegacyDevices...*sigh*...which is undocumented
*ppobj = NULL; - should we enum wave devices ? Native does not seem to
return E_OUTOFMEMORY; */
}
dmusic->lpVtbl = &DirectMusic8_Vtbl; nb_midi_out = midiOutGetNumDevs();
dmusic->ref = 0; /* will be inited with QueryInterface */ nb_midi_in = midiInGetNumDevs();
dmusic->pMasterClock = NULL; nb_ports = 1 /* midi mapper */ + nb_midi_out + nb_midi_in + 1 /* synth port */;
dmusic->ppPorts = NULL;
dmusic->nrofports = 0; port = object->system_ports = HeapAlloc(GetProcessHeap(), 0, nb_ports * sizeof(port_info));
DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL); if (!object->system_ports)
return;
return IDirectMusic8Impl_QueryInterface ((LPDIRECTMUSIC8)dmusic, lpcGUID, ppobj);
/* Fill common port caps for all winmm ports */
for (i = 0; i < (nb_ports - 1 /* synth port*/); i++)
{
object->system_ports[i].caps.dwSize = sizeof(DMUS_PORTCAPS);
object->system_ports[i].caps.dwType = DMUS_PORT_WINMM_DRIVER;
object->system_ports[i].caps.dwMemorySize = 0;
object->system_ports[i].caps.dwMaxChannelGroups = 1;
object->system_ports[i].caps.dwMaxVoices = 0;
object->system_ports[i].caps.dwMaxAudioChannels = 0;
object->system_ports[i].caps.dwEffectFlags = DMUS_EFFECT_NONE;
/* Fake port GUID */
object->system_ports[i].caps.guidPort = IID_IUnknown;
object->system_ports[i].caps.guidPort.Data1 = i + 1;
}
/* Fill midi mapper port info */
port->device = MIDI_MAPPER;
port->create = DMUSIC_CreateMidiOutPortImpl;
midiOutGetDevCapsW(MIDI_MAPPER, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_SHAREABLE;
port->caps.dwClass = DMUS_PC_OUTPUTCLASS;
port++;
/* Fill midi out port info */
for (i = 0; i < nb_midi_out; i++)
{
port->device = i;
port->create = DMUSIC_CreateMidiOutPortImpl;
midiOutGetDevCapsW(i, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_SHAREABLE | DMUS_PC_EXTERNAL;
port->caps.dwClass = DMUS_PC_OUTPUTCLASS;
port++;
}
/* Fill midi in port info */
for (i = 0; i < nb_midi_in; i++)
{
port->device = i;
port->create = DMUSIC_CreateMidiInPortImpl;
midiInGetDevCapsW(i, &caps_in, sizeof(caps_in));
strcpyW(port->caps.wszDescription, caps_in.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_EXTERNAL;
port->caps.dwClass = DMUS_PC_INPUTCLASS;
port++;
}
/* Fill synth port info */
port->create = DMUSIC_CreateSynthPortImpl;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
if (SUCCEEDED(hr))
{
port->caps.dwSize = sizeof(port->caps);
hr = IDirectMusicSynth8_GetPortCaps(synth, &port->caps);
IDirectMusicSynth8_Release(synth);
}
if (FAILED(hr))
nb_ports--;
object->nb_system_ports = nb_ports;
}
/* For ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
{
IDirectMusic8Impl *dmusic;
HRESULT ret;
TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter);
*ret_iface = NULL;
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
if (!dmusic)
return E_OUTOFMEMORY;
dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 0; /* Will be inited by QueryInterface */
dmusic->pMasterClock = NULL;
dmusic->ppPorts = NULL;
dmusic->nrofports = 0;
ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
if (FAILED(ret)) {
HeapFree(GetProcessHeap(), 0, dmusic);
return ret;
}
ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface);
if (FAILED(ret)) {
IReferenceClock_Release(&dmusic->pMasterClock->IReferenceClock_iface);
HeapFree(GetProcessHeap(), 0, dmusic);
return ret;
}
create_system_ports_list(dmusic);
return S_OK;
} }

View file

@ -0,0 +1,35 @@
/*
* COM Classes for dmusic
*
* Copyright 2010 Alexandre Julliard
*
* 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
*/
[
threading(both),
progid("Microsoft.DirectMusic.1"),
vi_progid("Microsoft.DirectMusic"),
uuid(636b9f10-0c7d-11d1-95b2-0020afdc7421)
]
coclass DirectMusic { interface IDirectMusic; }
[
threading(both),
progid("Microsoft.DirectMusicCollection.1"),
vi_progid("Microsoft.DirectMusicCollection"),
uuid(480ff4b0-28b2-11d1-bef7-00c04fbf8fef)
]
coclass DirectMusicCollection { interface IDirectMusicCollection; }

View file

@ -0,0 +1,39 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{636B9F10-0C7D-11D1-95B2-0020AFDC7421}' = s 'DirectMusic'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
ProgId = s 'Microsoft.DirectMusic.1'
VersionIndependentProgId = s 'Microsoft.DirectMusic'
}
'{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}' = s 'DirectMusicCollection'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
ProgId = s 'Microsoft.DirectMusicCollection.1'
VersionIndependentProgId = s 'Microsoft.DirectMusicCollection'
}
}
'Microsoft.DirectMusic.1' = s 'DirectMusic'
{
CLSID = s '{636B9F10-0C7D-11D1-95B2-0020AFDC7421}'
}
'Microsoft.DirectMusic' = s 'DirectMusic'
{
CLSID = s '{636B9F10-0C7D-11D1-95B2-0020AFDC7421}'
CurVer = s 'Microsoft.DirectMusic.1'
}
'Microsoft.DirectMusicCollection.1' = s 'DirectMusicCollection'
{
CLSID = s '{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}'
}
'Microsoft.DirectMusicCollection' = s 'DirectMusicCollection'
{
CLSID = s '{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}'
CurVer = s 'Microsoft.DirectMusicCollection.1'
}
}

View file

@ -23,112 +23,93 @@
#include <stdio.h> #include <stdio.h>
#include "dmusic_private.h" #include "dmusic_private.h"
#include "rpcproxy.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static HINSTANCE instance;
LONG DMUSIC_refCount = 0; LONG DMUSIC_refCount = 0;
typedef struct { typedef struct {
const IClassFactoryVtbl *lpVtbl; IClassFactory IClassFactory_iface;
HRESULT (WINAPI *fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter);
} IClassFactoryImpl; } IClassFactoryImpl;
/****************************************************************** /******************************************************************
* DirectMusic ClassFactory * IClassFactory implementation
*/ */
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); {
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
} }
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) { static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
DMUSIC_LockModule(); {
if (ppv == NULL)
return E_POINTER;
return 2; /* non-heap based object */ if (IsEqualGUID(&IID_IUnknown, riid))
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
else if (IsEqualGUID(&IID_IClassFactory, riid))
TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
else {
FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
*ppv = iface;
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
} }
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) { static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
DMUSIC_UnlockModule(); {
DMUSIC_LockModule();
return 1; /* non-heap based object */ return 2; /* non-heap based object */
} }
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); {
return DMUSIC_CreateDirectMusicImpl (riid, ppobj, pOuter); DMUSIC_UnlockModule();
return 1; /* non-heap based object */
} }
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
TRACE("(%d)\n", dolock); REFIID riid, void **ppv)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
if (dolock) TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv);
DMUSIC_LockModule();
else return This->fnCreateInstance(riid, ppv, pUnkOuter);
DMUSIC_UnlockModule();
return S_OK;
} }
static const IClassFactoryVtbl DirectMusicCF_Vtbl = { static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
DirectMusicCF_QueryInterface, {
DirectMusicCF_AddRef, TRACE("(%d)\n", dolock);
DirectMusicCF_Release,
DirectMusicCF_CreateInstance, if (dolock)
DirectMusicCF_LockServer DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
}
static const IClassFactoryVtbl classfactory_vtbl = {
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
ClassFactory_CreateInstance,
ClassFactory_LockServer
}; };
static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl}; static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicImpl};
static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl},
/****************************************************************** DMUSIC_CreateDirectMusicCollectionImpl};
* 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 * DllMain
@ -137,6 +118,7 @@ static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
*/ */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) { if (fdwReason == DLL_PROCESS_ATTACH) {
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL); DisableThreadLibraryCalls(hinstDLL);
/* FIXME: Initialisation */ /* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) { } else if (fdwReason == DLL_PROCESS_DETACH) {
@ -180,6 +162,21 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return CLASS_E_CLASSNOTAVAILABLE; return CLASS_E_CLASSNOTAVAILABLE;
} }
/***********************************************************************
* DllRegisterServer (DMUSIC.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (DMUSIC.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}
/****************************************************************** /******************************************************************
* Helper functions * Helper functions
@ -187,7 +184,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
* *
*/ */
/* dwPatch from MIDILOCALE */ /* dwPatch from MIDILOCALE */
DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale) { DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) {
DWORD dwPatch = 0; DWORD dwPatch = 0;
if (!pLocale) return 0; if (!pLocale) return 0;
dwPatch |= (pLocale->ulBank & F_INSTRUMENT_DRUMS); /* set drum bit */ dwPatch |= (pLocale->ulBank & F_INSTRUMENT_DRUMS); /* set drum bit */
@ -449,27 +446,48 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
} }
/* dump whole DMUS_OBJECTDESC struct */ /* Dump whole DMUS_OBJECTDESC struct */
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) { void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
if (pDesc) { {
char buffer[1024] = "", *ptr = &buffer[0]; TRACE("DMUS_OBJECTDESC (%p):\n", desc);
TRACE(" - dwSize = %d\n", desc->dwSize);
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc); TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData));
ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize); if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData)); if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass)); if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject)); if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n"); if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion)); if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName)); if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory)); if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName)); wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n", if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream);
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData); }
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
/* Dump DMUS_PORTPARAMS flags */
return wine_dbg_sprintf("%s", buffer); static const char* debugstr_DMUS_PORTPARAMS_FLAGS(DWORD flagmask)
} else { {
return wine_dbg_sprintf("(NULL)"); static const flag_info flags[] = {
} FE(DMUS_PORTPARAMS_VOICES),
FE(DMUS_PORTPARAMS_CHANNELGROUPS),
FE(DMUS_PORTPARAMS_AUDIOCHANNELS),
FE(DMUS_PORTPARAMS_SAMPLERATE),
FE(DMUS_PORTPARAMS_EFFECTS),
FE(DMUS_PORTPARAMS_SHARE)
};
return debugstr_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0]));
}
/* Dump whole DMUS_PORTPARAMS struct */
void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params)
{
TRACE("DMUS_PORTPARAMS (%p):\n", params);
TRACE(" - dwSize = %d\n", params->dwSize);
TRACE(" - dwValidParams = %s\n", debugstr_DMUS_PORTPARAMS_FLAGS(params->dwValidParams));
if (params->dwValidParams & DMUS_PORTPARAMS_VOICES) TRACE(" - dwVoices = %u\n", params->dwVoices);
if (params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) TRACE(" - dwChannelGroup = %u\n", params->dwChannelGroups);
if (params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS) TRACE(" - dwAudioChannels = %u\n", params->dwAudioChannels);
if (params->dwValidParams & DMUS_PORTPARAMS_SAMPLERATE) TRACE(" - dwSampleRate = %u\n", params->dwSampleRate);
if (params->dwValidParams & DMUS_PORTPARAMS_EFFECTS) TRACE(" - dwEffectFlags = %x\n", params->dwEffectFlags);
if (params->dwValidParams & DMUS_PORTPARAMS_SHARE) TRACE(" - fShare = %u\n", params->fShare);
} }

View file

@ -1,6 +1,8 @@
/* DirectMusic Private Include /*
* DirectMusic Private Include
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -50,14 +52,12 @@ typedef struct IDirectMusic8Impl IDirectMusic8Impl;
typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl; typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl; typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
typedef struct IReferenceClockImpl IReferenceClockImpl; typedef struct IReferenceClockImpl IReferenceClockImpl;
typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl; typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl; typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
typedef struct SynthPortImpl SynthPortImpl;
/***************************************************************************** /*****************************************************************************
* Some stuff to make my life easier :=) * Some stuff to make my life easier :=)
@ -74,102 +74,133 @@ typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */ DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
} DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP; } DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
typedef struct port_info {
DMUS_PORTCAPS caps;
HRESULT (*create)(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device);
ULONG device;
} port_info;
typedef struct instrument_region {
RGNHEADER header;
WAVELINK wave_link;
WSMPL wave_sample;
WLOOP wave_loop;
BOOL loop_present;
} instrument_region;
typedef struct instrument_articulation {
CONNECTIONLIST connections_list;
CONNECTION *connections;
} instrument_articulation;
/***************************************************************************** /*****************************************************************************
* ClassFactory * 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); /* CLSID */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
/* Internal */
extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirectMusic8Impl implementation structure * IDirectMusic8Impl implementation structure
*/ */
struct IDirectMusic8Impl { struct IDirectMusic8Impl {
/* IUnknown fields */ /* IUnknown fields */
const IDirectMusic8Vtbl *lpVtbl; IDirectMusic8 IDirectMusic8_iface;
LONG ref; LONG ref;
/* IDirectMusicImpl fields */ /* IDirectMusicImpl fields */
IReferenceClockImpl* pMasterClock; IReferenceClockImpl* pMasterClock;
IDirectMusicPort** ppPorts; IDirectMusicPort** ppPorts;
int nrofports; int nrofports;
port_info* system_ports;
int nb_system_ports;
}; };
/***************************************************************************** /*****************************************************************************
* IDirectMusicBufferImpl implementation structure * IDirectMusicBufferImpl implementation structure
*/ */
struct IDirectMusicBufferImpl { struct IDirectMusicBufferImpl {
/* IUnknown fields */ /* IUnknown fields */
const IDirectMusicBufferVtbl *lpVtbl; IDirectMusicBuffer IDirectMusicBuffer_iface;
LONG ref; LONG ref;
/* IDirectMusicBufferImpl fields */ /* IDirectMusicBufferImpl fields */
GUID format;
DWORD size;
LPBYTE data;
DWORD write_pos;
REFERENCE_TIME start_time;
}; };
/***************************************************************************** /*****************************************************************************
* IDirectMusicDownloadedInstrumentImpl implementation structure * IDirectMusicDownloadedInstrumentImpl implementation structure
*/ */
struct IDirectMusicDownloadedInstrumentImpl { struct IDirectMusicDownloadedInstrumentImpl {
/* IUnknown fields */ /* IUnknown fields */
const IDirectMusicDownloadedInstrumentVtbl *lpVtbl; IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
LONG ref; LONG ref;
/* IDirectMusicDownloadedInstrumentImpl fields */ /* IDirectMusicDownloadedInstrumentImpl fields */
BOOL downloaded;
void *data;
}; };
/***************************************************************************** /*****************************************************************************
* IDirectMusicDownloadImpl implementation structure * IDirectMusicDownloadImpl implementation structure
*/ */
struct IDirectMusicDownloadImpl { struct IDirectMusicDownloadImpl {
/* IUnknown fields */ /* IUnknown fields */
const IDirectMusicDownloadVtbl *lpVtbl; IDirectMusicDownload IDirectMusicDownload_iface;
LONG ref; LONG ref;
/* IDirectMusicDownloadImpl fields */ /* IDirectMusicDownloadImpl fields */
}; };
/***************************************************************************** /*****************************************************************************
* IDirectMusicPortImpl implementation structure * SynthPortImpl implementation structure
*/ */
struct IDirectMusicPortImpl { struct SynthPortImpl {
/* IUnknown fields */ /* IUnknown fields */
const IDirectMusicPortVtbl *lpVtbl; IDirectMusicPort IDirectMusicPort_iface;
const IDirectMusicPortDownloadVtbl *lpDownloadVtbl; IDirectMusicPortDownload IDirectMusicPortDownload_iface;
const IDirectMusicThruVtbl *lpThruVtbl; IDirectMusicThru IDirectMusicThru_iface;
LONG ref; LONG ref;
/* IDirectMusicPortImpl fields */ /* IDirectMusicPort fields */
IDirectSound* pDirectSound; IDirectSound* pDirectSound;
IReferenceClock* pLatencyClock; IReferenceClock* pLatencyClock;
BOOL fActive; IDirectMusicSynth* synth;
DMUS_PORTCAPS caps; IDirectMusicSynthSink* synth_sink;
DMUS_PORTPARAMS params; BOOL fActive;
int nrofgroups; DMUS_PORTCAPS caps;
DMUSIC_PRIVATE_CHANNEL_GROUP group[1]; DMUS_PORTPARAMS params;
int nrofgroups;
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
}; };
extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
/** Internal factory */ /** Internal factory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps); extern HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IReferenceClockImpl implementation structure * IReferenceClockImpl implementation structure
*/ */
struct IReferenceClockImpl { struct IReferenceClockImpl {
/* IUnknown fields */ /* IUnknown fields */
const IReferenceClockVtbl *lpVtbl; IReferenceClock IReferenceClock_iface;
LONG ref; LONG ref;
/* IReferenceClockImpl fields */ /* IReferenceClockImpl fields */
REFERENCE_TIME rtTime; REFERENCE_TIME rtTime;
DMUS_CLOCKINFO pClockInfo; DMUS_CLOCKINFO pClockInfo;
}; };
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY { typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
@ -185,51 +216,59 @@ typedef struct _DMUS_PRIVATE_POOLCUE {
* IDirectMusicCollectionImpl implementation structure * IDirectMusicCollectionImpl implementation structure
*/ */
struct IDirectMusicCollectionImpl { struct IDirectMusicCollectionImpl {
/* IUnknown fields */ /* IUnknown fields */
const IUnknownVtbl *UnknownVtbl; IDirectMusicCollection IDirectMusicCollection_iface;
const IDirectMusicCollectionVtbl *CollectionVtbl; IDirectMusicObject IDirectMusicObject_iface;
const IDirectMusicObjectVtbl *ObjectVtbl; IPersistStream IPersistStream_iface;
const IPersistStreamVtbl *PersistStreamVtbl; LONG ref;
LONG ref;
/* IDirectMusicCollectionImpl fields */ /* IDirectMusicCollectionImpl fields */
IStream *pStm; /* stream from which we load collection and later instruments */ 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 liCollectionPosition; /* offset in a stream where collection was loaded from */
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
LPDMUS_OBJECTDESC pDesc; LPDMUS_OBJECTDESC pDesc;
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */ CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
LPDLSHEADER pHeader; LPDLSHEADER pHeader;
/* pool table */ /* pool table */
LPPOOLTABLE pPoolTable; LPPOOLTABLE pPoolTable;
LPPOOLCUE pPoolCues; LPPOOLCUE pPoolCues;
/* instruments */ /* instruments */
struct list Instruments; struct list Instruments;
}; };
/***************************************************************************** /*****************************************************************************
* IDirectMusicInstrumentImpl implementation structure * IDirectMusicInstrumentImpl implementation structure
*/ */
struct IDirectMusicInstrumentImpl { struct IDirectMusicInstrumentImpl {
/* IUnknown fields */ /* IUnknown fields */
const IUnknownVtbl *UnknownVtbl; IDirectMusicInstrument IDirectMusicInstrument_iface;
const IDirectMusicInstrumentVtbl *InstrumentVtbl; LONG ref;
LONG ref;
/* IDirectMusicInstrumentImpl fields */ /* IDirectMusicInstrumentImpl fields */
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */ LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
LPGUID pInstrumentID; ULONG length; /* Length of the instrument in the stream */
LPINSTHEADER pHeader; GUID id;
WCHAR wszName[DMUS_MAX_NAME]; INSTHEADER header;
/* instrument data */ WCHAR wszName[DMUS_MAX_NAME];
/* instrument data */
BOOL loaded;
instrument_region *regions;
ULONG nb_articulations;
instrument_articulation *articulations;
}; };
static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
}
/* custom :) */ /* custom :) */
extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm); extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
/********************************************************************** /**********************************************************************
* Dll lifetime tracking declaration for dmusic.dll * Dll lifetime tracking declaration for dmusic.dll
*/ */
extern LONG DMUSIC_refCount; extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); } static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); } static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
@ -269,17 +308,19 @@ typedef struct {
#define GE(x) { &x, #x } #define GE(x) { &x, #x }
/* dwPatch from MIDILOCALE */ /* dwPatch from MIDILOCALE */
extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale); extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
/* MIDILOCALE from dwPatch */ /* MIDILOCALE from dwPatch */
extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale); extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
/* check whether the given DWORD is even (return 0) or odd (return 1) */ /* check whether the given DWORD is even (return 0) or odd (return 1) */
extern int even_or_odd (DWORD number); extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
/* FOURCC to string conversion for debug messages */ /* FOURCC to string conversion for debug messages */
extern const char *debugstr_fourcc (DWORD fourcc); extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
/* returns name of given GUID */ /* returns name of given GUID */
extern const char *debugstr_dmguid (const GUID *id); extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
/* dump whole DMUS_OBJECTDESC struct */ /* Dump whole DMUS_OBJECTDESC struct */
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc); extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
/* Dump whole DMUS_PORTPARAMS struct */
extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
#endif /* __WINE_DMUSIC_PRIVATE_H */ #endif /* __WINE_DMUSIC_PRIVATE_H */

View file

@ -1,4 +1,5 @@
/* IDirectMusicDownload Implementation /*
* IDirectMusicDownload Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* *
@ -21,72 +22,85 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
}
/* IDirectMusicDownloadImpl IUnknown part: */ /* IDirectMusicDownloadImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface; {
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID (riid, &IID_IUnknown) if (IsEqualIID(riid, &IID_IUnknown) ||
|| IsEqualIID (riid, &IID_IDirectMusicDownload)) { IsEqualIID(riid, &IID_IDirectMusicDownload))
IUnknown_AddRef(iface); {
*ppobj = This; IDirectMusicDownload_AddRef(iface);
return S_OK; *ret_iface = iface;
} return S_OK;
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); }
return E_NOINTERFACE;
*ret_iface = NULL;
WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
} }
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) { static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface; {
ULONG refCount = InterlockedIncrement(&This->ref); IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule(); DMUSIC_LockModule();
return refCount; return ref;
} }
static ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) { static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface; {
ULONG refCount = InterlockedDecrement(&This->ref); IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) { if (!ref)
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule(); DMUSIC_UnlockModule();
return refCount; return ref;
} }
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */ /* IDirectMusicDownloadImpl IDirectMusicDownload part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) { static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface; {
FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize); FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
return S_OK;
return S_OK;
} }
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = { static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
IDirectMusicDownloadImpl_QueryInterface, IDirectMusicDownloadImpl_QueryInterface,
IDirectMusicDownloadImpl_AddRef, IDirectMusicDownloadImpl_AddRef,
IDirectMusicDownloadImpl_Release, IDirectMusicDownloadImpl_Release,
IDirectMusicDownloadImpl_GetBuffer IDirectMusicDownloadImpl_GetBuffer
}; };
/* for ClassFactory */ /* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
IDirectMusicDownloadImpl* dmdl; {
IDirectMusicDownloadImpl *download;
dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
if (NULL == dmdl) { download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
*ppobj = NULL; if (!download)
return E_OUTOFMEMORY; {
} *ret_iface = NULL;
dmdl->lpVtbl = &DirectMusicDownload_Vtbl; return E_OUTOFMEMORY;
dmdl->ref = 0; /* will be inited by QueryInterface */ }
return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj); download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
download->ref = 1;
*ret_iface = download;
return S_OK;
} }

View file

@ -1,88 +0,0 @@
/* 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

@ -1,4 +1,5 @@
/* IDirectMusicInstrument Implementation /*
* IDirectMusicInstrument Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* *
@ -20,113 +21,109 @@
#include "dmusic_private.h" #include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); 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 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: */ /* IDirectMusicInstrument IUnknown part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ret_iface)
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface); {
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID (riid, &IID_IUnknown)) { if (IsEqualIID(riid, &IID_IUnknown) ||
*ppobj = &This->UnknownVtbl; IsEqualIID(riid, &IID_IDirectMusicInstrument))
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); {
return S_OK; *ret_iface = iface;
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrument)) { IDirectMusicInstrument_AddRef(iface);
*ppobj = &This->InstrumentVtbl; return S_OK;
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef ((LPDIRECTMUSICINSTRUMENT)&This->InstrumentVtbl); }
return S_OK; else if (IsEqualIID(riid, &IID_IDirectMusicInstrumentPRIVATE))
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrumentPRIVATE)) { {
/* it seems to me that this interface is only basic IUnknown, without any /* 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 * 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 * that whoever calls it knows the layout of original implementation table and therefore
tries to get data by direct access... expect crashes */ * tries to get data by direct access... expect crashes
FIXME("*sigh*... requested private/unspecified interface\n"); */
*ppobj = &This->UnknownVtbl; FIXME("*sigh*... requested private/unspecified interface\n");
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK; *ret_iface = iface;
} IDirectMusicInstrument_AddRef(iface);
return S_OK;
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); }
return E_NOINTERFACE;
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
} }
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) { static ULONG WINAPI IDirectMusicInstrumentImpl_AddRef(LPDIRECTMUSICINSTRUMENT iface)
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface); {
ULONG refCount = InterlockedIncrement(&This->ref); IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule(); DMUSIC_LockModule();
return refCount; return ref;
} }
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface) { static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT iface)
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface); {
ULONG refCount = InterlockedDecrement(&This->ref); IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) { if (!ref)
HeapFree(GetProcessHeap(), 0, This); {
} ULONG i;
DMUSIC_UnlockModule(); HeapFree(GetProcessHeap(), 0, This->regions);
for (i = 0; i < This->nb_articulations; i++)
return refCount; HeapFree(GetProcessHeap(), 0, This->articulations->connections);
HeapFree(GetProcessHeap(), 0, This->articulations);
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return ref;
} }
static const IUnknownVtbl DirectMusicInstrument_Unknown_Vtbl = {
IDirectMusicInstrumentImpl_IUnknown_QueryInterface,
IDirectMusicInstrumentImpl_IUnknown_AddRef,
IDirectMusicInstrumentImpl_IUnknown_Release
};
/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */ /* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface (LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch)
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface); {
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%p)\n", This, pdwPatch);
*pdwPatch = MIDILOCALE2Patch(&This->header.Locale);
return S_OK;
} }
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface) { static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch)
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface); {
return IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%d): stub\n", This, dwPatch);
Patch2MIDILOCALE(dwPatch, &This->header.Locale);
return S_OK;
} }
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release (LPDIRECTMUSICINSTRUMENT iface) { static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl =
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface); {
return IDirectMusicInstrumentImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); IDirectMusicInstrumentImpl_QueryInterface,
} IDirectMusicInstrumentImpl_AddRef,
IDirectMusicInstrumentImpl_Release,
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) { IDirectMusicInstrumentImpl_GetPatch,
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface); IDirectMusicInstrumentImpl_SetPatch
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 */ /* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicInstrumentImpl* dminst; IDirectMusicInstrumentImpl* dminst;
dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl)); dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl));
@ -134,296 +131,311 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID*
*ppobj = NULL; *ppobj = NULL;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
dminst->UnknownVtbl = &DirectMusicInstrument_Unknown_Vtbl; dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl;
dminst->InstrumentVtbl = &DirectMusicInstrument_Instrument_Vtbl;
dminst->ref = 0; /* will be inited by QueryInterface */ dminst->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&dminst->UnknownVtbl, lpcGUID, ppobj); return IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, ppobj);
} }
/* aux. function that completely loads instrument; my tests indicate that it's static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
called somewhere around IDirectMusicCollection_GetInstrument */ {
HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm) { ULONG bytes_read;
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface); HRESULT hr;
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 */ hr = IStream_Read(stream, data, size, &bytes_read);
IStream_Seek (pStm, This->liInstrumentPosition, STREAM_SEEK_SET, NULL); if(FAILED(hr)){
TRACE("IStream_Read failed: %08x\n", hr);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); return hr;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); }
switch (Chunk.fccID) { if (bytes_read < size) {
case FOURCC_LIST: { TRACE("Didn't read full chunk: %u < %u\n", bytes_read, size);
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); return E_FAIL;
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; return S_OK;
}
static inline DWORD subtract_bytes(DWORD len, DWORD bytes)
{
if(bytes > len){
TRACE("Apparent mismatch in chunk lengths? %u bytes remaining, %u bytes read\n", len, bytes);
return 0;
}
return len - bytes;
}
static inline HRESULT advance_stream(IStream *stream, ULONG bytes)
{
LARGE_INTEGER move;
HRESULT ret;
move.QuadPart = bytes;
ret = IStream_Seek(stream, move, STREAM_SEEK_CUR, NULL);
if (FAILED(ret))
WARN("IStream_Seek failed: %08x\n", ret);
return ret;
}
static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, instrument_region *region, ULONG length)
{
HRESULT ret;
DMUS_PRIVATE_CHUNK chunk;
TRACE("(%p, %p, %p, %u)\n", This, stream, region, length);
while (length)
{
ret = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(chunk));
switch (chunk.fccID)
{
case FOURCC_RGNH:
TRACE("RGNH chunk (region header): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->header, sizeof(region->header));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->header));
break;
case FOURCC_WSMP:
TRACE("WSMP chunk (wave sample): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->wave_sample, sizeof(region->wave_sample));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_sample));
if (!(region->loop_present = (chunk.dwSize != sizeof(region->wave_sample))))
break;
ret = read_from_stream(stream, &region->wave_loop, sizeof(region->wave_loop));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_loop));
break;
case FOURCC_WLNK:
TRACE("WLNK chunk (wave link): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->wave_link, sizeof(region->wave_link));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_link));
break;
default:
TRACE("Unknown chunk %s (skipping): %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
ret = advance_stream(stream, chunk.dwSize);
if (FAILED(ret))
return ret;
length = subtract_bytes(length, chunk.dwSize);
break;
}
}
return S_OK;
}
static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stream, ULONG length)
{
HRESULT ret;
instrument_articulation *articulation;
if (!This->articulations)
This->articulations = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->articulations));
else
This->articulations = HeapReAlloc(GetProcessHeap(), 0, This->articulations, sizeof(*This->articulations) * (This->nb_articulations + 1));
if (!This->articulations)
return E_OUTOFMEMORY;
articulation = &This->articulations[This->nb_articulations];
ret = read_from_stream(stream, &articulation->connections_list, sizeof(CONNECTIONLIST));
if (FAILED(ret))
return ret;
articulation->connections = HeapAlloc(GetProcessHeap(), 0, sizeof(CONNECTION) * articulation->connections_list.cConnections);
if (!articulation->connections)
return E_OUTOFMEMORY;
ret = read_from_stream(stream, articulation->connections, sizeof(CONNECTION) * articulation->connections_list.cConnections);
if (FAILED(ret))
{
HeapFree(GetProcessHeap(), 0, articulation->connections);
return ret;
}
subtract_bytes(length, sizeof(CONNECTIONLIST) + sizeof(CONNECTION) * articulation->connections_list.cConnections);
This->nb_articulations++;
return S_OK;
}
/* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */
HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
HRESULT hr;
DMUS_PRIVATE_CHUNK chunk;
ULONG i = 0;
ULONG length = This->length;
TRACE("(%p, %p): offset = 0x%s, length = %u)\n", This, stream, wine_dbgstr_longlong(This->liInstrumentPosition.QuadPart), This->length);
if (This->loaded)
return S_OK;
hr = IStream_Seek(stream, This->liInstrumentPosition, STREAM_SEEK_SET, NULL);
if (FAILED(hr))
{
WARN("IStream_Seek failed: %08x\n", hr);
return DMUS_E_UNSUPPORTED_STREAM;
}
This->regions = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->regions) * This->header.cRegions);
if (!This->regions)
return E_OUTOFMEMORY;
while (length)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
length = subtract_bytes(length, sizeof(chunk) + chunk.dwSize);
switch (chunk.fccID)
{
case FOURCC_INSH:
case FOURCC_DLID:
TRACE("Chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
/* Instrument header and id are already set so just skip */
hr = advance_stream(stream, chunk.dwSize);
if (FAILED(hr))
goto error;
break;
case FOURCC_LIST: {
DWORD size = chunk.dwSize;
TRACE("LIST chunk: %u bytes\n", chunk.dwSize);
hr = read_from_stream(stream, &chunk.fccID, sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
size = subtract_bytes(size, sizeof(chunk.fccID));
switch (chunk.fccID)
{
case FOURCC_LRGN:
TRACE("LRGN chunk (regions list): %u bytes\n", size);
while (size)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
if (chunk.fccID != FOURCC_LIST)
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
goto error;
}
hr = read_from_stream(stream, &chunk.fccID, sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
if (chunk.fccID == FOURCC_RGN)
{
TRACE("RGN chunk (region): %u bytes\n", chunk.dwSize);
hr = load_region(This, stream, &This->regions[i++], chunk.dwSize - sizeof(chunk.fccID));
}
else
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize - sizeof(chunk.fccID));
}
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize + sizeof(chunk));
}
break;
case FOURCC_LART:
TRACE("LART chunk (articulations list): %u bytes\n", size);
while (size)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
if (chunk.fccID == FOURCC_ART1)
{
TRACE("ART1 chunk (level 1 articulation): %u bytes\n", chunk.dwSize);
hr = load_articulation(This, stream, chunk.dwSize);
}
else
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize);
}
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize + sizeof(chunk));
}
break;
default:
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize - sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize - sizeof(chunk.fccID));
break;
}
break;
}
default:
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize);
if (FAILED(hr))
goto error;
break;
}
}
This->loaded = TRUE;
return S_OK;
error:
HeapFree(GetProcessHeap(), 0, This->regions);
This->regions = NULL;
return DMUS_E_UNSUPPORTED_STREAM;
} }

File diff suppressed because it is too large Load diff

View file

@ -16,12 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define WINE_OLESELFREGISTER 1 WINE_REGISTRY dmusic.rgs
#define WINE_FILEDESCRIPTION_STR "Wine DirectMusic" #define WINE_FILEDESCRIPTION_STR "Wine DirectMusic"
#define WINE_FILENAME_STR "dmusic.dll" #define WINE_FILENAME_STR "dmusic.dll"
#define WINE_FILEVERSION 5,3,1,904 #define WINE_FILEVERSION 5,3,1,904
#define WINE_FILEVERSION_STR "5.3.1.904" #define WINE_FILEVERSION_STR "5.3.1.904"
#define WINE_PRODUCTVERSION 5,3,1,904 #define WINE_PRODUCTVERSION 5,3,1,904
#define WINE_PRODUCTVERSION_STR "5.3.1.904" #define WINE_PRODUCTVERSION_STR "5.3.1.904"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc" #include <wine/wine_common_ver.rc>

View file

@ -380,7 +380,7 @@ DECLARE_INTERFACE_(IDirectMusic,IUnknown)
STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusic methods ***/ /*** IDirectMusic methods ***/
STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE; STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER **ppBuffer, LPUNKNOWN pUnkOuter) PURE; STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER *ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE; STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE; STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE; STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;
@ -421,7 +421,7 @@ DECLARE_INTERFACE_(IDirectMusic8,IDirectMusic)
STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusic methods ***/ /*** IDirectMusic methods ***/
STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE; STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER **ppBuffer, LPUNKNOWN pUnkOuter) PURE; STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER *ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE; STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE; STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE; STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;

View file

@ -1,157 +1,237 @@
/*
* DirectMusic Software Synth Definitions
*
* 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 _DMUSICS_ #ifndef __WINE_DMUSIC_SOFTWARESYNTH_H
#define _DMUSICS_ #define __WINE_DMUSIC_SOFTWARESYNTH_H
#include "dmusicc.h" #include <dmusicc.h>
#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths" /*****************************************************************************
* Registry path
*/
#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
interface IDirectMusicSynth;
interface IDirectMusicSynthSink;
/*****************************************************************************
* Predeclare the interfaces
*/
/* IIDs */
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);
/* typedef definitions */
typedef struct IDirectMusicSynth *LPDIRECTMUSICSYNTH;
typedef struct IDirectMusicSynth8 *LPDIRECTMUSICSYNTH8;
typedef struct IDirectMusicSynthSink *LPDIRECTMUSICSYNTHSINK;
/* GUIDs - property set */
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);
/*****************************************************************************
* Flags
*/
#define REFRESH_F_LASTBUFFER 0x1
/*****************************************************************************
* Structures
*/
#ifndef _DMUS_VOICE_STATE_DEFINED #ifndef _DMUS_VOICE_STATE_DEFINED
#define _DMUS_VOICE_STATE_DEFINED #define _DMUS_VOICE_STATE_DEFINED
/* typedef definition */
typedef struct _DMUS_VOICE_STATE DMUS_VOICE_STATE, *LPDMUS_VOICE_STATE;
DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661, 0x5C85, 0x11D2, 0xAF, 0xA6, 0x00, 0xAA, 0x00, 0x24, 0xD8, 0xB6); /* actual structure */
DEFINE_GUID(IID_IDirectMusicSynth8, 0x53CAB625, 0x2711, 0x4C9F, 0x9D, 0xE7, 0x1B, 0x7F, 0x92, 0x5F, 0x6F, 0xC8); struct _DMUS_VOICE_STATE {
DEFINE_GUID(IID_IDirectMusicSynthSink, 0x09823663, 0x5C85, 0x11D2, 0xAF, 0xA6, 0x00, 0xAA, 0x00, 0x24, 0xD8, 0xB6); BOOL bExists;
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink, 0x0A3A5BA5, 0x37B6, 0x11D2, 0xB9, 0xF9, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12); SAMPLE_POSITION spPosition;
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xBE208857, 0x8952, 0x11D2, 0xBA, 0x1C, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12); };
#endif /* _DMUS_VOICE_STATE_DEFINED */
#define REFRESH_F_LASTBUFFER 0x00000001
typedef struct _DMUS_VOICE_STATE /*****************************************************************************
* IDirectMusicSynth interface
*/
#define INTERFACE IDirectMusicSynth
DECLARE_INTERFACE_(IDirectMusicSynth,IUnknown)
{ {
BOOL bExists; /*** IUnknown methods ***/
SAMPLE_POSITION spPosition; STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
} DMUS_VOICE_STATE; STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
#endif /*** IDirectMusicSynth methods ***/
STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
#undef INTERFACE STDMETHOD(Close)(THIS) PURE;
#define INTERFACE IDirectMusicSynth STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown) STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
{ STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(Close) (THIS) PURE; STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE; STDMETHOD(SetSynthSink)(THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE; STDMETHOD(Render)(THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt,LPBYTE pbBuffer, DWORD cbBuffer) PURE; STDMETHOD(SetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; STDMETHOD(GetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; STDMETHOD(GetFormat)(THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink) (THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
}; };
#undef INTERFACE #undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE) #if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectMusicSynth_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) /*** IUnknown methods ***/
#define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirectMusicSynth_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p) #define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth_Open(p, a) (p)->lpVtbl->Open(p, a) #define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p) /*** IDirectMusicSynth methods ***/
#define IDirectMusicSynth_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a) #define IDirectMusicSynth_Open(p,a) (p)->lpVtbl->Open(p,a)
#define IDirectMusicSynth_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c) #define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c) #define IDirectMusicSynth_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
#define IDirectMusicSynth_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c) #define IDirectMusicSynth_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
#define IDirectMusicSynth_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a) #define IDirectMusicSynth_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
#define IDirectMusicSynth_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a) #define IDirectMusicSynth_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
#define IDirectMusicSynth_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a) #define IDirectMusicSynth_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
#define IDirectMusicSynth_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a) #define IDirectMusicSynth_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
#define IDirectMusicSynth_Activate(p, a) (p)->lpVtbl->Activate((p, a) #define IDirectMusicSynth_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynth_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a) #define IDirectMusicSynth_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynth_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c) #define IDirectMusicSynth_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynth_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c) #define IDirectMusicSynth_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
#define IDirectMusicSynth_GetChannelPriority(p, a, b, c) (p)->lpVtbl->GetChannelPriority(p, a, b, c) #define IDirectMusicSynth_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
#define IDirectMusicSynth_GetFormat(p, a, b) (p)->lpVtbl->GetFormat(p, a, b) #define IDirectMusicSynth_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
#define IDirectMusicSynth_GetAppend(p, a) (p)->lpVtbl->GetAppend(p, a) #define IDirectMusicSynth_GetChannelPriority(p,a,b,c) (p)->lpVtbl->GetChannelPriority(p,a,b,c)
#define IDirectMusicSynth_GetFormat(p,a,b) (p)->lpVtbl->GetFormat(p,a,b)
#define IDirectMusicSynth_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a)
#endif #endif
#define INTERFACE IDirectMusicSynth8
DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth) /*****************************************************************************
* IDirectMusicSynth8 interface
*/
#define INTERFACE IDirectMusicSynth8
DECLARE_INTERFACE_(IDirectMusicSynth8,IDirectMusicSynth)
{ {
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; /*** IUnknown methods ***/
STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
STDMETHOD(Close) (THIS) PURE; /*** IDirectMusicSynth methods ***/
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE; STDMETHOD(Close)(THIS) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE; STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE; STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(SetSynthSink) (THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE; STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE; STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE; STDMETHOD(SetSynthSink)(THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE; STDMETHOD(Render)(THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize) PURE; STDMETHOD(SetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; STDMETHOD(GetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(PlayVoice) (THIS_ REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd) PURE; STDMETHOD(GetFormat)(THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz) PURE;
STDMETHOD(StopVoice) (THIS_ REFERENCE_TIME rt, DWORD dwVoiceId ) PURE; STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
STDMETHOD(GetVoiceState) (THIS_ DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[] ) PURE; /*** IDirectMusicSynth8 methods ***/
STDMETHOD(Refresh) (THIS_ DWORD dwDownloadID, DWORD dwFlags) PURE; STDMETHOD(PlayVoice)(THIS_ REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, LONG prPitch, LONG vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd) PURE;
STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses) PURE; STDMETHOD(StopVoice)(THIS_ REFERENCE_TIME rt, DWORD dwVoiceId) PURE;
STDMETHOD(GetVoiceState)(THIS_ DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[]) PURE;
STDMETHOD(Refresh)(THIS_ DWORD dwDownloadID, DWORD dwFlags) PURE;
STDMETHOD(AssignChannelToBuses)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses) PURE;
}; };
#undef INTERFACE #undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE) #if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectMusicSynth8_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) /*** IUnknown methods ***/
#define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirectMusicSynth8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p) #define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth8_Open(p, a) (p)->lpVtbl->Open(p, a) #define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p) /*** IDirectMusicSynth methods ***/
#define IDirectMusicSynth8_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a) #define IDirectMusicSynth8_Open(p,a) (p)->lpVtbl->Open(p,a)
#define IDirectMusicSynth8_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c) #define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth8_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c) #define IDirectMusicSynth8_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
#define IDirectMusicSynth8_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c) #define IDirectMusicSynth8_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
#define IDirectMusicSynth8_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a) #define IDirectMusicSynth8_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
#define IDirectMusicSynth8_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a) #define IDirectMusicSynth8_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
#define IDirectMusicSynth8_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a) #define IDirectMusicSynth8_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
#define IDirectMusicSynth8_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a) #define IDirectMusicSynth8_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
#define IDirectMusicSynth8_Activate(p, a) (p)->lpVtbl->Activate((p, a) #define IDirectMusicSynth8_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynth8_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a) #define IDirectMusicSynth8_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynth8_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c) #define IDirectMusicSynth8_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynth8_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c) #define IDirectMusicSynth8_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
#define IDirectMusicSynth8_GetChannelPriority(p, a, b, c) (p)->lpVtbl->GetChannelPriority(p, a, b, c) #define IDirectMusicSynth8_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
#define IDirectMusicSynth8_GetFormat(p, a, b) (p)->lpVtbl->GetFormat(p, a, b) #define IDirectMusicSynth8_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
#define IDirectMusicSynth8_GetAppend(p, a) (p)->lpVtbl->GetAppend(p, a) #define IDirectMusicSynth8_GetChannelPriority(p,a,b,c) (p)->lpVtbl->GetChannelPriority(p,a,b,c)
#define IDirectMusicSynth8_PlayVoice(p, a, b, c, d, e, f, g, h, i, j) (p)->lpVtbl->PlayVoice(p, a, b, c, d, e, f, g, h, i, j) #define IDirectMusicSynth8_GetFormat(p,a,b) (p)->lpVtbl->GetFormat(p,a,b)
#define IDirectMusicSynth8_StopVoice(p, a, b) (p)->lpVtbl->StopVoice(p, a, b) #define IDirectMusicSynth8_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a)
#define IDirectMusicSynth8_GetVoiceState(p, a, b, c) (p)->lpVtbl->GetVoiceState(p, a, b, c) /*** IDirectMusicSynth8 methods ***/
#define IDirectMusicSynth8_Refresh(p, a, b) (p)->lpVtbl->Refresh(p, a, b) #define IDirectMusicSynth8_PlayVoice(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->PlayVoice(p,a,b,c,d,e,f,g,h,i,j)
#define IDirectMusicSynth8_AssignChannelToBuses(p, a, b, c, d) (p)->lpVtbl->AssignChannelToBuses(p, a, b, c, d) #define IDirectMusicSynth8_StopVoice(p,a,b) (p)->lpVtbl->StopVoice(p,a,b)
#define IDirectMusicSynth8_GetVoiceState(p,a,b,c) (p)->lpVtbl->GetVoiceState(p,a,b,c)
#define IDirectMusicSynth8_Refresh(p,a,b) (p)->lpVtbl->Refresh(p,a,b)
#define IDirectMusicSynth8_AssignChannelToBuses(p,a,b,c,d) (p)->lpVtbl->AssignChannelToBuses(p,a,b,c,d)
#endif #endif
#define INTERFACE IDirectMusicSynthSink
DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown) /*****************************************************************************
* IDirectMusicSynthSink interface
*/
#define INTERFACE IDirectMusicSynthSink
DECLARE_INTERFACE_(IDirectMusicSynthSink,IUnknown)
{ {
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; /*** IUnknown methods ***/
STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; /*** IDirectMusicSynthSink methods ***/
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; STDMETHOD(Init)(THIS_ IDirectMusicSynth *pSynth) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) PURE; STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, LONGLONG *pllSampleTime) PURE; STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE; STDMETHOD(SampleToRefTime)(THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) PURE;
STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE; STDMETHOD(RefTimeToSample)(THIS_ REFERENCE_TIME rfTime, LONGLONG *pllSampleTime) PURE;
STDMETHOD(SetDirectSound)(THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
STDMETHOD(GetDesiredBufferSize)(THIS_ LPDWORD pdwBufferSizeInSamples) PURE;
}; };
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectMusicSynthSink_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynthSink_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynthSink_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectMusicSynth methods ***/
#define IDirectMusicSynthSink_Init(p,a) (p)->lpVtbl->Init(p,a)
#define IDirectMusicSynthSink_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynthSink_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynthSink_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynthSink_SampleToRefTime(p,a,b) (p)->lpVtbl->SampleToRefTime(p,a,b)
#define IDirectMusicSynthSink_RefTimeToSample(p,a,b) (p)->lpVtbl->RefTimeToSample(p,a,b)
#define IDirectMusicSynthSink_SetDirectSound(p,a,b) (p)->lpVtbl->SetDirectSound(p,a,b)
#define IDirectMusicSynthSink_GetDesiredBufferSize(p,a) (p)->lpVtbl->GetDesiredBufferSize(p,a)
#endif #endif
#endif /* __WINE_DMUSIC_SOFTWARESYNTH_H */

View file

@ -1,58 +1,110 @@
/* /*
* dmksctrl.h * Definition of IKsControl
* *
* Contributors: * Copyright (C) 2012 Christian Costa
* Created by Johannes Anderwald
* *
* THIS SOFTWARE IS NOT COPYRIGHTED * 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 source code is offered for use in the public domain. You may * This library is distributed in the hope that it will be useful,
* use, modify or distribute it freely. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* This code is distributed in the hope that it will be useful but * Lesser General Public License for more details.
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* 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
*/ */
#ifndef _IKsControl_ #ifndef _DMKSCTRL_
#define _IKsControl_ #define _DMKSCTRL_
#include <pshpack8.h>
#include <objbase.h>
#ifndef _KS_
#define _KS_
typedef struct {
union {
struct {
GUID Set;
ULONG Id;
ULONG Flags;
} DUMMYSTRUCTNAME;
LONGLONG Alignment;
} DUMMYUNIONNAME;
} KSIDENTIFIER, *PKSIDENTIFIER;
typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY, KSMETHOD, *PKSMETHOD, KSEVENT, *PKSEVENT;
#define KSMETHOD_TYPE_NONE 0x00000000
#define KSMETHOD_TYPE_READ 0x00000001
#define KSMETHOD_TYPE_WRITE 0x00000002
#define KSMETHOD_TYPE_MODIFY 0x00000003
#define KSMETHOD_TYPE_SOURCE 0x00000004
#define KSMETHOD_TYPE_SEND 0x00000001
#define KSMETHOD_TYPE_SETSUPPORT 0x00000100
#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
#define KSPROPERTY_TYPE_GET 0x00000001
#define KSPROPERTY_TYPE_SET 0x00000002
#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
#define KSPROPERTY_TYPE_RELATIONS 0x00000400
#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
#define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000
#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
#undef INTERFACE
#define INTERFACE IKsControl #define INTERFACE IKsControl
DECLARE_INTERFACE_(IKsControl, IUnknown) DECLARE_INTERFACE_(IKsControl,IUnknown)
{ {
/* IUnknown */ /*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IKsControl methods ***/
/*IKsControl*/ STDMETHOD(KsProperty)(THIS_ PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
STDMETHOD(KsProperty)( ULONG DataLength, ULONG* BytesReturned) PURE;
THIS_ STDMETHOD(KsMethod)(THIS_ PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
IN PKSPROPERTY Property, ULONG DataLength, ULONG* BytesReturned) PURE;
IN ULONG PropertyLength, STDMETHOD(KsEvent)(THIS_ PKSEVENT Event, ULONG EventLength, LPVOID EventData,
IN OUT LPVOID PropertyData, ULONG DataLength, ULONG* BytesReturned) PURE;
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
STDMETHOD(KsMethod)(
THIS_
IN PKSMETHOD Method,
IN ULONG MethodLength,
IN OUT LPVOID MethodData,
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
STDMETHOD(KsEvent)(
THIS_
IN PKSEVENT Event OPTIONAL,
IN ULONG EventLength,
IN OUT LPVOID EventData,
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
}; };
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IKsControl_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IKsControl_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IKsControl_Release(p) (p)->lpVtbl->Release(p)
/*** IKsControl methods ***/
#define IKsControl_KsProperty(p,a,b,c,d,e) (p)->lpVtbl->KsProperty(p,a,b,c,d,e)
#define IKsControl_KsMethod(p,a,b,c,d,e) (p)->lpVtbl->KsMethod(p,a,b,c,d,e)
#define IKsControl_KsEvent(p,a,b,c,d,e) (p)->lpVtbl->KsEvent(p,a,b,c,d,e)
#endif
#endif /* _KS_ */
#include <poppack.h>
DEFINE_GUID(IID_IKsControl, 0x28f54685, 0x06fd, 0x11d2, 0xb2, 0x7a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
#ifndef _KSMEDIA_
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_MIDI, 0x1d262760, 0xe957, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00);
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1);
#endif #endif
#endif /* _DMKSCTRL_ */

View file

@ -30,7 +30,7 @@ The following libraries are shared with Wine.
reactos/dll/directx/amstream # Synced to Wine-1.3.37 reactos/dll/directx/amstream # Synced to Wine-1.3.37
reactos/dll/directx/dinput # Synced to Wine-20090208 reactos/dll/directx/dinput # Synced to Wine-20090208
reactos/dll/directx/dinput8 # Synced to Wine-20090208 reactos/dll/directx/dinput8 # Synced to Wine-20090208
reactos/dll/directx/dmusic # Synced to Wine-1_1_23 reactos/dll/directx/dmusic # Synced to Wine-1.5.26
reactos/dll/directx/dplay # Synced to Wine-1.5.26 reactos/dll/directx/dplay # Synced to Wine-1.5.26
reactos/dll/directx/dplayx # Synced to Wine-1.5.26 reactos/dll/directx/dplayx # Synced to Wine-1.5.26
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5 reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5