mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 18:54:25 +00:00
[DMUSIC]
* Sync with Wine 1.5.26. svn path=/trunk/; revision=58739
This commit is contained in:
parent
12eabcde28
commit
c2d5094a67
|
@ -1,44 +1,27 @@
|
|||
|
||||
|
||||
add_definitions(-D__WINESRC__)
|
||||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
add_definitions(-D__WINESRC__)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||
|
||||
spec2def(dmusic.dll dmusic.spec)
|
||||
|
||||
add_library(dmusic SHARED
|
||||
list(APPEND SOURCE
|
||||
buffer.c
|
||||
clock.c
|
||||
collection.c
|
||||
dmusic.c
|
||||
dmusic_main.c
|
||||
download.c
|
||||
downloadedinstrument.c
|
||||
instrument.c
|
||||
port.c
|
||||
regsvr.c
|
||||
version.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/dmusic.def)
|
||||
|
||||
add_library(dmusic SHARED ${SOURCE})
|
||||
set_module_type(dmusic win32dll UNICODE)
|
||||
|
||||
target_link_libraries(dmusic
|
||||
dxguid
|
||||
uuid
|
||||
wine)
|
||||
|
||||
add_importlibs(dmusic
|
||||
msvcrt
|
||||
user32
|
||||
advapi32
|
||||
ole32
|
||||
dsound
|
||||
kernel32
|
||||
ntdll)
|
||||
|
||||
target_link_libraries(dmusic dxguid uuid wine)
|
||||
add_importlibs(dmusic ole32 advapi32 winmm msvcrt kernel32 ntdll)
|
||||
add_dependencies(dmusic psdk)
|
||||
add_pch(dmusic dmusic_private.h)
|
||||
add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* IDirectMusicBuffer Implementation
|
||||
/*
|
||||
* IDirectMusicBuffer Implementation
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
* Copyright (C) 2012 Christian Costa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -18,126 +20,241 @@
|
|||
*/
|
||||
|
||||
#include "dmusic_private.h"
|
||||
//#include "initguid.h"
|
||||
#include "dmksctrl.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
static inline IDirectMusicBufferImpl *impl_from_IDirectMusicBuffer(IDirectMusicBuffer *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectMusicBufferImpl, IDirectMusicBuffer_iface);
|
||||
}
|
||||
|
||||
/* IDirectMusicBufferImpl IUnknown part: */
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ppobj) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
TRACE("(%p, (%s, %p)\n",This,debugstr_dmguid(riid),ppobj);
|
||||
if (IsEqualIID (riid, &IID_IUnknown)
|
||||
|| IsEqualIID (riid, &IID_IDirectMusicBuffer)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%p, (%s, %p): not found\n",This,debugstr_dmguid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface(LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ret_iface)
|
||||
{
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDirectMusicBuffer))
|
||||
{
|
||||
IDirectMusicBuffer_AddRef(iface);
|
||||
*ret_iface = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicBufferImpl_AddRef(LPDIRECTMUSICBUFFER iface)
|
||||
{
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface)
|
||||
{
|
||||
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) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This->data);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
DMUSIC_UnlockModule();
|
||||
DMUSIC_UnlockModule();
|
||||
|
||||
return refCount;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_Flush (LPDIRECTMUSICBUFFER iface) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p): stub\n", This);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_Flush(LPDIRECTMUSICBUFFER iface)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
This->write_pos = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, prtTime);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
FIXME("(%p, %p): stub\n", This, prtTime);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD dwChannelMessage) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, 0x%s, %d, %d): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, dwChannelMessage);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time, DWORD channel_group, DWORD channel_message)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr (LPDIRECTMUSICBUFFER iface) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p): stub\n", This);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr(LPDIRECTMUSICBUFFER iface)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
FIXME("(%p): stub\n", This);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr (LPDIRECTMUSICBUFFER iface, LPBYTE* ppData) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, ppData);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr(LPDIRECTMUSICBUFFER iface, LPBYTE* data)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, prt);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME ref_time)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, pcb);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes(LPDIRECTMUSICBUFFER iface, LPDWORD used_bytes)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, pcb);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes(LPDIRECTMUSICBUFFER iface, LPDWORD max_bytes)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, pGuidFormat);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat(LPDIRECTMUSICBUFFER iface, LPGUID format)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, 0x%s): stub\n", This, wine_dbgstr_longlong(rt));
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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) {
|
||||
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
|
||||
FIXME("(%p, %d): stub\n", This, cb);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes(LPDIRECTMUSICBUFFER iface, DWORD used_bytes)
|
||||
{
|
||||
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
|
||||
|
||||
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 = {
|
||||
|
@ -159,17 +276,40 @@ static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
|
|||
IDirectMusicBufferImpl_SetUsedBytes
|
||||
};
|
||||
|
||||
/* for ClassFactory */
|
||||
HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
IDirectMusicBufferImpl* dmbuff;
|
||||
HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface)
|
||||
{
|
||||
IDirectMusicBufferImpl* dmbuffer;
|
||||
HRESULT hr;
|
||||
|
||||
dmbuff = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
|
||||
if (NULL == dmbuff) {
|
||||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
dmbuff->lpVtbl = &DirectMusicBuffer_Vtbl;
|
||||
dmbuff->ref = 0; /* will be inited by QueryInterface */
|
||||
TRACE("(%p, %p)\n", desc, ret_iface);
|
||||
|
||||
return IDirectMusicBufferImpl_QueryInterface ((LPDIRECTMUSICBUFFER)dmbuff, lpcGUID, ppobj);
|
||||
*ret_iface = NULL;
|
||||
|
||||
dmbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
|
||||
if (!dmbuffer)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* IReferenceClock Implementation
|
||||
/*
|
||||
* IReferenceClock Implementation
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
*
|
||||
|
@ -21,9 +22,15 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
|
||||
}
|
||||
|
||||
/* IReferenceClockImpl IUnknown part: */
|
||||
static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
||||
|
||||
if (IsEqualIID (riid, &IID_IUnknown) ||
|
||||
|
@ -36,56 +43,70 @@ static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
|
||||
{
|
||||
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) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
|
||||
{
|
||||
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) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
if (!ref)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
DMUSIC_UnlockModule();
|
||||
DMUSIC_UnlockModule();
|
||||
|
||||
return refCount;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* IReferenceClockImpl IReferenceClock part: */
|
||||
static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
TRACE("(%p, %p)\n", This, pTime);
|
||||
*pTime = This->rtTime;
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
|
||||
{
|
||||
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pTime);
|
||||
|
||||
*pTime = This->rtTime;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie)
|
||||
{
|
||||
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
|
||||
|
||||
FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie)
|
||||
{
|
||||
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
|
||||
|
||||
FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie) {
|
||||
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
|
||||
FIXME("(%p, %d): stub\n", This, dwAdviseCookie);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
|
||||
{
|
||||
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IReferenceClockVtbl ReferenceClock_Vtbl = {
|
||||
|
@ -99,18 +120,22 @@ static const IReferenceClockVtbl ReferenceClock_Vtbl = {
|
|||
};
|
||||
|
||||
/* for ClassFactory */
|
||||
HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
IReferenceClockImpl* clock;
|
||||
HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
|
||||
{
|
||||
IReferenceClockImpl* clock;
|
||||
|
||||
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
|
||||
if (NULL == clock) {
|
||||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
clock->lpVtbl = &ReferenceClock_Vtbl;
|
||||
clock->ref = 0; /* will be inited by QueryInterface */
|
||||
clock->rtTime = 0;
|
||||
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
|
||||
TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter);
|
||||
|
||||
return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj);
|
||||
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
|
||||
if (!clock) {
|
||||
*ret_iface = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
|
||||
clock->ref = 0; /* Will be inited by QueryInterface */
|
||||
clock->rtTime = 0;
|
||||
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
|
||||
|
||||
return IReferenceClockImpl_QueryInterface((IReferenceClock*)clock, riid, ret_iface);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
|||
/* IDirectMusic8 Implementation
|
||||
/*
|
||||
* IDirectMusic8 Implementation
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
* Copyright (C) 2012 Christian Costa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -16,245 +18,420 @@
|
|||
* 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 <stdio.h>
|
||||
|
||||
#include "dmusic_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
static inline IDirectMusic8Impl *impl_from_IDirectMusic8(IDirectMusic8 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectMusic8Impl, IDirectMusic8_iface);
|
||||
}
|
||||
|
||||
/* IDirectMusic8Impl IUnknown part: */
|
||||
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
||||
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface(LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ret_iface)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
if (IsEqualIID (riid, &IID_IUnknown) ||
|
||||
IsEqualIID (riid, &IID_IDirectMusic) ||
|
||||
IsEqualIID (riid, &IID_IDirectMusic2) ||
|
||||
IsEqualIID (riid, &IID_IDirectMusic8)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
}
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||
|
||||
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
||||
return E_NOINTERFACE;
|
||||
if (IsEqualIID (riid, &IID_IUnknown) ||
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusic8Impl_AddRef(LPDIRECTMUSIC8 iface)
|
||||
{
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
|
||||
{
|
||||
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) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
if (!ref) {
|
||||
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: */
|
||||
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
TRACE("(%p, %d, %p)\n", This, dwIndex, pPortCaps);
|
||||
if (NULL == pPortCaps) { return E_POINTER; }
|
||||
/* i guess the first port shown is always software synthesizer */
|
||||
if (dwIndex == 0)
|
||||
{
|
||||
IDirectMusicSynth8* synth;
|
||||
TRACE("enumerating 'Microsoft Software Synthesizer' port\n");
|
||||
CoCreateInstance (&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
|
||||
IDirectMusicSynth8_GetPortCaps (synth, pPortCaps);
|
||||
IDirectMusicSynth8_Release (synth);
|
||||
return S_OK;
|
||||
}
|
||||
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_PORTCAPS port_caps)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
/* it seems that the rest of devices are obtained thru dmusic32.EnumLegacyDevices...*sigh*...which is undocumented*/
|
||||
#if 0
|
||||
int numMIDI = midiOutGetNumDevs();
|
||||
int numWAVE = waveOutGetNumDevs();
|
||||
int i;
|
||||
/* then return digital sound ports */
|
||||
for (i = 1; i <= numWAVE; i++)
|
||||
{
|
||||
TRACE("enumerating 'digital sound' ports\n");
|
||||
if (i == dwIndex)
|
||||
{
|
||||
DirectSoundEnumerateA(register_waveport, pPortCaps);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
/* finally, list all *real* MIDI ports*/
|
||||
for (i = numWAVE + 1; i <= numWAVE + numMIDI; i++)
|
||||
{
|
||||
TRACE("enumerating 'real MIDI' ports\n");
|
||||
if (i == dwIndex)
|
||||
FIXME("Found MIDI port, but *real* MIDI ports not supported yet\n");
|
||||
}
|
||||
#endif
|
||||
return S_FALSE;
|
||||
TRACE("(%p, %d, %p)\n", This, index, port_caps);
|
||||
|
||||
if (!port_caps)
|
||||
return E_POINTER;
|
||||
|
||||
if (index >= This->nb_system_ports)
|
||||
return S_FALSE;
|
||||
|
||||
*port_caps = This->system_ports[index].caps;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER** ppBuffer, LPUNKNOWN pUnkOuter) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer(LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC buffer_desc, LPDIRECTMUSICBUFFER* buffer, LPUNKNOWN unkouter)
|
||||
{
|
||||
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)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
if (unkouter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (!pBufferDesc || !ppBuffer)
|
||||
return E_POINTER;
|
||||
if (!buffer_desc || !buffer)
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
int i/*, j*/;
|
||||
DMUS_PORTCAPS PortCaps;
|
||||
IDirectMusicPort* pNewPort = NULL;
|
||||
HRESULT hr = E_FAIL;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsid_port, LPDMUS_PORTPARAMS port_params, LPDIRECTMUSICPORT* port, LPUNKNOWN unkouter)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
int i;
|
||||
DMUS_PORTCAPS port_caps;
|
||||
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);
|
||||
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
|
||||
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
|
||||
TRACE("(%p)->(%s, %p, %p, %p)\n", This, debugstr_dmguid(rclsid_port), port_params, port, unkouter);
|
||||
|
||||
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) {
|
||||
if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) {
|
||||
hr = DMUSIC_CreateDirectMusicPortImpl(&IID_IDirectMusicPort, (LPVOID*) &pNewPort, (LPUNKNOWN) This, pPortParams, &PortCaps);
|
||||
if (FAILED(hr)) {
|
||||
*ppPort = NULL;
|
||||
return hr;
|
||||
}
|
||||
This->nrofports++;
|
||||
if (!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
|
||||
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
|
||||
This->ppPorts[This->nrofports - 1] = pNewPort;
|
||||
*ppPort = pNewPort;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
/* FIXME: place correct error here */
|
||||
return E_NOINTERFACE;
|
||||
if (!rclsid_port)
|
||||
return E_POINTER;
|
||||
if (!port_params)
|
||||
return E_INVALIDARG;
|
||||
if (!port)
|
||||
return E_POINTER;
|
||||
if (unkouter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (TRACE_ON(dmusic))
|
||||
dump_DMUS_PORTPARAMS(port_params);
|
||||
|
||||
ZeroMemory(&port_caps, sizeof(DMUS_PORTCAPS));
|
||||
port_caps.dwSize = sizeof(DMUS_PORTCAPS);
|
||||
|
||||
if (IsEqualGUID(request_port, &GUID_NULL)) {
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
FIXME("(%p, %d, %p): stub\n", This, dwIndex, lpClockInfo);
|
||||
return S_FALSE;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_CLOCKINFO clock_info)
|
||||
{
|
||||
TRACE("(%p)->(%d, %p)\n", iface, index, clock_info);
|
||||
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock(LPDIRECTMUSIC8 iface, LPGUID guid_clock, IReferenceClock** reference_clock)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
TRACE("(%p, %p, %p)\n", This, pguidClock, ppReferenceClock);
|
||||
if (pguidClock)
|
||||
*pguidClock = This->pMasterClock->pClockInfo.guidClock;
|
||||
if(ppReferenceClock)
|
||||
*ppReferenceClock = (IReferenceClock *)This->pMasterClock;
|
||||
TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock);
|
||||
|
||||
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) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidClock));
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock(LPDIRECTMUSIC8 iface, REFGUID rguidClock)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
FIXME("(%p)->(%s): stub\n", This, debugstr_dmguid(rguidClock));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_Activate (LPDIRECTMUSIC8 iface, BOOL fEnable) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
int i;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_Activate(LPDIRECTMUSIC8 iface, BOOL enable)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
int i;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("(%p, %d): stub\n", This, fEnable);
|
||||
for (i = 0; i < This->nrofports; i++) {
|
||||
IDirectMusicPortImpl_Activate(This->ppPorts[i], fEnable);
|
||||
}
|
||||
TRACE("(%p)->(%u)\n", This, enable);
|
||||
|
||||
return S_OK;
|
||||
for (i = 0; i < This->nrofports; i++)
|
||||
{
|
||||
hr = IDirectMusicPort_Activate(This->ppPorts[i], enable);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LPGUID pguidPort) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
HKEY hkGUID;
|
||||
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
||||
char returnBuffer[51];
|
||||
GUID defaultPortGUID;
|
||||
WCHAR buff[51];
|
||||
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort(LPDIRECTMUSIC8 iface, LPGUID guid_port)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
HKEY hkGUID;
|
||||
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
||||
char returnBuffer[51];
|
||||
GUID defaultPortGUID;
|
||||
WCHAR buff[51];
|
||||
|
||||
TRACE("(%p, %p)\n", This, pguidPort);
|
||||
if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) ||
|
||||
(RegQueryValueExA(hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, (LPBYTE)returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
|
||||
{
|
||||
WARN(": registry entry missing\n" );
|
||||
*pguidPort = CLSID_DirectMusicSynth;
|
||||
return S_OK;
|
||||
}
|
||||
/* FIXME: Check return types to ensure we're interpreting data right */
|
||||
MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
|
||||
CLSIDFromString(buff, &defaultPortGUID);
|
||||
*pguidPort = defaultPortGUID;
|
||||
TRACE("(%p)->(%p)\n", This, guid_port);
|
||||
|
||||
return S_OK;
|
||||
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" );
|
||||
*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));
|
||||
CLSIDFromString(buff, &defaultPortGUID);
|
||||
*guid_port = defaultPortGUID;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(LPDIRECTMUSIC8 iface, LPDIRECTSOUND dsound, HWND wnd)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
FIXME("(%p)->(%p, %p): stub\n", This, dsound, wnd);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) {
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
FIXME("(%p, %p): stub\n", This, pClock);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock(LPDIRECTMUSIC8 iface, IReferenceClock* clock)
|
||||
{
|
||||
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, clock);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IDirectMusic8Vtbl DirectMusic8_Vtbl = {
|
||||
IDirectMusic8Impl_QueryInterface,
|
||||
IDirectMusic8Impl_AddRef,
|
||||
IDirectMusic8Impl_Release,
|
||||
IDirectMusic8Impl_EnumPort,
|
||||
IDirectMusic8Impl_CreateMusicBuffer,
|
||||
IDirectMusic8Impl_CreatePort,
|
||||
IDirectMusic8Impl_EnumMasterClock,
|
||||
IDirectMusic8Impl_GetMasterClock,
|
||||
IDirectMusic8Impl_SetMasterClock,
|
||||
IDirectMusic8Impl_Activate,
|
||||
IDirectMusic8Impl_GetDefaultPort,
|
||||
IDirectMusic8Impl_SetDirectSound,
|
||||
IDirectMusic8Impl_SetExternalMasterClock
|
||||
IDirectMusic8Impl_QueryInterface,
|
||||
IDirectMusic8Impl_AddRef,
|
||||
IDirectMusic8Impl_Release,
|
||||
IDirectMusic8Impl_EnumPort,
|
||||
IDirectMusic8Impl_CreateMusicBuffer,
|
||||
IDirectMusic8Impl_CreatePort,
|
||||
IDirectMusic8Impl_EnumMasterClock,
|
||||
IDirectMusic8Impl_GetMasterClock,
|
||||
IDirectMusic8Impl_SetMasterClock,
|
||||
IDirectMusic8Impl_Activate,
|
||||
IDirectMusic8Impl_GetDefaultPort,
|
||||
IDirectMusic8Impl_SetDirectSound,
|
||||
IDirectMusic8Impl_SetExternalMasterClock
|
||||
};
|
||||
|
||||
/* for ClassFactory */
|
||||
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
IDirectMusic8Impl *dmusic;
|
||||
static void create_system_ports_list(IDirectMusic8Impl* object)
|
||||
{
|
||||
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));
|
||||
if (NULL == dmusic) {
|
||||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
dmusic->lpVtbl = &DirectMusic8_Vtbl;
|
||||
dmusic->ref = 0; /* will be inited with QueryInterface */
|
||||
dmusic->pMasterClock = NULL;
|
||||
dmusic->ppPorts = NULL;
|
||||
dmusic->nrofports = 0;
|
||||
DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
|
||||
/* NOTE:
|
||||
- it seems some native versions get the rest of devices through dmusic32.EnumLegacyDevices...*sigh*...which is undocumented
|
||||
- should we enum wave devices ? Native does not seem to
|
||||
*/
|
||||
|
||||
return IDirectMusic8Impl_QueryInterface ((LPDIRECTMUSIC8)dmusic, lpcGUID, ppobj);
|
||||
nb_midi_out = midiOutGetNumDevs();
|
||||
nb_midi_in = midiInGetNumDevs();
|
||||
nb_ports = 1 /* midi mapper */ + nb_midi_out + nb_midi_in + 1 /* synth port */;
|
||||
|
||||
port = object->system_ports = HeapAlloc(GetProcessHeap(), 0, nb_ports * sizeof(port_info));
|
||||
if (!object->system_ports)
|
||||
return;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
35
reactos/dll/directx/dmusic/dmusic.idl
Normal file
35
reactos/dll/directx/dmusic/dmusic.idl
Normal 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; }
|
39
reactos/dll/directx/dmusic/dmusic.rgs
Normal file
39
reactos/dll/directx/dmusic/dmusic.rgs
Normal 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'
|
||||
}
|
||||
}
|
|
@ -23,112 +23,93 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "dmusic_private.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
static HINSTANCE instance;
|
||||
LONG DMUSIC_refCount = 0;
|
||||
|
||||
typedef struct {
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
IClassFactory IClassFactory_iface;
|
||||
HRESULT (WINAPI *fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter);
|
||||
} IClassFactoryImpl;
|
||||
|
||||
/******************************************************************
|
||||
* DirectMusic ClassFactory
|
||||
* IClassFactory implementation
|
||||
*/
|
||||
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
||||
|
||||
if (ppobj == NULL) return E_POINTER;
|
||||
|
||||
return E_NOINTERFACE;
|
||||
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
|
||||
DMUSIC_LockModule();
|
||||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
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) {
|
||||
DMUSIC_UnlockModule();
|
||||
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
|
||||
{
|
||||
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) {
|
||||
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
||||
return DMUSIC_CreateDirectMusicImpl (riid, ppobj, pOuter);
|
||||
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
|
||||
{
|
||||
DMUSIC_UnlockModule();
|
||||
|
||||
return 1; /* non-heap based object */
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||
TRACE("(%d)\n", dolock);
|
||||
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||
|
||||
if (dolock)
|
||||
DMUSIC_LockModule();
|
||||
else
|
||||
DMUSIC_UnlockModule();
|
||||
TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv);
|
||||
|
||||
return S_OK;
|
||||
return This->fnCreateInstance(riid, ppv, pUnkOuter);
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl DirectMusicCF_Vtbl = {
|
||||
DirectMusicCF_QueryInterface,
|
||||
DirectMusicCF_AddRef,
|
||||
DirectMusicCF_Release,
|
||||
DirectMusicCF_CreateInstance,
|
||||
DirectMusicCF_LockServer
|
||||
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
|
||||
{
|
||||
TRACE("(%d)\n", dolock);
|
||||
|
||||
if (dolock)
|
||||
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};
|
||||
|
||||
/******************************************************************
|
||||
* 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};
|
||||
static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicImpl};
|
||||
static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl},
|
||||
DMUSIC_CreateDirectMusicCollectionImpl};
|
||||
|
||||
/******************************************************************
|
||||
* DllMain
|
||||
|
@ -137,6 +118,7 @@ static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
|
|||
*/
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||
instance = hinstDLL;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
/* FIXME: Initialisation */
|
||||
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
|
@ -180,6 +162,21 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||
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
|
||||
|
@ -187,7 +184,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||
*
|
||||
*/
|
||||
/* dwPatch from MIDILOCALE */
|
||||
DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale) {
|
||||
DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) {
|
||||
DWORD dwPatch = 0;
|
||||
if (!pLocale) return 0;
|
||||
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]));
|
||||
}
|
||||
|
||||
/* dump whole DMUS_OBJECTDESC struct */
|
||||
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
|
||||
if (pDesc) {
|
||||
char buffer[1024] = "", *ptr = &buffer[0];
|
||||
|
||||
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
|
||||
ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
|
||||
ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
|
||||
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
|
||||
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
|
||||
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
|
||||
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
|
||||
|
||||
return wine_dbg_sprintf("%s", buffer);
|
||||
} else {
|
||||
return wine_dbg_sprintf("(NULL)");
|
||||
}
|
||||
/* Dump whole DMUS_OBJECTDESC struct */
|
||||
void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
|
||||
{
|
||||
TRACE("DMUS_OBJECTDESC (%p):\n", desc);
|
||||
TRACE(" - dwSize = %d\n", desc->dwSize);
|
||||
TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData));
|
||||
if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
|
||||
if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
|
||||
if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
|
||||
if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion));
|
||||
if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName));
|
||||
if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
|
||||
if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
|
||||
if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
|
||||
wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
|
||||
if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream);
|
||||
}
|
||||
|
||||
/* Dump DMUS_PORTPARAMS flags */
|
||||
static const char* debugstr_DMUS_PORTPARAMS_FLAGS(DWORD flagmask)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* DirectMusic Private Include
|
||||
/*
|
||||
* DirectMusic Private Include
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
* Copyright (C) 2012 Christian Costa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -50,14 +52,12 @@ typedef struct IDirectMusic8Impl IDirectMusic8Impl;
|
|||
typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
|
||||
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
|
||||
typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
|
||||
typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
|
||||
typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
|
||||
typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
|
||||
typedef struct IReferenceClockImpl IReferenceClockImpl;
|
||||
|
||||
typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
|
||||
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
|
||||
|
||||
typedef struct SynthPortImpl SynthPortImpl;
|
||||
|
||||
/*****************************************************************************
|
||||
* 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_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
|
||||
*/
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
extern HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
|
||||
/* CLSID */
|
||||
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
|
||||
*/
|
||||
struct IDirectMusic8Impl {
|
||||
/* IUnknown fields */
|
||||
const IDirectMusic8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusic8 IDirectMusic8_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicImpl fields */
|
||||
IReferenceClockImpl* pMasterClock;
|
||||
IDirectMusicPort** ppPorts;
|
||||
int nrofports;
|
||||
/* IDirectMusicImpl fields */
|
||||
IReferenceClockImpl* pMasterClock;
|
||||
IDirectMusicPort** ppPorts;
|
||||
int nrofports;
|
||||
port_info* system_ports;
|
||||
int nb_system_ports;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicBufferImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicBufferImpl {
|
||||
/* IUnknown fields */
|
||||
const IDirectMusicBufferVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusicBuffer IDirectMusicBuffer_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicBufferImpl fields */
|
||||
/* IDirectMusicBufferImpl fields */
|
||||
GUID format;
|
||||
DWORD size;
|
||||
LPBYTE data;
|
||||
DWORD write_pos;
|
||||
REFERENCE_TIME start_time;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicDownloadedInstrumentImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicDownloadedInstrumentImpl {
|
||||
/* IUnknown fields */
|
||||
const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicDownloadedInstrumentImpl fields */
|
||||
/* IDirectMusicDownloadedInstrumentImpl fields */
|
||||
BOOL downloaded;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicDownloadImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicDownloadImpl {
|
||||
/* IUnknown fields */
|
||||
const IDirectMusicDownloadVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusicDownload IDirectMusicDownload_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicDownloadImpl fields */
|
||||
/* IDirectMusicDownloadImpl fields */
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicPortImpl implementation structure
|
||||
* SynthPortImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicPortImpl {
|
||||
/* IUnknown fields */
|
||||
const IDirectMusicPortVtbl *lpVtbl;
|
||||
const IDirectMusicPortDownloadVtbl *lpDownloadVtbl;
|
||||
const IDirectMusicThruVtbl *lpThruVtbl;
|
||||
LONG ref;
|
||||
struct SynthPortImpl {
|
||||
/* IUnknown fields */
|
||||
IDirectMusicPort IDirectMusicPort_iface;
|
||||
IDirectMusicPortDownload IDirectMusicPortDownload_iface;
|
||||
IDirectMusicThru IDirectMusicThru_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicPortImpl fields */
|
||||
IDirectSound* pDirectSound;
|
||||
IReferenceClock* pLatencyClock;
|
||||
BOOL fActive;
|
||||
DMUS_PORTCAPS caps;
|
||||
DMUS_PORTPARAMS params;
|
||||
int nrofgroups;
|
||||
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
|
||||
/* IDirectMusicPort fields */
|
||||
IDirectSound* pDirectSound;
|
||||
IReferenceClock* pLatencyClock;
|
||||
IDirectMusicSynth* synth;
|
||||
IDirectMusicSynthSink* synth_sink;
|
||||
BOOL fActive;
|
||||
DMUS_PORTCAPS caps;
|
||||
DMUS_PORTPARAMS params;
|
||||
int nrofgroups;
|
||||
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
|
||||
};
|
||||
|
||||
extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
|
||||
|
||||
/** Internal factory */
|
||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps);
|
||||
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
|
||||
*/
|
||||
struct IReferenceClockImpl {
|
||||
/* IUnknown fields */
|
||||
const IReferenceClockVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IReferenceClock IReferenceClock_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IReferenceClockImpl fields */
|
||||
REFERENCE_TIME rtTime;
|
||||
DMUS_CLOCKINFO pClockInfo;
|
||||
/* IReferenceClockImpl fields */
|
||||
REFERENCE_TIME rtTime;
|
||||
DMUS_CLOCKINFO pClockInfo;
|
||||
};
|
||||
|
||||
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
|
||||
|
@ -185,51 +216,59 @@ typedef struct _DMUS_PRIVATE_POOLCUE {
|
|||
* IDirectMusicCollectionImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicCollectionImpl {
|
||||
/* IUnknown fields */
|
||||
const IUnknownVtbl *UnknownVtbl;
|
||||
const IDirectMusicCollectionVtbl *CollectionVtbl;
|
||||
const IDirectMusicObjectVtbl *ObjectVtbl;
|
||||
const IPersistStreamVtbl *PersistStreamVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusicCollection IDirectMusicCollection_iface;
|
||||
IDirectMusicObject IDirectMusicObject_iface;
|
||||
IPersistStream IPersistStream_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicCollectionImpl fields */
|
||||
IStream *pStm; /* stream from which we load collection and later instruments */
|
||||
LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
|
||||
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
|
||||
LPDMUS_OBJECTDESC pDesc;
|
||||
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
|
||||
LPDLSHEADER pHeader;
|
||||
/* pool table */
|
||||
LPPOOLTABLE pPoolTable;
|
||||
LPPOOLCUE pPoolCues;
|
||||
/* instruments */
|
||||
struct list Instruments;
|
||||
/* IDirectMusicCollectionImpl fields */
|
||||
IStream *pStm; /* stream from which we load collection and later instruments */
|
||||
LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
|
||||
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
|
||||
LPDMUS_OBJECTDESC pDesc;
|
||||
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
|
||||
LPDLSHEADER pHeader;
|
||||
/* pool table */
|
||||
LPPOOLTABLE pPoolTable;
|
||||
LPPOOLCUE pPoolCues;
|
||||
/* instruments */
|
||||
struct list Instruments;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicInstrumentImpl implementation structure
|
||||
*/
|
||||
struct IDirectMusicInstrumentImpl {
|
||||
/* IUnknown fields */
|
||||
const IUnknownVtbl *UnknownVtbl;
|
||||
const IDirectMusicInstrumentVtbl *InstrumentVtbl;
|
||||
LONG ref;
|
||||
/* IUnknown fields */
|
||||
IDirectMusicInstrument IDirectMusicInstrument_iface;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectMusicInstrumentImpl fields */
|
||||
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
|
||||
LPGUID pInstrumentID;
|
||||
LPINSTHEADER pHeader;
|
||||
WCHAR wszName[DMUS_MAX_NAME];
|
||||
/* instrument data */
|
||||
/* IDirectMusicInstrumentImpl fields */
|
||||
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
|
||||
ULONG length; /* Length of the instrument in the stream */
|
||||
GUID id;
|
||||
INSTHEADER header;
|
||||
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 :) */
|
||||
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
|
||||
*/
|
||||
extern LONG DMUSIC_refCount;
|
||||
extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
|
||||
static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
|
||||
static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
|
||||
|
||||
|
@ -269,17 +308,19 @@ typedef struct {
|
|||
#define GE(x) { &x, #x }
|
||||
|
||||
/* dwPatch from MIDILOCALE */
|
||||
extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
|
||||
extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
|
||||
/* 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) */
|
||||
extern int even_or_odd (DWORD number);
|
||||
extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
|
||||
/* 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 */
|
||||
extern const char *debugstr_dmguid (const GUID *id);
|
||||
/* dump whole DMUS_OBJECTDESC struct */
|
||||
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
|
||||
extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
|
||||
/* Dump whole DMUS_OBJECTDESC struct */
|
||||
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 */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* IDirectMusicDownload Implementation
|
||||
/*
|
||||
* IDirectMusicDownload Implementation
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
*
|
||||
|
@ -21,72 +22,85 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
|
||||
}
|
||||
|
||||
/* IDirectMusicDownloadImpl IUnknown part: */
|
||||
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
|
||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
||||
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
|
||||
{
|
||||
TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||
|
||||
if (IsEqualIID (riid, &IID_IUnknown)
|
||||
|| IsEqualIID (riid, &IID_IDirectMusicDownload)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
||||
return E_NOINTERFACE;
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDirectMusicDownload))
|
||||
{
|
||||
IDirectMusicDownload_AddRef(iface);
|
||||
*ret_iface = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*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) {
|
||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
|
||||
{
|
||||
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) {
|
||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
|
||||
{
|
||||
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) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
if (!ref)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
DMUSIC_UnlockModule();
|
||||
DMUSIC_UnlockModule();
|
||||
|
||||
return refCount;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
|
||||
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) {
|
||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
||||
FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize);
|
||||
return S_OK;
|
||||
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
|
||||
{
|
||||
FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
|
||||
IDirectMusicDownloadImpl_QueryInterface,
|
||||
IDirectMusicDownloadImpl_AddRef,
|
||||
IDirectMusicDownloadImpl_Release,
|
||||
IDirectMusicDownloadImpl_GetBuffer
|
||||
IDirectMusicDownloadImpl_QueryInterface,
|
||||
IDirectMusicDownloadImpl_AddRef,
|
||||
IDirectMusicDownloadImpl_Release,
|
||||
IDirectMusicDownloadImpl_GetBuffer
|
||||
};
|
||||
|
||||
/* for ClassFactory */
|
||||
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
IDirectMusicDownloadImpl* dmdl;
|
||||
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
|
||||
{
|
||||
IDirectMusicDownloadImpl *download;
|
||||
|
||||
dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
|
||||
if (NULL == dmdl) {
|
||||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
dmdl->lpVtbl = &DirectMusicDownload_Vtbl;
|
||||
dmdl->ref = 0; /* will be inited by QueryInterface */
|
||||
download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
|
||||
if (!download)
|
||||
{
|
||||
*ret_iface = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj);
|
||||
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
|
||||
download->ref = 1;
|
||||
*ret_iface = download;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
/* IDirectMusicInstrument Implementation
|
||||
/*
|
||||
* IDirectMusicInstrument Implementation
|
||||
*
|
||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||
*
|
||||
|
@ -20,113 +21,109 @@
|
|||
#include "dmusic_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
||||
|
||||
static const GUID IID_IDirectMusicInstrumentPRIVATE = {0xbcb20080,0xa40c,0x11d1,{0x86,0xbc,0x00,0xc0,0x4f,0xbf,0x8f,0xef}};
|
||||
|
||||
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface);
|
||||
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface);
|
||||
static const GUID IID_IDirectMusicInstrumentPRIVATE = { 0xbcb20080, 0xa40c, 0x11d1, { 0x86, 0xbc, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef } };
|
||||
|
||||
/* IDirectMusicInstrument IUnknown part: */
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ret_iface)
|
||||
{
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||
|
||||
if (IsEqualIID (riid, &IID_IUnknown)) {
|
||||
*ppobj = &This->UnknownVtbl;
|
||||
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
||||
return S_OK;
|
||||
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrument)) {
|
||||
*ppobj = &This->InstrumentVtbl;
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef ((LPDIRECTMUSICINSTRUMENT)&This->InstrumentVtbl);
|
||||
return S_OK;
|
||||
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrumentPRIVATE)) {
|
||||
/* it seems to me that this interface is only basic IUnknown, without any
|
||||
other inherited functions... *sigh* this is the worst scenario, since it means
|
||||
that whoever calls it knows the layout of original implementation table and therefore
|
||||
tries to get data by direct access... expect crashes */
|
||||
FIXME("*sigh*... requested private/unspecified interface\n");
|
||||
*ppobj = &This->UnknownVtbl;
|
||||
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
||||
return S_OK;
|
||||
}
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDirectMusicInstrument))
|
||||
{
|
||||
*ret_iface = iface;
|
||||
IDirectMusicInstrument_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualIID(riid, &IID_IDirectMusicInstrumentPRIVATE))
|
||||
{
|
||||
/* it seems to me that this interface is only basic IUnknown, without any
|
||||
* other inherited functions... *sigh* this is the worst scenario, since it means
|
||||
* that whoever calls it knows the layout of original implementation table and therefore
|
||||
* tries to get data by direct access... expect crashes
|
||||
*/
|
||||
FIXME("*sigh*... requested private/unspecified interface\n");
|
||||
|
||||
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
||||
return E_NOINTERFACE;
|
||||
*ret_iface = iface;
|
||||
IDirectMusicInstrument_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicInstrumentImpl_AddRef(LPDIRECTMUSICINSTRUMENT iface)
|
||||
{
|
||||
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) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT iface)
|
||||
{
|
||||
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) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
if (!ref)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
DMUSIC_UnlockModule();
|
||||
HeapFree(GetProcessHeap(), 0, This->regions);
|
||||
for (i = 0; i < This->nb_articulations; i++)
|
||||
HeapFree(GetProcessHeap(), 0, This->articulations->connections);
|
||||
HeapFree(GetProcessHeap(), 0, This->articulations);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return refCount;
|
||||
DMUSIC_UnlockModule();
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static const IUnknownVtbl DirectMusicInstrument_Unknown_Vtbl = {
|
||||
IDirectMusicInstrumentImpl_IUnknown_QueryInterface,
|
||||
IDirectMusicInstrumentImpl_IUnknown_AddRef,
|
||||
IDirectMusicInstrumentImpl_IUnknown_Release
|
||||
};
|
||||
|
||||
/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface (LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch)
|
||||
{
|
||||
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) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
return IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch)
|
||||
{
|
||||
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) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
return IDirectMusicInstrumentImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
TRACE("(%p, %p)\n", This, pdwPatch);
|
||||
*pdwPatch = MIDILOCALE2Patch(&This->pHeader->Locale);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
TRACE("(%p, %d): stub\n", This, dwPatch);
|
||||
Patch2MIDILOCALE(dwPatch, &This->pHeader->Locale);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Instrument_Vtbl = {
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface,
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef,
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release,
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch,
|
||||
IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
|
||||
static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl =
|
||||
{
|
||||
IDirectMusicInstrumentImpl_QueryInterface,
|
||||
IDirectMusicInstrumentImpl_AddRef,
|
||||
IDirectMusicInstrumentImpl_Release,
|
||||
IDirectMusicInstrumentImpl_GetPatch,
|
||||
IDirectMusicInstrumentImpl_SetPatch
|
||||
};
|
||||
|
||||
/* for ClassFactory */
|
||||
HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
||||
IDirectMusicInstrumentImpl* dminst;
|
||||
|
||||
dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl));
|
||||
|
@ -134,296 +131,311 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID*
|
|||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
dminst->UnknownVtbl = &DirectMusicInstrument_Unknown_Vtbl;
|
||||
dminst->InstrumentVtbl = &DirectMusicInstrument_Instrument_Vtbl;
|
||||
dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl;
|
||||
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
|
||||
called somewhere around IDirectMusicCollection_GetInstrument */
|
||||
HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm) {
|
||||
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
|
||||
static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
|
||||
{
|
||||
ULONG bytes_read;
|
||||
HRESULT hr;
|
||||
|
||||
DMUS_PRIVATE_CHUNK Chunk;
|
||||
DWORD ListSize[4], ListCount[4];
|
||||
LARGE_INTEGER liMove; /* used when skipping chunks */
|
||||
hr = IStream_Read(stream, data, size, &bytes_read);
|
||||
if(FAILED(hr)){
|
||||
TRACE("IStream_Read failed: %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
if (bytes_read < size) {
|
||||
TRACE("Didn't read full chunk: %u < %u\n", bytes_read, size);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
TRACE("(%p, %p, offset = %s)\n", This, pStm, wine_dbgstr_longlong(This->liInstrumentPosition.QuadPart));
|
||||
|
||||
/* goto the beginning of chunk */
|
||||
IStream_Seek (pStm, This->liInstrumentPosition, STREAM_SEEK_SET, NULL);
|
||||
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_LIST: {
|
||||
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
|
||||
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
||||
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
|
||||
ListCount[0] = 0;
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_INS: {
|
||||
TRACE_(dmfile)(": instrument list\n");
|
||||
do {
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_INSH: {
|
||||
TRACE_(dmfile)(": instrument header chunk\n");
|
||||
/* should be already initialised */
|
||||
IStream_Read (pStm, This->pHeader, Chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
case FOURCC_DLID: {
|
||||
TRACE_(dmfile)(": DLID (GUID) chunk\n");
|
||||
/* should be already initialised */
|
||||
IStream_Read (pStm, This->pInstrumentID, Chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
case FOURCC_LIST: {
|
||||
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
|
||||
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
||||
ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
|
||||
ListCount[1] = 0;
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_LRGN: {
|
||||
TRACE_(dmfile)(": regions list\n");
|
||||
do {
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_LIST: {
|
||||
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
|
||||
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
||||
ListSize[2] = Chunk.dwSize - sizeof(FOURCC);
|
||||
ListCount[2] = 0;
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_RGN: {
|
||||
/* temporary structures */
|
||||
RGNHEADER tmpRegionHeader;
|
||||
WSMPL tmpWaveSample;
|
||||
WLOOP tmpWaveLoop;
|
||||
WAVELINK tmpWaveLink;
|
||||
|
||||
TRACE_(dmfile)(": region list\n");
|
||||
do {
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
ListCount[2] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_RGNH: {
|
||||
TRACE_(dmfile)(": region header chunk\n");
|
||||
memset (&tmpRegionHeader, 0, sizeof(RGNHEADER)); /* reset */
|
||||
IStream_Read (pStm, &tmpRegionHeader, Chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
case FOURCC_WSMP: {
|
||||
TRACE_(dmfile)(": wave sample chunk\n");
|
||||
memset (&tmpWaveSample, 0, sizeof(WSMPL)); /* reset */
|
||||
memset (&tmpWaveLoop, 0, sizeof(WLOOP)); /* reset */
|
||||
if (Chunk.dwSize != (sizeof(WSMPL) + sizeof(WLOOP))) ERR(": incorrect chunk size\n");
|
||||
IStream_Read (pStm, &tmpWaveSample, sizeof(WSMPL), NULL);
|
||||
IStream_Read (pStm, &tmpWaveLoop, sizeof(WLOOP), NULL);
|
||||
break;
|
||||
}
|
||||
case FOURCC_WLNK: {
|
||||
TRACE_(dmfile)(": wave link chunk\n");
|
||||
memset (&tmpWaveLink, 0, sizeof(WAVELINK)); /* reset */
|
||||
IStream_Read (pStm, &tmpWaveLink, Chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown (skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE_(dmfile)(": ListCount[2] = %d < ListSize[2] = %d\n", ListCount[2], ListSize[2]);
|
||||
} while (ListCount[2] < ListSize[2]);
|
||||
FIXME(": need to write temporary data to instrument data\n");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown (skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
|
||||
} while (ListCount[1] < ListSize[1]);
|
||||
break;
|
||||
}
|
||||
case FOURCC_LART: {
|
||||
TRACE_(dmfile)(": articulators list\n");
|
||||
do {
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case FOURCC_ART1: {
|
||||
/* temporary structures */
|
||||
CONNECTIONLIST tmpConnectionList;
|
||||
LPCONNECTION tmpConnections;
|
||||
|
||||
TRACE_(dmfile)(": level 1 articulator chunk\n");
|
||||
memset (&tmpConnectionList, 0, sizeof(CONNECTIONLIST)); /* reset */
|
||||
tmpConnections = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(CONNECTION)*tmpConnectionList.cConnections);
|
||||
if (Chunk.dwSize != (sizeof(CONNECTIONLIST) + sizeof(CONNECTION)*tmpConnectionList.cConnections)) ERR(": incorrect chunk size\n");
|
||||
IStream_Read (pStm, &tmpConnectionList, sizeof(CONNECTIONLIST), NULL);
|
||||
IStream_Read (pStm, tmpConnections, sizeof(CONNECTION)*tmpConnectionList.cConnections, NULL);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
|
||||
} while (ListCount[1] < ListSize[1]);
|
||||
break;
|
||||
}
|
||||
case mmioFOURCC('I','N','F','O'): {
|
||||
TRACE_(dmfile)(": INFO list\n");
|
||||
do {
|
||||
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
||||
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
||||
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
||||
switch (Chunk.fccID) {
|
||||
case mmioFOURCC('I','N','A','M'): {
|
||||
TRACE_(dmfile)(": name chunk (ignored)\n");
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
Chunk.dwSize++;
|
||||
}
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
case mmioFOURCC('I','A','R','T'): {
|
||||
TRACE_(dmfile)(": artist chunk (ignored)\n");
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
Chunk.dwSize++;
|
||||
}
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
case mmioFOURCC('I','C','O','P'): {
|
||||
/* temporary structures */
|
||||
CHAR tmpCopyright[DMUS_MAX_NAME];
|
||||
|
||||
TRACE_(dmfile)(": copyright chunk\n");
|
||||
IStream_Read (pStm, tmpCopyright, Chunk.dwSize, NULL);
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
liMove.QuadPart = 1;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mmioFOURCC('I','S','B','J'): {
|
||||
TRACE_(dmfile)(": subject chunk (ignored)\n");
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
Chunk.dwSize++;
|
||||
}
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
case mmioFOURCC('I','C','M','T'): {
|
||||
TRACE_(dmfile)(": comment chunk (ignored)\n");
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
Chunk.dwSize++;
|
||||
}
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
||||
if (even_or_odd(Chunk.dwSize)) {
|
||||
ListCount[1] ++;
|
||||
Chunk.dwSize++;
|
||||
}
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
|
||||
} while (ListCount[1] < ListSize[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown (skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
|
||||
} while (ListCount[0] < ListSize[0]);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
|
||||
liMove.QuadPart = Chunk.dwSize;
|
||||
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
/* DEBUG: dumps whole instrument object tree: */
|
||||
/* if (TRACE_ON(dmusic)) {
|
||||
TRACE("*** IDirectMusicInstrument (%p) ***\n", This);
|
||||
if (This->pInstrumentID)
|
||||
TRACE(" - GUID = %s\n", debugstr_dmguid(This->pInstrumentID));
|
||||
|
||||
TRACE(" - Instrument header:\n");
|
||||
TRACE(" - cRegions: %ld\n", This->pHeader->cRegions);
|
||||
TRACE(" - Locale:\n");
|
||||
TRACE(" - ulBank: %ld\n", This->pHeader->Locale.ulBank);
|
||||
TRACE(" - ulInstrument: %ld\n", This->pHeader->Locale.ulInstrument);
|
||||
TRACE(" => dwPatch: %ld\n", MIDILOCALE2Patch(&This->pHeader->Locale));
|
||||
}*/
|
||||
|
||||
return S_OK;
|
||||
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, ®ion->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, ®ion->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, ®ion->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, ®ion->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
|
@ -16,12 +16,14 @@
|
|||
* 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_FILENAME_STR "dmusic.dll"
|
||||
#define WINE_FILEVERSION 5,3,1,904
|
||||
#define WINE_FILEVERSION_STR "5.3.1.904"
|
||||
#define WINE_PRODUCTVERSION 5,3,1,904
|
||||
#define WINE_PRODUCTVERSION_STR "5.3.1.904"
|
||||
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
|
||||
|
||||
#include "wine/wine_common_ver.rc"
|
||||
#include <wine/wine_common_ver.rc>
|
||||
|
|
|
@ -380,7 +380,7 @@ DECLARE_INTERFACE_(IDirectMusic,IUnknown)
|
|||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirectMusic methods ***/
|
||||
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(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
|
||||
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;
|
||||
|
@ -421,7 +421,7 @@ DECLARE_INTERFACE_(IDirectMusic8,IDirectMusic)
|
|||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirectMusic methods ***/
|
||||
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(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
|
||||
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;
|
||||
|
|
|
@ -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_
|
||||
#define _DMUSICS_
|
||||
#ifndef __WINE_DMUSIC_SOFTWARESYNTH_H
|
||||
#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
|
||||
#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);
|
||||
DEFINE_GUID(IID_IDirectMusicSynth8, 0x53CAB625, 0x2711, 0x4C9F, 0x9D, 0xE7, 0x1B, 0x7F, 0x92, 0x5F, 0x6F, 0xC8);
|
||||
DEFINE_GUID(IID_IDirectMusicSynthSink, 0x09823663, 0x5C85, 0x11D2, 0xAF, 0xA6, 0x00, 0xAA, 0x00, 0x24, 0xD8, 0xB6);
|
||||
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink, 0x0A3A5BA5, 0x37B6, 0x11D2, 0xB9, 0xF9, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12);
|
||||
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xBE208857, 0x8952, 0x11D2, 0xBA, 0x1C, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12);
|
||||
|
||||
#define REFRESH_F_LASTBUFFER 0x00000001
|
||||
|
||||
typedef struct _DMUS_VOICE_STATE
|
||||
{
|
||||
BOOL bExists;
|
||||
SAMPLE_POSITION spPosition;
|
||||
} DMUS_VOICE_STATE;
|
||||
|
||||
#endif
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE IDirectMusicSynth
|
||||
DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
|
||||
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
||||
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
|
||||
STDMETHOD(Close) (THIS) PURE;
|
||||
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
|
||||
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE;
|
||||
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE;
|
||||
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt,LPBYTE pbBuffer, DWORD cbBuffer) PURE;
|
||||
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
|
||||
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
|
||||
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) 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;
|
||||
/* actual structure */
|
||||
struct _DMUS_VOICE_STATE {
|
||||
BOOL bExists;
|
||||
SAMPLE_POSITION spPosition;
|
||||
};
|
||||
#undef INTERFACE
|
||||
#endif /* _DMUS_VOICE_STATE_DEFINED */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicSynth interface
|
||||
*/
|
||||
#define INTERFACE IDirectMusicSynth
|
||||
DECLARE_INTERFACE_(IDirectMusicSynth,IUnknown)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirectMusicSynth methods ***/
|
||||
STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
|
||||
STDMETHOD(Close)(THIS) PURE;
|
||||
STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
|
||||
STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
|
||||
STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
|
||||
STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
|
||||
STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
|
||||
STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
|
||||
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) 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 pdwWaveFormatExSiz) PURE;
|
||||
STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
#define IDirectMusicSynth_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
|
||||
#define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p)
|
||||
#define IDirectMusicSynth_Open(p, a) (p)->lpVtbl->Open(p, a)
|
||||
#define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p)
|
||||
#define IDirectMusicSynth_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a)
|
||||
#define IDirectMusicSynth_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c)
|
||||
#define IDirectMusicSynth_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c)
|
||||
#define IDirectMusicSynth_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c)
|
||||
#define IDirectMusicSynth_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a)
|
||||
#define IDirectMusicSynth_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a)
|
||||
#define IDirectMusicSynth_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a)
|
||||
#define IDirectMusicSynth_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a)
|
||||
#define IDirectMusicSynth_Activate(p, a) (p)->lpVtbl->Activate((p, a)
|
||||
#define IDirectMusicSynth_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a)
|
||||
#define IDirectMusicSynth_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c)
|
||||
#define IDirectMusicSynth_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c)
|
||||
#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)
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirectMusicSynth_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IDirectMusicSynth methods ***/
|
||||
#define IDirectMusicSynth_Open(p,a) (p)->lpVtbl->Open(p,a)
|
||||
#define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p)
|
||||
#define IDirectMusicSynth_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
|
||||
#define IDirectMusicSynth_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
|
||||
#define IDirectMusicSynth_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
|
||||
#define IDirectMusicSynth_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
|
||||
#define IDirectMusicSynth_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
|
||||
#define IDirectMusicSynth_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
|
||||
#define IDirectMusicSynth_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
|
||||
#define IDirectMusicSynth_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
|
||||
#define IDirectMusicSynth_Activate(p,a) (p)->lpVtbl->Activate(p,a)
|
||||
#define IDirectMusicSynth_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
|
||||
#define IDirectMusicSynth_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
|
||||
#define IDirectMusicSynth_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
|
||||
#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
|
||||
|
||||
#define INTERFACE IDirectMusicSynth8
|
||||
DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth)
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicSynth8 interface
|
||||
*/
|
||||
#define INTERFACE IDirectMusicSynth8
|
||||
DECLARE_INTERFACE_(IDirectMusicSynth8,IDirectMusicSynth)
|
||||
{
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
|
||||
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
||||
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
|
||||
STDMETHOD(Close) (THIS) PURE;
|
||||
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
|
||||
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE;
|
||||
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE;
|
||||
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
|
||||
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
|
||||
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
|
||||
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) 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;
|
||||
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(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;
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirectMusicSynth methods ***/
|
||||
STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
|
||||
STDMETHOD(Close)(THIS) PURE;
|
||||
STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
|
||||
STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
|
||||
STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
|
||||
STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
|
||||
STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
|
||||
STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
|
||||
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) 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 pdwWaveFormatExSiz) PURE;
|
||||
STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
|
||||
/*** IDirectMusicSynth8 methods ***/
|
||||
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(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)
|
||||
#define IDirectMusicSynth8_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
|
||||
#define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p)
|
||||
#define IDirectMusicSynth8_Open(p, a) (p)->lpVtbl->Open(p, a)
|
||||
#define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p)
|
||||
#define IDirectMusicSynth8_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a)
|
||||
#define IDirectMusicSynth8_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c)
|
||||
#define IDirectMusicSynth8_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c)
|
||||
#define IDirectMusicSynth8_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c)
|
||||
#define IDirectMusicSynth8_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a)
|
||||
#define IDirectMusicSynth8_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a)
|
||||
#define IDirectMusicSynth8_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a)
|
||||
#define IDirectMusicSynth8_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a)
|
||||
#define IDirectMusicSynth8_Activate(p, a) (p)->lpVtbl->Activate((p, a)
|
||||
#define IDirectMusicSynth8_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a)
|
||||
#define IDirectMusicSynth8_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c)
|
||||
#define IDirectMusicSynth8_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c)
|
||||
#define IDirectMusicSynth8_GetChannelPriority(p, a, b, c) (p)->lpVtbl->GetChannelPriority(p, a, b, c)
|
||||
#define IDirectMusicSynth8_GetFormat(p, a, b) (p)->lpVtbl->GetFormat(p, a, b)
|
||||
#define IDirectMusicSynth8_GetAppend(p, a) (p)->lpVtbl->GetAppend(p, a)
|
||||
#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_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)
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirectMusicSynth8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IDirectMusicSynth methods ***/
|
||||
#define IDirectMusicSynth8_Open(p,a) (p)->lpVtbl->Open(p,a)
|
||||
#define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p)
|
||||
#define IDirectMusicSynth8_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
|
||||
#define IDirectMusicSynth8_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
|
||||
#define IDirectMusicSynth8_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
|
||||
#define IDirectMusicSynth8_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
|
||||
#define IDirectMusicSynth8_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
|
||||
#define IDirectMusicSynth8_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
|
||||
#define IDirectMusicSynth8_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
|
||||
#define IDirectMusicSynth8_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
|
||||
#define IDirectMusicSynth8_Activate(p,a) (p)->lpVtbl->Activate(p,a)
|
||||
#define IDirectMusicSynth8_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
|
||||
#define IDirectMusicSynth8_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
|
||||
#define IDirectMusicSynth8_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
|
||||
#define IDirectMusicSynth8_GetChannelPriority(p,a,b,c) (p)->lpVtbl->GetChannelPriority(p,a,b,c)
|
||||
#define IDirectMusicSynth8_GetFormat(p,a,b) (p)->lpVtbl->GetFormat(p,a,b)
|
||||
#define IDirectMusicSynth8_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a)
|
||||
/*** IDirectMusicSynth8 methods ***/
|
||||
#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_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
|
||||
|
||||
#define INTERFACE IDirectMusicSynthSink
|
||||
DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown)
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectMusicSynthSink interface
|
||||
*/
|
||||
#define INTERFACE IDirectMusicSynthSink
|
||||
DECLARE_INTERFACE_(IDirectMusicSynthSink,IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
|
||||
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
||||
STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE;
|
||||
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
|
||||
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
|
||||
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
|
||||
STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) PURE;
|
||||
STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, LONGLONG *pllSampleTime) PURE;
|
||||
STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
|
||||
STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE;
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirectMusicSynthSink methods ***/
|
||||
STDMETHOD(Init)(THIS_ IDirectMusicSynth *pSynth) PURE;
|
||||
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
|
||||
STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
|
||||
STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
|
||||
STDMETHOD(SampleToRefTime)(THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) 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 /* __WINE_DMUSIC_SOFTWARESYNTH_H */
|
||||
|
|
|
@ -1,58 +1,110 @@
|
|||
/*
|
||||
* dmksctrl.h
|
||||
* Definition of IKsControl
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Johannes Anderwald
|
||||
* Copyright (C) 2012 Christian Costa
|
||||
*
|
||||
* 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
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* 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.
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _IKsControl_
|
||||
#define _IKsControl_
|
||||
#ifndef _DMKSCTRL_
|
||||
#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
|
||||
DECLARE_INTERFACE_(IKsControl, IUnknown)
|
||||
DECLARE_INTERFACE_(IKsControl,IUnknown)
|
||||
{
|
||||
/* IUnknown */
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
|
||||
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
||||
|
||||
/*IKsControl*/
|
||||
STDMETHOD(KsProperty)(
|
||||
THIS_
|
||||
IN PKSPROPERTY Property,
|
||||
IN ULONG PropertyLength,
|
||||
IN OUT LPVOID PropertyData,
|
||||
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;
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IKsControl methods ***/
|
||||
STDMETHOD(KsProperty)(THIS_ PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
|
||||
ULONG DataLength, ULONG* BytesReturned) PURE;
|
||||
STDMETHOD(KsMethod)(THIS_ PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
|
||||
ULONG DataLength, ULONG* BytesReturned) PURE;
|
||||
STDMETHOD(KsEvent)(THIS_ PKSEVENT Event, ULONG EventLength, LPVOID EventData,
|
||||
ULONG DataLength, 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 /* _DMKSCTRL_ */
|
||||
|
|
|
@ -30,7 +30,7 @@ The following libraries are shared with Wine.
|
|||
reactos/dll/directx/amstream # Synced to Wine-1.3.37
|
||||
reactos/dll/directx/dinput # 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/dplayx # Synced to Wine-1.5.26
|
||||
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5
|
||||
|
|
Loading…
Reference in a new issue