- Better loading of IDirectMusicSegTriggerTrack (internal list of

subtracks)
- Better stubs for IDirectMusicTempoTrack::InitPlay and
  IDirectMusicTempoTrack::EndPlay (InitPlay should return a valid
  memory pointer so allocate it). Should be extended for all
  IDirectMusicTrack objects.
This commit is contained in:
Raphael Junqueira 2004-05-19 04:32:43 +00:00 committed by Alexandre Julliard
parent df93f2eeee
commit dfbf36d3e8
4 changed files with 126 additions and 87 deletions

View File

@ -199,50 +199,50 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate (LPDIREC
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_SetVolume (LPDIRECTMUSICAUDIOPATH iface, long lVolume, DWORD dwDuration) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %li, %ld): stub\n", This, lVolume, dwDuration);
return S_OK;
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %li, %ld): stub\n", This, lVolume, dwDuration);
return S_OK;
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_ConvertPChannel (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannelIn, DWORD* pdwPChannelOut) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %ld, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
return S_OK;
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
FIXME("(%p, %ld, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
return S_OK;
}
ICOM_VTABLE(IDirectMusicAudioPath) DirectMusicAudioPath_AudioPath_Vtbl = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_QueryInterface,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_AddRef,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Release,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_GetObjectInPath,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_SetVolume,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_ConvertPChannel
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_QueryInterface,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_AddRef,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Release,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_GetObjectInPath,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_Activate,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_SetVolume,
IDirectMusicAudioPathImpl_IDirectMusicAudioPath_ConvertPChannel
};
/* IDirectMusicAudioPathImpl IDirectMusicObject part: */
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
ULONG WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
ULONG WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
return IDirectMusicAudioPathImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
TRACE("(%p, %p)\n", This, pDesc);
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
return S_OK;
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, ObjectVtbl, iface);
TRACE("(%p, %p)\n", This, pDesc);
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
return S_OK;
}
HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {

View File

@ -158,6 +158,16 @@ typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
DMUS_IO_TEMPO_ITEM item;
} DMUS_PRIVATE_TEMPO_ITEM, *LPDMUS_PRIVATE_TEMPO_ITEM;
typedef struct _DMUS_PRIVATE_SEGMENT_ITEM {
struct list entry; /* for listing elements */
DMUS_IO_SEGMENT_ITEM_HEADER header;
IDirectMusicObject* pObject;
WCHAR wszName[DMUS_MAX_NAME];
} DMUS_PRIVATE_SEGMENT_ITEM, *LPDMUS_PRIVATE_SEGMENT_ITEM;
typedef struct _DMUS_PRIVATE_TEMPO_PLAY_STATE {
DWORD dummy;
} DMUS_PRIVATE_TEMPO_PLAY_STATE, *LPDMUS_PRIVATE_TEMPO_PLAY_STATE;
/* some sort of aux. performance channel: as far as i can understand, these are
used to represent a particular midi channel in particular group at particular
@ -659,8 +669,8 @@ struct IDirectMusicSegTriggerTrack {
/* IDirectMusicSegTriggerTrack fields */
LPDMUS_OBJECTDESC pDesc;
DMUS_IO_SEGMENT_ITEM_HEADER header;
WCHAR wszName[DMUS_MAX_NAME];
struct list Items;
};
/* IUnknown: */

View File

@ -245,6 +245,7 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
HRESULT hr;
IDirectMusicObject* pObject = NULL;
LPDMUS_PRIVATE_SEGMENT_ITEM pNewItem = NULL;
if (pChunk->fccID != DMUS_FOURCC_SEGMENT_LIST) {
ERR_(dmfile)(": %s chunk should be a SEGMENT list\n", debugstr_fourcc (pChunk->fccID));
@ -260,18 +261,25 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_SEGMENTITEM_CHUNK: {
TRACE_(dmfile)(": segment item chunk\n");
IStream_Read (pStm, &This->header, sizeof(DMUS_IO_SEGMENT_ITEM_HEADER), NULL);
TRACE_(dmfile)(" - lTimePhysical: %lu\n", This->header.lTimeLogical);
TRACE_(dmfile)(" - lTimePhysical: %lu\n", This->header.lTimePhysical);
TRACE_(dmfile)(" - dwPlayFlags: 0x%08lx\n", This->header.dwPlayFlags);
TRACE_(dmfile)(" - dwFlags: 0x%08lx\n", This->header.dwFlags);
TRACE_(dmfile)(": segment item chunk\n");
/** alloc new item entry */
pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_SEGMENT_ITEM));
if (NULL == pNewItem) {
ERR(": no more memory\n");
return E_OUTOFMEMORY;
}
IStream_Read (pStm, &pNewItem->header, sizeof(DMUS_IO_SEGMENT_ITEM_HEADER), NULL);
TRACE_(dmfile)(" - lTimePhysical: %lu\n", pNewItem->header.lTimeLogical);
TRACE_(dmfile)(" - lTimePhysical: %lu\n", pNewItem->header.lTimePhysical);
TRACE_(dmfile)(" - dwPlayFlags: 0x%08lx\n", pNewItem->header.dwPlayFlags);
TRACE_(dmfile)(" - dwFlags: 0x%08lx\n", pNewItem->header.dwFlags);
list_add_tail (&This->Items, &pNewItem->entry);
break;
}
case DMUS_FOURCC_SEGMENTITEMNAME_CHUNK: {
TRACE_(dmfile)(": segment item name chunk\n");
IStream_Read (pStm, This->wszName, Chunk.dwSize, NULL);
TRACE_(dmfile)(" - name: %s \n", debugstr_w(This->wszName));
IStream_Read (pStm, pNewItem->wszName, Chunk.dwSize, NULL);
TRACE_(dmfile)(" - name: %s \n", debugstr_w(pNewItem->wszName));
break;
}
case FOURCC_LIST: {
@ -287,10 +295,7 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
ERR(": could not load Reference\n");
return hr;
}
/*
* TODO: what to do with the new pObject ?
* for now it leaks
*/
pNewItem->pObject = pObject;
break;
}
default: {
@ -500,21 +505,22 @@ ICOM_VTABLE(IPersistStream) DirectMusicSegTriggerTrack_PersistStream_Vtbl = {
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicSegTriggerTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicSegTriggerTrack* track;
IDirectMusicSegTriggerTrack* track;
track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrack));
if (NULL == track) {
*ppobj = (LPVOID) NULL;
return E_OUTOFMEMORY;
}
track->UnknownVtbl = &DirectMusicSegTriggerTrack_Unknown_Vtbl;
track->TrackVtbl = &DirectMusicSegTriggerTrack_Track_Vtbl;
track->PersistStreamVtbl = &DirectMusicSegTriggerTrack_PersistStream_Vtbl;
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(track->pDesc);
track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicSegTriggerTrack, sizeof (CLSID));
track->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicSegTriggerTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrack));
if (NULL == track) {
*ppobj = (LPVOID) NULL;
return E_OUTOFMEMORY;
}
track->UnknownVtbl = &DirectMusicSegTriggerTrack_Unknown_Vtbl;
track->TrackVtbl = &DirectMusicSegTriggerTrack_Track_Vtbl;
track->PersistStreamVtbl = &DirectMusicSegTriggerTrack_PersistStream_Vtbl;
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(track->pDesc);
track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicSegTriggerTrack, sizeof (CLSID));
track->ref = 0; /* will be inited by QueryInterface */
list_init (&track->Items);
return IDirectMusicSegTriggerTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
}

View File

@ -1,6 +1,7 @@
/* IDirectMusicTempoTrack Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2004 Raphael Junqueira
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,42 +28,42 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
*/
/* IDirectMusicTempoTrack IUnknown part: */
HRESULT WINAPI IDirectMusicTempoTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = (LPUNKNOWN)&This->UnknownVtbl;
IDirectMusicTempoTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
|| IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
*ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
IDirectMusicTempoTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
IDirectMusicTempoTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = (LPUNKNOWN)&This->UnknownVtbl;
IDirectMusicTempoTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
|| IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
*ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
IDirectMusicTempoTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
IDirectMusicTempoTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
}
ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
ICOM_VTABLE(IUnknown) DirectMusicTempoTrack_Unknown_Vtbl = {
@ -98,14 +99,35 @@ HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK
HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
{
ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
LPDMUS_PRIVATE_TEMPO_PLAY_STATE pState = NULL;
FIXME("(%p, %p, %p, %p, %ld, %ld): semi-stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
pState = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_TEMPO_PLAY_STATE));
if (NULL == pState) {
ERR(": no more memory\n");
return E_OUTOFMEMORY;
}
/** TODO real fill usefull datas */
pState->dummy = 0;
*ppStateData = pState;
return S_OK;
}
HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
{
ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
FIXME("(%p, %p): stub\n", This, pStateData);
LPDMUS_PRIVATE_TEMPO_PLAY_STATE pState = pStateData;
FIXME("(%p, %p): semi-stub\n", This, pStateData);
if (NULL == pStateData) {
return E_POINTER;
}
/** TODO real clean up */
HeapFree(GetProcessHeap(), 0, pState);
return S_OK;
}
@ -113,6 +135,7 @@ HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK
{
ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
/** should use IDirectMusicPerformance_SendPMsg here */
return S_OK;
}