1 /* IDirectMusicStyleTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmstyle_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
25 static ULONG WINAPI IDirectMusicStyleTrack_IUnknown_AddRef (LPUNKNOWN iface);
26 static ULONG WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface);
27 static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface);
29 /*****************************************************************************
30 * IDirectMusicStyleTrack implementation
32 /* IDirectMusicStyleTrack IUnknown part: */
33 static HRESULT WINAPI IDirectMusicStyleTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
34 ICOM_THIS_MULTI(IDirectMusicStyleTrack, UnknownVtbl, iface);
35 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
37 if (IsEqualIID (riid, &IID_IUnknown)) {
38 *ppobj = (LPUNKNOWN)&This->UnknownVtbl;
39 IDirectMusicStyleTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
41 } else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
42 || IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
43 *ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
44 IDirectMusicStyleTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
46 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
47 *ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
48 IDirectMusicStyleTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
52 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
56 static ULONG WINAPI IDirectMusicStyleTrack_IUnknown_AddRef (LPUNKNOWN iface) {
57 ICOM_THIS_MULTI(IDirectMusicStyleTrack, UnknownVtbl, iface);
58 ULONG ref = InterlockedIncrement(&This->ref);
60 TRACE("(%p): AddRef from %d\n", This, ref - 1);
67 static ULONG WINAPI IDirectMusicStyleTrack_IUnknown_Release (LPUNKNOWN iface) {
68 ICOM_THIS_MULTI(IDirectMusicStyleTrack, UnknownVtbl, iface);
69 ULONG ref = InterlockedDecrement(&This->ref);
71 TRACE("(%p): ReleaseRef to %d\n", This, ref);
74 HeapFree(GetProcessHeap(), 0, This);
77 DMSTYLE_UnlockModule();
82 static const IUnknownVtbl DirectMusicStyleTrack_Unknown_Vtbl = {
83 IDirectMusicStyleTrack_IUnknown_QueryInterface,
84 IDirectMusicStyleTrack_IUnknown_AddRef,
85 IDirectMusicStyleTrack_IUnknown_Release
88 /* IDirectMusicStyleTrack IDirectMusicTrack8 part: */
89 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
90 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
91 return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
94 static ULONG WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
95 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
96 return IDirectMusicStyleTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
99 static ULONG WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
100 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
101 return IDirectMusicStyleTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
104 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment)
106 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
107 FIXME("(%p, %p): stub\n", This, pSegment);
111 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
113 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
114 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
118 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
120 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
121 FIXME("(%p, %p): stub\n", This, pStateData);
125 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
127 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
128 FIXME("(%p, %p, %ld, %ld, %ld, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
132 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
133 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
134 FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
138 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
139 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
140 FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
144 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
145 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
147 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
148 if (IsEqualGUID (rguidType, &GUID_DisableTimeSig)
149 || IsEqualGUID (rguidType, &GUID_EnableTimeSig)
150 || IsEqualGUID (rguidType, &GUID_IDirectMusicStyle)
151 || IsEqualGUID (rguidType, &GUID_SeedVariations)
152 || IsEqualGUID (rguidType, &GUID_TimeSignature)) {
153 TRACE("param supported\n");
156 TRACE("param unsupported\n");
157 return DMUS_E_TYPE_UNSUPPORTED;
160 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
161 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
162 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
166 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
167 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
168 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
172 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
173 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
174 FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
178 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
179 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
180 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
181 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
185 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
186 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
187 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
188 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
192 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
193 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
194 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
195 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
199 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
200 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
201 FIXME("(%p, %p, %d, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
205 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
206 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
207 FIXME("(%p, %p, %ld, %p, %d, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
211 static const IDirectMusicTrack8Vtbl DirectMusicStyleTrack_Track_Vtbl = {
212 IDirectMusicStyleTrack_IDirectMusicTrack_QueryInterface,
213 IDirectMusicStyleTrack_IDirectMusicTrack_AddRef,
214 IDirectMusicStyleTrack_IDirectMusicTrack_Release,
215 IDirectMusicStyleTrack_IDirectMusicTrack_Init,
216 IDirectMusicStyleTrack_IDirectMusicTrack_InitPlay,
217 IDirectMusicStyleTrack_IDirectMusicTrack_EndPlay,
218 IDirectMusicStyleTrack_IDirectMusicTrack_Play,
219 IDirectMusicStyleTrack_IDirectMusicTrack_GetParam,
220 IDirectMusicStyleTrack_IDirectMusicTrack_SetParam,
221 IDirectMusicStyleTrack_IDirectMusicTrack_IsParamSupported,
222 IDirectMusicStyleTrack_IDirectMusicTrack_AddNotificationType,
223 IDirectMusicStyleTrack_IDirectMusicTrack_RemoveNotificationType,
224 IDirectMusicStyleTrack_IDirectMusicTrack_Clone,
225 IDirectMusicStyleTrack_IDirectMusicTrack_PlayEx,
226 IDirectMusicStyleTrack_IDirectMusicTrack_GetParamEx,
227 IDirectMusicStyleTrack_IDirectMusicTrack_SetParamEx,
228 IDirectMusicStyleTrack_IDirectMusicTrack_Compose,
229 IDirectMusicStyleTrack_IDirectMusicTrack_Join
232 /* IDirectMusicStyleTrack IPersistStream part: */
233 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
234 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
235 return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
238 static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
239 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
240 return IDirectMusicStyleTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
243 static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
244 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
245 return IDirectMusicStyleTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
248 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
249 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
250 TRACE("(%p, %p)\n", This, pClassID);
251 *pClassID = CLSID_DirectMusicStyleTrack;
255 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
256 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
257 FIXME("(%p): stub, always S_FALSE\n", This);
261 static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
262 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
263 DMUS_PRIVATE_CHUNK Chunk;
264 DWORD ListSize[3], ListCount[3];
265 LARGE_INTEGER liMove; /* used when skipping chunks */
268 IDirectMusicObject* pObject = NULL;
269 LPDMUS_PRIVATE_STYLE_ITEM pNewItem = NULL;
271 if (pChunk->fccID != DMUS_FOURCC_STYLE_REF_LIST) {
272 ERR_(dmfile)(": %s chunk should be a STYLE list\n", debugstr_fourcc (pChunk->fccID));
276 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
280 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
281 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
282 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
283 switch (Chunk.fccID) {
284 case DMUS_FOURCC_TIME_STAMP_CHUNK: {
285 TRACE_(dmfile)(": Time Stamp chunk\n");
286 pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_ITEM));
287 if (NULL == pNewItem) {
288 ERR(": no more memory\n");
289 return E_OUTOFMEMORY;
291 IStream_Read (pStm, &pNewItem->dwTimeStamp, sizeof(DWORD), NULL);
292 TRACE_(dmfile)(" - dwTimeStamp: %u\n", pNewItem->dwTimeStamp);
293 list_add_tail (&This->Items, &pNewItem->entry);
297 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
298 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
299 ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
301 switch (Chunk.fccID) {
303 * should be a DMRF (DirectMusic Reference) list @TODO
305 case DMUS_FOURCC_REF_LIST: {
306 FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n");
307 hr = IDirectMusicUtils_IPersistStream_ParseReference (iface, &Chunk, pStm, &pObject);
309 ERR(": could not load Reference\n");
312 hr = IDirectMusicObject_QueryInterface(pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pNewItem->pObject);
314 ERR(": Reference not an IDirectMusicStyle, exiting\n");
318 IDirectMusicObject_Release(pObject);
322 TRACE_(dmfile)(": unknown (skipping)\n");
323 liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
324 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
331 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
332 liMove.QuadPart = Chunk.dwSize;
333 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
337 TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
338 } while (ListCount[0] < ListSize[0]);
343 static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
345 /*ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);*/
346 DMUS_PRIVATE_CHUNK Chunk;
347 DWORD ListSize[3], ListCount[3];
348 LARGE_INTEGER liMove; /* used when skipping chunks */
351 if (pChunk->fccID != DMUS_FOURCC_STYLE_TRACK_LIST) {
352 ERR_(dmfile)(": %s chunk should be a STYLETRACK list\n", debugstr_fourcc (pChunk->fccID));
356 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
360 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
361 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
362 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
363 switch (Chunk.fccID) {
365 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
366 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
367 ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
369 switch (Chunk.fccID) {
370 case DMUS_FOURCC_STYLE_REF_LIST: {
371 TRACE_(dmfile)(": STYLE_REF list\n");
372 hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (iface, &Chunk, pStm);
373 if (FAILED(hr)) return hr;
377 TRACE_(dmfile)(": unknown (skipping)\n");
378 liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
379 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
386 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
387 liMove.QuadPart = Chunk.dwSize;
388 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
392 TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
393 } while (ListCount[0] < ListSize[0]);
398 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
399 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
401 DMUS_PRIVATE_CHUNK Chunk;
402 LARGE_INTEGER liMove;
405 FIXME("(%p, %p): Loading not fully implemented yet\n", This, pStm);
407 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
408 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
409 switch (Chunk.fccID) {
411 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
412 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
413 switch (Chunk.fccID) {
414 case DMUS_FOURCC_STYLE_TRACK_LIST: {
415 TRACE_(dmfile)(": Chord track list\n");
416 hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (iface, &Chunk, pStm);
417 if (FAILED(hr)) return hr;
421 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
422 liMove.QuadPart = Chunk.dwSize;
423 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
427 TRACE_(dmfile)(": reading finished\n");
431 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
432 liMove.QuadPart = Chunk.dwSize;
433 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
441 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
442 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
443 FIXME("(%p): Saving not implemented yet\n", This);
447 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
448 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
449 FIXME("(%p, %p): stub\n", This, pcbSize);
453 static const IPersistStreamVtbl DirectMusicStyleTrack_PersistStream_Vtbl = {
454 IDirectMusicStyleTrack_IPersistStream_QueryInterface,
455 IDirectMusicStyleTrack_IPersistStream_AddRef,
456 IDirectMusicStyleTrack_IPersistStream_Release,
457 IDirectMusicStyleTrack_IPersistStream_GetClassID,
458 IDirectMusicStyleTrack_IPersistStream_IsDirty,
459 IDirectMusicStyleTrack_IPersistStream_Load,
460 IDirectMusicStyleTrack_IPersistStream_Save,
461 IDirectMusicStyleTrack_IPersistStream_GetSizeMax
464 /* for ClassFactory */
465 HRESULT WINAPI DMUSIC_CreateDirectMusicStyleTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
466 IDirectMusicStyleTrack* track;
468 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleTrack));
471 return E_OUTOFMEMORY;
473 track->UnknownVtbl = &DirectMusicStyleTrack_Unknown_Vtbl;
474 track->TrackVtbl = &DirectMusicStyleTrack_Track_Vtbl;
475 track->PersistStreamVtbl = &DirectMusicStyleTrack_PersistStream_Vtbl;
476 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
477 DM_STRUCT_INIT(track->pDesc);
478 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
479 track->pDesc->guidClass = CLSID_DirectMusicStyleTrack;
480 track->ref = 0; /* will be inited by QueryInterface */
481 list_init (&track->Items);
483 return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);