Enable creation of the RGB device.
[wine/multimedia.git] / dlls / dmime / tempotrack.c
blob86c73dcb54b2f70c7894fb34953c2744e936b0de
1 /* IDirectMusicTempoTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
4 * Copyright (C) 2004 Raphael Junqueira
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Library General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "dmime_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
26 /*****************************************************************************
27 * IDirectMusicTempoTrack implementation
29 /* IDirectMusicTempoTrack IUnknown part: */
30 HRESULT WINAPI IDirectMusicTempoTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
31 ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
32 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
34 if (IsEqualIID (riid, &IID_IUnknown)) {
35 *ppobj = (LPUNKNOWN)&This->UnknownVtbl;
36 IDirectMusicTempoTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
37 return S_OK;
38 } else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
39 || IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
40 *ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
41 IDirectMusicTempoTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
42 return S_OK;
43 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
44 *ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
45 IDirectMusicTempoTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
46 return S_OK;
49 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
50 return E_NOINTERFACE;
53 ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) {
54 ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
55 TRACE("(%p): AddRef from %ld\n", This, This->ref);
56 return ++(This->ref);
59 ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) {
60 ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
61 ULONG ref = --This->ref;
62 TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
63 if (ref == 0) {
64 HeapFree(GetProcessHeap(), 0, This);
66 return ref;
69 IUnknownVtbl DirectMusicTempoTrack_Unknown_Vtbl = {
70 IDirectMusicTempoTrack_IUnknown_QueryInterface,
71 IDirectMusicTempoTrack_IUnknown_AddRef,
72 IDirectMusicTempoTrack_IUnknown_Release
75 /* IDirectMusicTempoTrack IDirectMusicTrack8 part: */
76 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
77 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
78 return IDirectMusicTempoTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
81 ULONG WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
82 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
83 return IDirectMusicTempoTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
86 ULONG WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
87 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
88 return IDirectMusicTempoTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
91 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment)
93 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
94 TRACE("(%p, %p): nothing to do here\n", This, pSegment);
95 return S_OK;
98 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
100 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
102 LPDMUS_PRIVATE_TEMPO_PLAY_STATE pState = NULL;
104 FIXME("(%p, %p, %p, %p, %ld, %ld): semi-stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
106 pState = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_TEMPO_PLAY_STATE));
107 if (NULL == pState) {
108 ERR(": no more memory\n");
109 return E_OUTOFMEMORY;
111 /** TODO real fill usefull datas */
112 pState->dummy = 0;
113 *ppStateData = pState;
114 return S_OK;
117 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
119 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
121 LPDMUS_PRIVATE_TEMPO_PLAY_STATE pState = pStateData;
123 FIXME("(%p, %p): semi-stub\n", This, pStateData);
125 if (NULL == pStateData) {
126 return E_POINTER;
128 /** TODO real clean up */
129 HeapFree(GetProcessHeap(), 0, pState);
130 return S_OK;
133 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
135 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
136 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
137 /** should use IDirectMusicPerformance_SendPMsg here */
138 return S_OK;
141 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
142 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
144 HRESULT hr = S_OK;
145 struct list* pEntry = NULL;
146 LPDMUS_PRIVATE_TEMPO_ITEM pIt = NULL;
147 DMUS_TEMPO_PARAM* prm = pParam;
149 FIXME("(%p, %s, %ld, %p, %p): almost stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
151 if (NULL == pParam) {
152 return E_POINTER;
155 hr = IDirectMusicTempoTrack_IDirectMusicTrack_IsParamSupported (iface, rguidType);
156 if (FAILED(hr)) {
157 return hr;
159 if (FALSE == This->enabled) {
160 return DMUS_E_TYPE_DISABLED;
163 if (NULL != pmtNext) *pmtNext = 0;
164 prm->mtTime = 0;
165 prm->dblTempo = 0.123456;
167 LIST_FOR_EACH (pEntry, &This->Items) {
168 pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_TEMPO_ITEM, entry);
169 /*TRACE(" - %p -> 0x%lx,%p\n", pIt, pIt->item.lTime, pIt->item.dblTempo);*/
170 if (pIt->item.lTime <= mtTime) {
171 MUSIC_TIME ofs = pIt->item.lTime - mtTime;
172 if (ofs > prm->mtTime) {
173 prm->mtTime = ofs;
174 prm->dblTempo = pIt->item.dblTempo;
176 if (NULL != pmtNext && pIt->item.lTime > mtTime) {
177 if (pIt->item.lTime < *pmtNext) {
178 *pmtNext = pIt->item.lTime;
184 if (0.123456 == prm->dblTempo) {
185 return DMUS_E_NOT_FOUND;
187 return S_OK;
190 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
191 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
192 FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
193 return S_OK;
196 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
197 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
199 TRACE("(%p, %s): ", This, debugstr_dmguid(rguidType));
200 if (IsEqualGUID (rguidType, &GUID_DisableTempo)
201 || IsEqualGUID (rguidType, &GUID_EnableTempo)
202 || IsEqualGUID (rguidType, &GUID_TempoParam)) {
203 TRACE("param supported\n");
204 return S_OK;
206 if (FALSE == This->enabled) {
207 return DMUS_E_TYPE_DISABLED;
209 TRACE("param unsupported\n");
210 return DMUS_E_TYPE_UNSUPPORTED;
213 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
214 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
215 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
216 return S_OK;
219 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
220 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
221 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
222 return S_OK;
225 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
226 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
227 FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
228 return S_OK;
231 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
232 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
233 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
234 return S_OK;
237 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
238 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
239 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
240 return S_OK;
243 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
244 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
245 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
246 return S_OK;
249 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
250 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
251 FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
252 return S_OK;
255 HRESULT WINAPI IDirectMusicTempoTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
256 ICOM_THIS_MULTI(IDirectMusicTempoTrack, TrackVtbl, iface);
257 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
258 return S_OK;
261 IDirectMusicTrack8Vtbl DirectMusicTempoTrack_Track_Vtbl = {
262 IDirectMusicTempoTrack_IDirectMusicTrack_QueryInterface,
263 IDirectMusicTempoTrack_IDirectMusicTrack_AddRef,
264 IDirectMusicTempoTrack_IDirectMusicTrack_Release,
265 IDirectMusicTempoTrack_IDirectMusicTrack_Init,
266 IDirectMusicTempoTrack_IDirectMusicTrack_InitPlay,
267 IDirectMusicTempoTrack_IDirectMusicTrack_EndPlay,
268 IDirectMusicTempoTrack_IDirectMusicTrack_Play,
269 IDirectMusicTempoTrack_IDirectMusicTrack_GetParam,
270 IDirectMusicTempoTrack_IDirectMusicTrack_SetParam,
271 IDirectMusicTempoTrack_IDirectMusicTrack_IsParamSupported,
272 IDirectMusicTempoTrack_IDirectMusicTrack_AddNotificationType,
273 IDirectMusicTempoTrack_IDirectMusicTrack_RemoveNotificationType,
274 IDirectMusicTempoTrack_IDirectMusicTrack_Clone,
275 IDirectMusicTempoTrack_IDirectMusicTrack_PlayEx,
276 IDirectMusicTempoTrack_IDirectMusicTrack_GetParamEx,
277 IDirectMusicTempoTrack_IDirectMusicTrack_SetParamEx,
278 IDirectMusicTempoTrack_IDirectMusicTrack_Compose,
279 IDirectMusicTempoTrack_IDirectMusicTrack_Join
282 /* IDirectMusicTempoTrack IPersistStream part: */
283 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
284 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
285 return IDirectMusicTempoTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
288 ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
289 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
290 return IDirectMusicTempoTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
293 ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
294 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
295 return IDirectMusicTempoTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
298 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
299 ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
300 TRACE("(%p, %p)\n", This, pClassID);
301 memcpy(pClassID, &CLSID_DirectMusicTempoTrack, sizeof(CLSID));
302 return S_OK;
305 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
306 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
307 FIXME("(%p): stub, always S_FALSE\n", This);
308 return S_FALSE;
311 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
312 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
313 DMUS_PRIVATE_CHUNK Chunk;
314 DWORD StreamSize, StreamCount;
315 LARGE_INTEGER liMove;
316 DMUS_IO_TEMPO_ITEM item;
317 LPDMUS_PRIVATE_TEMPO_ITEM pNewItem = NULL;
318 DWORD nItem = 0;
319 FIXME("(%p, %p): Loading not fully implemented yet\n", This, pStm);
321 #if 1
322 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
323 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
324 switch (Chunk.fccID) {
325 case DMUS_FOURCC_TEMPO_TRACK: {
326 TRACE_(dmfile)(": Tempo track\n");
327 #if 1
328 IStream_Read (pStm, &StreamSize, sizeof(DWORD), NULL);
329 StreamSize -= sizeof(DWORD);
330 StreamCount = 0;
331 TRACE_(dmfile)(" - sizeof(DMUS_IO_TEMPO_ITEM): %lu (chunkSize = %lu)\n", StreamSize, Chunk.dwSize - sizeof(DWORD));
332 do {
333 IStream_Read (pStm, &item, sizeof(item), NULL);
334 ++nItem;
335 TRACE_(dmfile)("DMUS_IO_TEMPO_ITEM #%ld\n", nItem);
336 TRACE_(dmfile)(" - lTime = %lu\n", item.lTime);
337 TRACE_(dmfile)(" - dblTempo = %g\n", item.dblTempo);
338 pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_TEMPO_ITEM));
339 if (NULL == pNewItem) {
340 ERR(": no more memory\n");
341 return E_OUTOFMEMORY;
343 memcpy(&pNewItem->item, &item, sizeof(DMUS_IO_TEMPO_ITEM));
344 list_add_tail (&This->Items, &pNewItem->entry);
345 pNewItem = NULL;
346 StreamCount += sizeof(item);
347 TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
348 } while (StreamCount < StreamSize);
349 #else
350 liMove.QuadPart = Chunk.dwSize;
351 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
352 #endif
353 break;
355 default: {
356 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
357 liMove.QuadPart = Chunk.dwSize;
358 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
359 return E_FAIL;
362 #endif
364 return S_OK;
367 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
368 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
369 FIXME("(%p): Saving not implemented yet\n", This);
370 return E_NOTIMPL;
373 HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
374 ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface);
375 FIXME("(%p, %p): stub\n", This, pcbSize);
376 return E_NOTIMPL;
379 IPersistStreamVtbl DirectMusicTempoTrack_PersistStream_Vtbl = {
380 IDirectMusicTempoTrack_IPersistStream_QueryInterface,
381 IDirectMusicTempoTrack_IPersistStream_AddRef,
382 IDirectMusicTempoTrack_IPersistStream_Release,
383 IDirectMusicTempoTrack_IPersistStream_GetClassID,
384 IDirectMusicTempoTrack_IPersistStream_IsDirty,
385 IDirectMusicTempoTrack_IPersistStream_Load,
386 IDirectMusicTempoTrack_IPersistStream_Save,
387 IDirectMusicTempoTrack_IPersistStream_GetSizeMax
390 /* for ClassFactory */
391 HRESULT WINAPI DMUSIC_CreateDirectMusicTempoTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
392 IDirectMusicTempoTrack* track;
394 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTempoTrack));
395 if (NULL == track) {
396 *ppobj = (LPVOID) NULL;
397 return E_OUTOFMEMORY;
399 track->UnknownVtbl = &DirectMusicTempoTrack_Unknown_Vtbl;
400 track->TrackVtbl = &DirectMusicTempoTrack_Track_Vtbl;
401 track->PersistStreamVtbl = &DirectMusicTempoTrack_PersistStream_Vtbl;
402 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
403 DM_STRUCT_INIT(track->pDesc);
404 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
405 memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicTempoTrack, sizeof (CLSID));
406 track->ref = 0; /* will be inited by QueryInterface */
407 track->enabled = TRUE;
408 list_init (&track->Items);
410 return IDirectMusicTempoTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);