* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2003-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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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 Library General Public License for more details.
+ * 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 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 "dmime_private.h"
* IDirectMusicSegmentImpl implementation
*/
/* IDirectMusicSegment IUnknown part: */
-HRESULT WINAPI IDirectMusicSegment8Impl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = (LPVOID)&This->UnknownVtbl;
- IDirectMusicSegment8Impl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
+ IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicSegment)
|| IsEqualIID (riid, &IID_IDirectMusicSegment2)
|| IsEqualIID (riid, &IID_IDirectMusicSegment8)) {
*ppobj = (LPVOID)&This->SegmentVtbl;
- IDirectMusicSegment8Impl_IDirectMusicSegment8_AddRef ((LPDIRECTMUSICSEGMENT8)&This->SegmentVtbl);
+ IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
*ppobj = (LPVOID)&This->ObjectVtbl;
- IDirectMusicSegment8Impl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl);
+ IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = (LPVOID)&This->PersistStreamVtbl;
- IDirectMusicSegment8Impl_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
+ IUnknown_AddRef (iface);
return S_OK;
}
return E_NOINTERFACE;
}
-ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_AddRef (LPUNKNOWN iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface);
- TRACE("(%p): AddRef from %ld\n", This, This->ref);
- return ++(This->ref);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p): AddRef from %d\n", This, ref - 1);
+
+ DMIME_LockModule();
+
+ return ref;
}
-ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_Release (LPUNKNOWN iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface);
- ULONG ref = --This->ref;
- TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
+ ULONG ref = InterlockedDecrement(&This->ref);
+ TRACE("(%p): ReleaseRef to %d\n", This, ref);
+
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
+
+ DMIME_UnlockModule();
+
return ref;
}
-ICOM_VTABLE(IUnknown) DirectMusicSegment8_Unknown_Vtbl = {
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+static const IUnknownVtbl DirectMusicSegment8_Unknown_Vtbl = {
IDirectMusicSegment8Impl_IUnknown_QueryInterface,
IDirectMusicSegment8Impl_IUnknown_AddRef,
IDirectMusicSegment8Impl_IUnknown_Release
};
/* IDirectMusicSegmentImpl IDirectMusicSegment part: */
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_QueryInterface (LPDIRECTMUSICSEGMENT8 iface, REFIID riid, LPVOID *ppobj) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_QueryInterface (LPDIRECTMUSICSEGMENT8 iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
+ return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_AddRef (LPDIRECTMUSICSEGMENT8 iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_AddRef (LPDIRECTMUSICSEGMENT8 iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Release (LPDIRECTMUSICSEGMENT8 iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Release (LPDIRECTMUSICSEGMENT8 iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtLength) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtLength) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %p)\n", This, pmtLength);
if (NULL == pmtLength) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtLength) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtLength) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %ld)\n", This, mtLength);
This->header.mtLength = mtLength;
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwRepeats) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwRepeats) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %p)\n", This, pdwRepeats);
if (NULL == pdwRepeats) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD dwRepeats) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD dwRepeats) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- TRACE("(%p, %ld)\n", This, dwRepeats);
+ TRACE("(%p, %d)\n", This, dwRepeats);
This->header.dwRepeats = dwRepeats;
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwResolution) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwResolution) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %p)\n", This, pdwResolution);
if (NULL == pdwResolution) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD dwResolution) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD dwResolution) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- TRACE("(%p, %ld)\n", This, dwResolution);
+ TRACE("(%p, %d)\n", This, dwResolution);
This->header.dwResolution = dwResolution;
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetTrack (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, IDirectMusicTrack** ppTrack) {
+static 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);
- return S_OK;
+
+ CLSID pIt_clsid;
+ struct list* pEntry = NULL;
+ LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
+ IPersistStream* pCLSIDStream = NULL;
+ HRESULT hr = S_OK;
+
+ TRACE("(%p, %s, %d, 0x%x, %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%x,%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) {
+static 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);
- return S_OK;
+
+ 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 -> %d,%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) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_InsertTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack, DWORD dwGroupBits) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %p, %ld): stub\n", This, pTrack, dwGroupBits);
+
+ DWORD i = 0;
+ struct list* pEntry = NULL;
+ LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
+ LPDMUS_PRIVATE_SEGMENT_TRACK pNewSegTrack = NULL;
+
+ TRACE("(%p, %p, %d)\n", This, pTrack, dwGroupBits);
+
+ LIST_FOR_EACH (pEntry, &This->Tracks) {
+ i++;
+ pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
+ TRACE(" - #%u: %p -> %d,%p\n", i, pIt, pIt->dwGroupBits, pIt->pTrack);
+ if (NULL != pIt && pIt->pTrack == pTrack) {
+ ERR("(%p, %p): track is already in list\n", This, pTrack);
+ return E_FAIL;
+ }
+ }
+
+ pNewSegTrack = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_SEGMENT_TRACK));
+ if (NULL == pNewSegTrack) {
+ ERR(": no more memory\n");
+ return E_OUTOFMEMORY;
+ }
+ pNewSegTrack->dwGroupBits = dwGroupBits;
+ pNewSegTrack->pTrack = pTrack;
+ IDirectMusicTrack_Init(pTrack, (IDirectMusicSegment *)iface);
+ IDirectMusicTrack_AddRef(pTrack);
+ list_add_tail (&This->Tracks, &pNewSegTrack->entry);
+
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %p): stub\n", This, pTrack);
- return S_OK;
+
+ struct list* pEntry = NULL;
+ LPDMUS_PRIVATE_SEGMENT_TRACK pIt = NULL;
+
+ TRACE("(%p, %p)\n", This, pTrack);
+
+ LIST_FOR_EACH (pEntry, &This->Tracks) {
+ pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_SEGMENT_TRACK, entry);
+ if (pIt->pTrack == pTrack) {
+ TRACE("(%p, %p): track in list\n", This, pTrack);
+
+ list_remove(&pIt->entry);
+ IDirectMusicTrack_Init(pIt->pTrack, NULL);
+ IDirectMusicTrack_Release(pIt->pTrack);
+ HeapFree(GetProcessHeap(), 0, pIt);
+
+ return S_OK;
+ }
+ }
+
+ return S_FALSE;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_InitPlay (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicSegmentState** ppSegState, IDirectMusicPerformance* pPerformance, DWORD dwFlags) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_InitPlay (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicSegmentState** ppSegState, IDirectMusicPerformance* pPerformance, DWORD dwFlags) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
HRESULT hr;
- FIXME("(%p, %p, %p, %ld): semi-stub\n", This, ppSegState, pPerformance, dwFlags);
+ FIXME("(%p, %p, %p, %d): semi-stub\n", This, ppSegState, pPerformance, dwFlags);
if (NULL == ppSegState) {
return E_POINTER;
}
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph** ppGraph) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph** ppGraph) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p): semi-stub\n", This, ppGraph);
if (NULL == ppGraph) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph* pGraph) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph* pGraph) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p): to complete\n", This, pGraph);
if (NULL != This->pGraph) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_AddNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
- ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
- return S_OK;
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_AddNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
+ ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
+ FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
+ return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
- ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
- return S_OK;
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_RemoveNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
+ ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
+ FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
+ return S_OK;
}
-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;
+static 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);
+
+ 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%x, %d, %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%x,%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) {
- ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %s, %ld, %ld, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pParam);
- return S_OK;
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetParam (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, void* pParam) {
+ ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
+ FIXME("(%p, %s, %d, %d, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pParam);
+ return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Clone (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicSegment** ppSegment) {
- ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppSegment);
- return S_OK;
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Clone (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicSegment** ppSegment) {
+ ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
+ FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppSegment);
+ return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %ld)\n", This, mtStart);
if (mtStart >= This->header.mtLength) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %p)\n", This, pmtStart);
if (NULL == pmtStart) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %ld, %ld)\n", This, mtStart, mtEnd);
if (mtStart >= This->header.mtLength || mtEnd > This->header.mtLength || mtStart > mtEnd) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart, MUSIC_TIME* pmtEnd) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart, MUSIC_TIME* pmtEnd) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
TRACE("(%p, %p, %p)\n", This, pmtStart, pmtEnd);
if (NULL == pmtStart || NULL == pmtEnd) {
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetPChannelsUsed (LPDIRECTMUSICSEGMENT8 iface, DWORD dwNumPChannels, DWORD* paPChannels) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetPChannelsUsed (LPDIRECTMUSICSEGMENT8 iface, DWORD dwNumPChannels, DWORD* paPChannels) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %ld, %p): stub\n", This, dwNumPChannels, paPChannels);
+ FIXME("(%p, %d, %p): stub\n", This, dwNumPChannels, paPChannels);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetTrackConfig (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_SetTrackConfig (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
- FIXME("(%p, %s, %ld, %ld, %ld, %ld): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff);
+ FIXME("(%p, %s, %d, %d, %d, %d): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetAudioPathConfig (LPDIRECTMUSICSEGMENT8 iface, IUnknown** ppAudioPathConfig){
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_GetAudioPathConfig (LPDIRECTMUSICSEGMENT8 iface, IUnknown** ppAudioPathConfig){
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p): stub\n", This, ppAudioPathConfig);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Compose (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtTime, IDirectMusicSegment* pFromSegment, IDirectMusicSegment* pToSegment, IDirectMusicSegment** ppComposedSegment) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Compose (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtTime, IDirectMusicSegment* pFromSegment, IDirectMusicSegment* pToSegment, IDirectMusicSegment** ppComposedSegment) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %ld, %p, %p, %p): stub\n", This, mtTime, pFromSegment, pToSegment, ppComposedSegment);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Download (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Download (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p): stub\n", This, pAudioPath);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Unload (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicSegment8_Unload (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, SegmentVtbl, iface);
FIXME("(%p, %p): stub\n", This, pAudioPath);
return S_OK;
}
-ICOM_VTABLE(IDirectMusicSegment8) DirectMusicSegment8_Segment_Vtbl = {
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+static const IDirectMusicSegment8Vtbl DirectMusicSegment8_Segment_Vtbl = {
IDirectMusicSegment8Impl_IDirectMusicSegment8_QueryInterface,
IDirectMusicSegment8Impl_IDirectMusicSegment8_AddRef,
IDirectMusicSegment8Impl_IDirectMusicSegment8_Release,
};
/* IDirectMusicSegment8Impl IDirectMusicObject part: */
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, ObjectVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
+ return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, ObjectVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, ObjectVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, 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 */
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, ObjectVtbl, iface);
TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass));
if (pDesc->dwValidData & DMUS_OBJ_NAME)
- strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
+ lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
- strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
+ lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
- strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
+ lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_DATE)
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, ObjectVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
memcpy (&pDesc->guidClass, &CLSID_DirectMusicSegment, sizeof(CLSID));
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
- TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_GUID_CHUNK: {
TRACE_(dmfile)(": GUID chunk\n");
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
(though strings seem to be valid unicode) */
break;
}
}
- TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
+ TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
break;
}
}
- TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
+ TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
break;
}
}
- TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
+ TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize);
break;
} else if (Chunk.fccID == mmioFOURCC('W','A','V','E')) {
return S_OK;
}
-ICOM_VTABLE(IDirectMusicObject) DirectMusicSegment8_Object_Vtbl = {
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
- IDirectMusicSegment8Impl_IDirectMusicObject_QueryInterface,
- IDirectMusicSegment8Impl_IDirectMusicObject_AddRef,
- IDirectMusicSegment8Impl_IDirectMusicObject_Release,
- IDirectMusicSegment8Impl_IDirectMusicObject_GetDescriptor,
- IDirectMusicSegment8Impl_IDirectMusicObject_SetDescriptor,
- IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor
+static const IDirectMusicObjectVtbl DirectMusicSegment8_Object_Vtbl = {
+ IDirectMusicSegment8Impl_IDirectMusicObject_QueryInterface,
+ IDirectMusicSegment8Impl_IDirectMusicObject_AddRef,
+ IDirectMusicSegment8Impl_IDirectMusicObject_Release,
+ IDirectMusicSegment8Impl_IDirectMusicObject_GetDescriptor,
+ IDirectMusicSegment8Impl_IDirectMusicObject_SetDescriptor,
+ IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor
};
/* IDirectMusicSegment8Impl IPersistStream part: */
-HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
+ return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
}
-ULONG WINAPI IDirectMusicSegment8Impl_IPersistStream_Release (LPPERSISTSTREAM iface) {
+static ULONG WINAPI IDirectMusicSegment8Impl_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
- return IDirectMusicSegment8Impl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
+ return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
+static 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;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
+static HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
FIXME("(%p): stub, always S_FALSE\n", This);
return S_FALSE;
/* release all loading-related stuff */
IPersistStream_Release (pPersistStream);
- hr = IDirectMusicSegment8Impl_IDirectMusicSegment8_InsertTrack ((LPDIRECTMUSICSEGMENT8)This->SegmentVtbl, *ppTrack, pTrack_hdr->dwGroup); /* at dsPosition */
+ hr = IDirectMusicSegment8Impl_IDirectMusicSegment8_InsertTrack ((LPDIRECTMUSICSEGMENT8)&This->SegmentVtbl, *ppTrack, pTrack_hdr->dwGroup); /* at dsPosition */
if (FAILED(hr)) {
ERR(": could not insert track\n");
return hr;
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_TRACK_CHUNK: {
TRACE_(dmfile)(": track chunck\n");
IStream_Read (pStm, &track_hdr, sizeof(DMUS_IO_TRACK_HEADER), NULL);
TRACE_(dmfile)(" - class: %s\n", debugstr_guid (&track_hdr.guidClassID));
- TRACE_(dmfile)(" - dwGroup: %ld\n", track_hdr.dwGroup);
+ TRACE_(dmfile)(" - dwGroup: %d\n", track_hdr.dwGroup);
TRACE_(dmfile)(" - ckid: %s\n", debugstr_fourcc (track_hdr.ckid));
TRACE_(dmfile)(" - fccType: %s\n", debugstr_fourcc (track_hdr.fccType));
break;
break;
}
}
- TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
+ TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize);
return S_OK;
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
break;
}
}
- TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
+ TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
return S_OK;
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
hr = IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk, pStm, This->pDesc);
if (FAILED(hr)) return hr;
checkSz += sizeof(This->header.mtLoopEnd);
IStream_Read (pStm, &This->header.dwResolution, sizeof(This->header.dwResolution), NULL);
checkSz += sizeof(This->header.dwResolution);
- TRACE_(dmfile)("dwRepeats: %lu\n", This->header.dwRepeats);
+ TRACE_(dmfile)("dwRepeats: %u\n", This->header.dwRepeats);
TRACE_(dmfile)("mtLength: %lu\n", This->header.mtLength);
TRACE_(dmfile)("mtPlayStart: %lu\n", This->header.mtPlayStart);
TRACE_(dmfile)("mtLoopStart: %lu\n", This->header.mtLoopStart);
TRACE_(dmfile)("mtLoopEnd: %lu\n", This->header.mtLoopEnd);
- TRACE_(dmfile)("dwResolution: %lu\n", This->header.dwResolution);
+ TRACE_(dmfile)("dwResolution: %u\n", This->header.dwResolution);
/** DX 8 */
if (Chunk.dwSize > checkSz) {
IStream_Read (pStm, &This->header.rtLength, sizeof(This->header.rtLength), NULL);
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
hr = IDirectMusicUtils_IPersistStream_ParseUNFOGeneric(&Chunk, pStm, This->pDesc);
if (FAILED(hr)) return hr;
}
}
- TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
+ TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
}
}
}
- TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
+ TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize);
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
+static HRESULT IDirectMusicSegment8Impl_IPersistStream_LoadWave (LPPERSISTSTREAM iface, IStream* pClonedStream, IDirectMusicObject** ppWaveObject) {
+
+ HRESULT hr = E_FAIL;
+ IPersistStream* pPersistStream = NULL;
+
+ hr = CoCreateInstance (&CLSID_DirectSoundWave, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicObject, (LPVOID*) ppWaveObject);
+ if (FAILED(hr)) {
+ ERR(": could not create object\n");
+ return hr;
+ }
+ /* acquire PersistStream interface */
+ hr = IDirectMusicObject_QueryInterface (*ppWaveObject, &IID_IPersistStream, (LPVOID*) &pPersistStream);
+ if (FAILED(hr)) {
+ ERR(": could not acquire IPersistStream\n");
+ return hr;
+ }
+ /* load */
+ hr = IPersistStream_Load (pPersistStream, pClonedStream);
+ if (FAILED(hr)) {
+ ERR(": failed to load object\n");
+ return hr;
+ }
+
+ /* release all loading-related stuff */
+ IPersistStream_Release (pPersistStream);
+
+ return S_OK;
+}
+
+static HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
HRESULT hr;
TRACE("(%p, %p): Loading\n", This, pStm);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
- TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
+ TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
break;
}
case mmioFOURCC('W','A','V','E'): {
- FIXME_(dmfile)(": WAVE form (loading not yet implemented)\n");
+ LPSTREAM pClonedStream = NULL;
+ IDirectMusicObject* pWave = NULL;
+
+ FIXME_(dmfile)(": WAVE form (loading to be checked)\n");
+
+ IStream_Clone (pStm, &pClonedStream);
+
+ liMove.QuadPart = 0;
+ liMove.QuadPart -= sizeof(FOURCC) + (sizeof(FOURCC)+sizeof(DWORD));
+ IStream_Seek (pClonedStream, liMove, STREAM_SEEK_CUR, NULL);
+
+ hr = IDirectMusicSegment8Impl_IPersistStream_LoadWave (iface, pClonedStream, &pWave);
+ if (FAILED(hr)) {
+ ERR(": could not load track\n");
+ return hr;
+ }
+ IStream_Release (pClonedStream);
+
+ IDirectMusicTrack_Release(pWave); pWave = NULL; /* now we can release at as it inserted */
+
liMove.QuadPart = StreamSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
break;
return S_OK;
}
-HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
+static 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) {
+static 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;
}
-ICOM_VTABLE(IPersistStream) DirectMusicSegment8_PersistStream_Vtbl = {
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+static const IPersistStreamVtbl DirectMusicSegment8_PersistStream_Vtbl = {
IDirectMusicSegment8Impl_IPersistStream_QueryInterface,
IDirectMusicSegment8Impl_IPersistStream_AddRef,
IDirectMusicSegment8Impl_IPersistStream_Release,
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegment8Impl));
if (NULL == obj) {
- *ppobj = (LPVOID) NULL;
+ *ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->UnknownVtbl = &DirectMusicSegment8_Unknown_Vtbl;
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&obj->pDesc->guidClass, &CLSID_DirectMusicSegment, sizeof (CLSID));
obj->ref = 0; /* will be inited by QueryInterface */
+ list_init (&obj->Tracks);
return IDirectMusicSegment8Impl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);
}