- First drafts for IDirectMusicSegment::GetParam and

IDirectMusicTempoTrack::GetParam (need modif on Load).
- Return value fixes for GetClassID of TempoTrack and Segment.
This commit is contained in:
Raphael Junqueira 2004-05-17 19:48:49 +00:00 committed by Alexandre Julliard
parent c8aba95f50
commit 8d954393e1
3 changed files with 312 additions and 139 deletions

View File

@ -153,6 +153,12 @@ typedef struct _DMUS_PRIVATE_SEGMENT_TRACK {
IDirectMusicTrack* pTrack;
} DMUS_PRIVATE_SEGMENT_TRACK, *LPDMUS_PRIVATE_SEGMENT_TRACK;
typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
struct list entry; /* for listing elements */
DMUS_IO_TEMPO_ITEM item;
} DMUS_PRIVATE_TEMPO_ITEM, *LPDMUS_PRIVATE_TEMPO_ITEM;
/* 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
group; so all we need to do is to fill it with parent port, group and midi
@ -796,6 +802,8 @@ struct IDirectMusicTempoTrack {
/* IDirectMusicTempoTrack fields */
LPDMUS_OBJECTDESC pDesc;
BOOL enabled;
struct list Items;
};
/* IUnknown: */

View File

@ -147,23 +147,83 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetDefaultResolutio
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetTrack (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, IDirectMusicTrack** ppTrack) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %s, %ld, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, ppTrack);
CLSID pIt_clsid;
struct list* pEntry = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
IPersistStream* pCLSIDStream = NULL;
HRESULT hr = S_OK;
TRACE("(%p, %s, %ld, 0x%lx, %p)\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, ppTrack);
if (NULL == ppTrack) {
return E_POINTER;
}
LIST_FOR_EACH (pEntry, &This->Tracks) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
TRACE(" - %p -> 0x%lx,%p\n", pIt, pIt->dwGroupBits, pIt->pTrack);
if (0xFFFFFFFF != dwGroupBits && 0 == (pIt->dwGroupBits & dwGroupBits)) continue ;
if (FALSE == IsEqualGUID(&GUID_NULL, rguidType)) {
/**
* it rguidType is not null we must check if CLSID are equals
* and the unqiue way to get it its using IPersistStream Interface
*/
hr = IDirectMusicTrack_QueryInterface(pIt->pTrack, &IID_IPersistStream, (void**) &pCLSIDStream);
if (FAILED(hr)) {
ERR("(%p): object %p don't implement IPersistStream Interface. Expect a crash (critical problem)\n", This, pIt->pTrack);
continue ;
}
hr = IPersistStream_GetClassID(pCLSIDStream, &pIt_clsid);
IPersistStream_Release(pCLSIDStream); pCLSIDStream = NULL;
if (FAILED(hr)) {
ERR("(%p): non-implemented GetClassID for object %p\n", This, pIt->pTrack);
continue ;
}
TRACE(" - %p -> %s\n", pIt, debugstr_dmguid(&pIt_clsid));
if (FALSE == IsEqualGUID(&pIt_clsid, rguidType)) continue ;
}
if (0 == dwIndex) {
*ppTrack = pIt->pTrack;
IDirectMusicTrack_AddRef(*ppTrack);
return S_OK;
}
--dwIndex;
}
return DMUS_E_NOT_FOUND;
}
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetTrackGroup (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack, DWORD* pdwGroupBits) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p, %p): stub\n", This, pTrack, pdwGroupBits);
struct list* pEntry = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
TRACE("(%p, %p, %p)\n", This, pTrack, pdwGroupBits);
if (NULL == pdwGroupBits) {
return E_POINTER;
}
LIST_FOR_EACH (pEntry, &This->Tracks) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
TRACE(" - %p -> %ld,%p\n", pIt, pIt->dwGroupBits, pIt->pTrack);
if (NULL != pIt && pIt->pTrack == pTrack) {
*pdwGroupBits = pIt->dwGroupBits;
return S_OK;
}
}
return DMUS_E_NOT_FOUND;
}
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_InsertTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack, DWORD dwGroupBits) {
LPDMUS_PRIVATE_SEGMENT_TRACK pNewSegTrack;
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
struct list *pEntry;
DWORD i = 0;
struct list* pEntry = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pNewSegTrack = NULL;
TRACE("(%p, %p, %ld)\n", This, pTrack, dwGroupBits);
@ -194,14 +254,12 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_InsertTrack (LPDIRE
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
struct list *pEntry;
DWORD i = 0;
struct list* pEntry = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
FIXME("(%p, %p): stub\n", This, pTrack);
TRACE("(%p, %p)\n", This, pTrack);
LIST_FOR_EACH (pEntry, &This->Tracks) {
i++;
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
if (pIt->pTrack == pTrack) {
TRACE("(%p, %p): track in list\n", This, pTrack);
@ -279,8 +337,49 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveNotificationT
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetParam (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %s, %ld, %ld, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pmtNext, pParam);
return S_OK;
CLSID pIt_clsid;
struct list* pEntry = NULL;
IDirectMusicTrack* pTrack = NULL;
IPersistStream* pCLSIDStream = NULL;
LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
HRESULT hr = S_OK;
FIXME("(%p, %s, 0x%lx, %ld, %ld, %p, %p)\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pmtNext, pParam);
if (DMUS_SEG_ANYTRACK == dwIndex) {
LIST_FOR_EACH (pEntry, &This->Tracks) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
TRACE(" - %p -> 0x%lx,%p\n", pIt, pIt->dwGroupBits, pIt->pTrack);
if (0xFFFFFFFF != dwGroupBits && 0 == (pIt->dwGroupBits & dwGroupBits)) continue ;
hr = IPersistStream_GetClassID(pCLSIDStream, &pIt_clsid);
IPersistStream_Release(pCLSIDStream); pCLSIDStream = NULL;
if (FAILED(hr)) {
ERR("(%p): non-implemented GetClassID for object %p\n", This, pIt->pTrack);
continue ;
}
if (FALSE == IsEqualGUID(&pIt_clsid, rguidType)) continue ;
if (FAILED(IDirectMusicTrack_IsParamSupported(pIt->pTrack, rguidType))) continue ;
hr = IDirectMusicTrack_GetParam(pIt->pTrack, rguidType, mtTime, pmtNext, pParam);
if (SUCCEEDED(hr)) return hr;
}
ERR("(%p): not found\n", This);
return DMUS_E_TRACK_NOT_FOUND;
}
hr = IDirectMusicSegment8Impl_IDirectMusicSegment8_GetTrack(iface, &GUID_NULL, dwGroupBits, dwIndex, &pTrack);
if (FAILED(hr)) {
ERR("(%p): not found\n", This);
return DMUS_E_TRACK_NOT_FOUND;
}
hr = IDirectMusicTrack_GetParam(pTrack, rguidType, mtTime, pmtNext, pParam);
IDirectMusicTrack_Release(pTrack); pTrack = NULL;
return hr;
}
HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetParam (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, void* pParam) {
@ -666,7 +765,7 @@ ULONG WINAPI IDirectMusicSegment8Impl_IPersistStream_Release (LPPERSISTSTREAM if
HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
TRACE("(%p, %p)\n", This, pClassID);
memcpy(pClassID, &CLSID_DirectMusicContainer, sizeof(CLSID));
memcpy(pClassID, &CLSID_DirectMusicSegment, sizeof(CLSID));
return S_OK;
}
@ -1111,10 +1210,14 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM ifa
}
HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
FIXME("(%p): Saving not implemented yet\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
FIXME("(%p, %p): stub\n", This, pcbSize);
return E_NOTIMPL;
}

View File

@ -91,7 +91,7 @@ ULONG WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRAC
HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment)
{
ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
FIXME("(%p, %p): stub\n", This, pSegment);
TRACE("(%p, %p): nothing to do here\n", This, pSegment);
return S_OK;
}
@ -118,7 +118,50 @@ HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK
HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
HRESULT hr = S_OK;
struct list* pEntry = NULL;
LPDMUS_PRIVATE_TEMPO_ITEM pIt = NULL;
DMUS_TEMPO_PARAM* prm = pParam;
FIXME("(%p, %s, %ld, %p, %p): almost stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
if (NULL == pParam) {
return E_POINTER;
}
hr = IDirectMusicTempoTrack_IDirectMusicTrack_IsParamSupported (iface, rguidType);
if (FAILED(hr)) {
return hr;
}
if (FALSE == This->enabled) {
return DMUS_E_TYPE_DISABLED;
}
if (NULL != pmtNext) *pmtNext = 0;
prm->mtTime = 0;
prm->dblTempo = 0.123456;
LIST_FOR_EACH (pEntry, &This->Items) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_TEMPO_ITEM, entry);
/*TRACE(" - %p -> 0x%lx,%p\n", pIt, pIt->item.lTime, pIt->item.dblTempo);*/
if (pIt->item.lTime <= mtTime) {
MUSIC_TIME ofs = pIt->item.lTime - mtTime;
if (ofs > prm->mtTime) {
prm->mtTime = ofs;
prm->dblTempo = pIt->item.dblTempo;
}
if (NULL != pmtNext && pIt->item.lTime > mtTime) {
if (pIt->item.lTime < *pmtNext) {
*pmtNext = pIt->item.lTime;
}
}
}
}
if (0.123456 == prm->dblTempo) {
return DMUS_E_NOT_FOUND;
}
return S_OK;
}
@ -138,6 +181,9 @@ HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_IsParamSupported (LPDIRE
TRACE("param supported\n");
return S_OK;
}
if (FALSE == This->enabled) {
return DMUS_E_TYPE_DISABLED;
}
TRACE("param unsupported\n");
return DMUS_E_TYPE_UNSUPPORTED;
}
@ -230,7 +276,8 @@ ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_Release (LPPERSISTSTREAM ifac
HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
FIXME("(%p, %p): stub\n", This, pClassID);
TRACE("(%p, %p)\n", This, pClassID);
memcpy(pClassID, &CLSID_DirectMusicTempoTrack, sizeof(CLSID));
return S_OK;
}
@ -246,6 +293,7 @@ HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREAM iface
DWORD StreamSize, StreamCount;
LARGE_INTEGER liMove;
DMUS_IO_TEMPO_ITEM item;
LPDMUS_PRIVATE_TEMPO_ITEM pNewItem = NULL;
DWORD nItem = 0;
FIXME("(%p, %p): Loading not fully implemented yet\n", This, pStm);
@ -266,6 +314,14 @@ HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREAM iface
TRACE_(dmfile)("DMUS_IO_TEMPO_ITEM #%ld\n", nItem);
TRACE_(dmfile)(" - lTime = %lu\n", item.lTime);
TRACE_(dmfile)(" - dblTempo = %g\n", item.dblTempo);
pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_TEMPO_ITEM));
if (NULL == pNewItem) {
ERR(": no more memory\n");
return E_OUTOFMEMORY;
}
memcpy(&pNewItem->item, &item, sizeof(DMUS_IO_TEMPO_ITEM));
list_add_tail (&This->Items, &pNewItem->entry);
pNewItem = NULL;
StreamCount += sizeof(item);
TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize);
@ -288,10 +344,14 @@ HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREAM iface
}
HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
FIXME("(%p): Saving not implemented yet\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
FIXME("(%p, %p): stub\n", This, pcbSize);
return E_NOTIMPL;
}
@ -324,6 +384,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPVOID *ppob
track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicTempoTrack, sizeof (CLSID));
track->ref = 0; /* will be inited by QueryInterface */
track->enabled = TRUE;
list_init (&track->Items);
return IDirectMusicTempoTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
}