1 /* IDirectMusicStyleTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * 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 %ld\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 %ld\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, %ld, %ld): 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, %ld, %p, %p, %ld): 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): ", 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, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
184 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
185 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
186 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
190 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
191 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
192 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
196 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
197 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
198 FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
202 static HRESULT WINAPI IDirectMusicStyleTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
203 ICOM_THIS_MULTI(IDirectMusicStyleTrack, TrackVtbl, iface);
204 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
208 static const IDirectMusicTrack8Vtbl DirectMusicStyleTrack_Track_Vtbl = {
209 IDirectMusicStyleTrack_IDirectMusicTrack_QueryInterface,
210 IDirectMusicStyleTrack_IDirectMusicTrack_AddRef,
211 IDirectMusicStyleTrack_IDirectMusicTrack_Release,
212 IDirectMusicStyleTrack_IDirectMusicTrack_Init,
213 IDirectMusicStyleTrack_IDirectMusicTrack_InitPlay,
214 IDirectMusicStyleTrack_IDirectMusicTrack_EndPlay,
215 IDirectMusicStyleTrack_IDirectMusicTrack_Play,
216 IDirectMusicStyleTrack_IDirectMusicTrack_GetParam,
217 IDirectMusicStyleTrack_IDirectMusicTrack_SetParam,
218 IDirectMusicStyleTrack_IDirectMusicTrack_IsParamSupported,
219 IDirectMusicStyleTrack_IDirectMusicTrack_AddNotificationType,
220 IDirectMusicStyleTrack_IDirectMusicTrack_RemoveNotificationType,
221 IDirectMusicStyleTrack_IDirectMusicTrack_Clone,
222 IDirectMusicStyleTrack_IDirectMusicTrack_PlayEx,
223 IDirectMusicStyleTrack_IDirectMusicTrack_GetParamEx,
224 IDirectMusicStyleTrack_IDirectMusicTrack_SetParamEx,
225 IDirectMusicStyleTrack_IDirectMusicTrack_Compose,
226 IDirectMusicStyleTrack_IDirectMusicTrack_Join
229 /* IDirectMusicStyleTrack IPersistStream part: */
230 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
231 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
232 return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
235 static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
236 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
237 return IDirectMusicStyleTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
240 static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
241 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
242 return IDirectMusicStyleTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
245 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
246 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
247 TRACE("(%p, %p)\n", This, pClassID);
248 memcpy(pClassID, &CLSID_DirectMusicStyleTrack, sizeof(CLSID));
252 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
253 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
254 FIXME("(%p): stub, always S_FALSE\n", This);
258 static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
259 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
260 DMUS_PRIVATE_CHUNK Chunk;
261 DWORD ListSize[3], ListCount[3];
262 LARGE_INTEGER liMove; /* used when skipping chunks */
265 IDirectMusicObject* pObject = NULL;
266 LPDMUS_PRIVATE_STYLE_ITEM pNewItem = NULL;
268 if (pChunk->fccID != DMUS_FOURCC_STYLE_REF_LIST) {
269 ERR_(dmfile)(": %s chunk should be a STYLE list\n", debugstr_fourcc (pChunk->fccID));
273 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
277 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
278 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
279 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
280 switch (Chunk.fccID) {
281 case DMUS_FOURCC_TIME_STAMP_CHUNK: {
282 TRACE_(dmfile)(": Time Stamp chunck\n");
283 pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_ITEM));
284 if (NULL == pNewItem) {
285 ERR(": no more memory\n");
286 return E_OUTOFMEMORY;
288 IStream_Read (pStm, &pNewItem->dwTimeStamp, sizeof(DWORD), NULL);
289 TRACE_(dmfile)(" - dwTimeStamp: %lu\n", pNewItem->dwTimeStamp);
290 list_add_tail (&This->Items, &pNewItem->entry);
294 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
295 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
296 ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
298 switch (Chunk.fccID) {
300 * should be a DMRF (DirectMusic Reference) list @TODO
302 case DMUS_FOURCC_REF_LIST: {
303 FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n");
304 hr = IDirectMusicUtils_IPersistStream_ParseReference (iface, &Chunk, pStm, &pObject);
306 ERR(": could not load Reference\n");
309 hr = IDirectMusicObject_QueryInterface(pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pNewItem->pObject);
311 ERR(": Reference not an IDirectMusicStyle, exiting\n");
315 IDirectMusicObject_Release(pObject);
319 TRACE_(dmfile)(": unknown (skipping)\n");
320 liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
321 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
328 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
329 liMove.QuadPart = Chunk.dwSize;
330 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
334 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
335 } while (ListCount[0] < ListSize[0]);
340 static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
342 /*ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);*/
343 DMUS_PRIVATE_CHUNK Chunk;
344 DWORD ListSize[3], ListCount[3];
345 LARGE_INTEGER liMove; /* used when skipping chunks */
348 if (pChunk->fccID != DMUS_FOURCC_STYLE_TRACK_LIST) {
349 ERR_(dmfile)(": %s chunk should be a STYLETRACK list\n", debugstr_fourcc (pChunk->fccID));
353 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
357 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
358 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
359 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
360 switch (Chunk.fccID) {
362 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
363 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
364 ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
366 switch (Chunk.fccID) {
367 case DMUS_FOURCC_STYLE_REF_LIST: {
368 TRACE_(dmfile)(": STYLE_REF list\n");
369 hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (iface, &Chunk, pStm);
370 if (FAILED(hr)) return hr;
374 TRACE_(dmfile)(": unknown (skipping)\n");
375 liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
376 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
383 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
384 liMove.QuadPart = Chunk.dwSize;
385 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
389 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
390 } while (ListCount[0] < ListSize[0]);
395 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
396 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
398 DMUS_PRIVATE_CHUNK Chunk;
399 LARGE_INTEGER liMove;
402 FIXME("(%p, %p): Loading not fully implemented yet\n", This, pStm);
404 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
405 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
406 switch (Chunk.fccID) {
408 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
409 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
410 switch (Chunk.fccID) {
411 case DMUS_FOURCC_STYLE_TRACK_LIST: {
412 TRACE_(dmfile)(": Chord track list\n");
413 hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (iface, &Chunk, pStm);
414 if (FAILED(hr)) return hr;
418 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
419 liMove.QuadPart = Chunk.dwSize;
420 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
424 TRACE_(dmfile)(": reading finished\n");
428 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
429 liMove.QuadPart = Chunk.dwSize;
430 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
438 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
439 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
440 FIXME("(%p): Saving not implemented yet\n", This);
444 static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
445 ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
446 FIXME("(%p, %p): stub\n", This, pcbSize);
450 static const IPersistStreamVtbl DirectMusicStyleTrack_PersistStream_Vtbl = {
451 IDirectMusicStyleTrack_IPersistStream_QueryInterface,
452 IDirectMusicStyleTrack_IPersistStream_AddRef,
453 IDirectMusicStyleTrack_IPersistStream_Release,
454 IDirectMusicStyleTrack_IPersistStream_GetClassID,
455 IDirectMusicStyleTrack_IPersistStream_IsDirty,
456 IDirectMusicStyleTrack_IPersistStream_Load,
457 IDirectMusicStyleTrack_IPersistStream_Save,
458 IDirectMusicStyleTrack_IPersistStream_GetSizeMax
461 /* for ClassFactory */
462 HRESULT WINAPI DMUSIC_CreateDirectMusicStyleTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
463 IDirectMusicStyleTrack* track;
465 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleTrack));
468 return E_OUTOFMEMORY;
470 track->UnknownVtbl = &DirectMusicStyleTrack_Unknown_Vtbl;
471 track->TrackVtbl = &DirectMusicStyleTrack_Track_Vtbl;
472 track->PersistStreamVtbl = &DirectMusicStyleTrack_PersistStream_Vtbl;
473 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
474 DM_STRUCT_INIT(track->pDesc);
475 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
476 memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicStyleTrack, sizeof (CLSID));
477 track->ref = 0; /* will be inited by QueryInterface */
478 list_init (&track->Items);
480 return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);