Avoid warnings.
[wine] / dlls / dmstyle / chordtrack.c
1 /* IDirectMusicChordTrack Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  * Copyright (C) 2003-2004 Raphael Junqueira
5  *
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.
10  *
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.
15  *
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.
19  */
20
21 #include "dmstyle_private.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
25
26 /*****************************************************************************
27  * IDirectMusicChordTrack implementation
28  */
29 /* IDirectMusicChordTrack IUnknown part: */
30 HRESULT WINAPI IDirectMusicChordTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
31         ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
32         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
33
34         if (IsEqualIID (riid, &IID_IUnknown)) {
35                 *ppobj = (LPUNKNOWN)&This->UnknownVtbl;
36                 IDirectMusicChordTrack_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                 IDirectMusicChordTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
42                 return S_OK;
43         } else if (IsEqualIID (riid, &IID_IPersistStream)) {
44                 *ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
45                 IDirectMusicChordTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
46                 return S_OK;
47         }
48         
49         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
50         return E_NOINTERFACE;
51 }
52
53 ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface) {
54         ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
55         TRACE("(%p): AddRef from %ld\n", This, This->ref);
56         return ++(This->ref);
57 }
58
59 ULONG WINAPI IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface) {
60         ICOM_THIS_MULTI(IDirectMusicChordTrack, 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);
65         }
66         return ref;
67 }
68
69 IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl = {
70   IDirectMusicChordTrack_IUnknown_QueryInterface,
71   IDirectMusicChordTrack_IUnknown_AddRef,
72   IDirectMusicChordTrack_IUnknown_Release
73 };
74
75 /* IDirectMusicChordTrack IDirectMusicTrack8 part: */
76 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
77   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
78   return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
79 }
80
81 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
82   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
83   return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
84 }
85
86 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
87   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
88   return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
89 }
90
91 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) {
92   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
93   FIXME("(%p, %p): stub\n", This, pSegment);
94   return S_OK;
95 }
96
97 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
98 {
99   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
100   FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
101   return S_OK;
102 }
103
104 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
105 {
106   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
107   FIXME("(%p, %p): stub\n", This, pStateData);
108   return S_OK;
109 }
110
111 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
112 {
113   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
114   FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
115   return S_OK;
116 }
117
118 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
119   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
120   FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
121   return S_OK;
122 }
123
124 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
125   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
126   FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
127   return S_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
131   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
132   
133   TRACE("(%p, %s): ", This, debugstr_dmguid(rguidType));
134   if (IsEqualGUID (rguidType, &GUID_BandParam)
135       || IsEqualGUID (rguidType, &GUID_ChordParam)
136       || IsEqualGUID (rguidType, &GUID_RhythmParam)) {
137     TRACE("param supported\n");
138     return S_OK;
139   }
140   TRACE("param unsupported\n");
141   return DMUS_E_TYPE_UNSUPPORTED;
142 }
143
144 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
145   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
146   FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
147   return S_OK;
148 }
149
150 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
151   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
152   FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
153   return S_OK;
154 }
155
156 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
157   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
158   FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
159   return S_OK;
160 }
161
162 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
163   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
164   FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
165   return S_OK;
166 }
167
168 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
169   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
170   FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
171   return S_OK;
172 }
173
174 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
175   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
176   FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
177   return S_OK;
178 }
179
180 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
181   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
182   FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
183   return S_OK;
184 }
185
186 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
187   ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
188   FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
189   return S_OK;
190 }
191
192 IDirectMusicTrack8Vtbl DirectMusicChordTrack_Track_Vtbl = {
193   IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface,
194   IDirectMusicChordTrack_IDirectMusicTrack_AddRef,
195   IDirectMusicChordTrack_IDirectMusicTrack_Release,
196   IDirectMusicChordTrack_IDirectMusicTrack_Init,
197   IDirectMusicChordTrack_IDirectMusicTrack_InitPlay,
198   IDirectMusicChordTrack_IDirectMusicTrack_EndPlay,
199   IDirectMusicChordTrack_IDirectMusicTrack_Play,
200   IDirectMusicChordTrack_IDirectMusicTrack_GetParam,
201   IDirectMusicChordTrack_IDirectMusicTrack_SetParam,
202   IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported,
203   IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType,
204   IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType,
205   IDirectMusicChordTrack_IDirectMusicTrack_Clone,
206   IDirectMusicChordTrack_IDirectMusicTrack_PlayEx,
207   IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx,
208   IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx,
209   IDirectMusicChordTrack_IDirectMusicTrack_Compose,
210   IDirectMusicChordTrack_IDirectMusicTrack_Join
211 };
212
213 /* IDirectMusicChordTrack IPersistStream part: */
214 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
215   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
216   return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
217 }
218
219 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
220   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
221   return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
222 }
223
224 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
225   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
226   return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
227 }
228
229 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
230   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
231   TRACE("(%p, %p)\n", This, pClassID);
232   memcpy(pClassID, &CLSID_DirectMusicChordTrack, sizeof(CLSID));
233   return S_OK;
234 }
235
236 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
237   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
238   FIXME("(%p): stub, always S_FALSE\n", This);
239   return S_FALSE;
240 }
241
242 static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
243
244   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
245   DMUS_PRIVATE_CHUNK Chunk;
246   DWORD ListSize[3], ListCount[3];
247   LARGE_INTEGER liMove; /* used when skipping chunks */
248
249   if (pChunk->fccID != DMUS_FOURCC_CHORDTRACK_LIST) {
250     ERR_(dmfile)(": %s chunk should be a CHORDTRACK list\n", debugstr_fourcc (pChunk->fccID));
251     return E_FAIL;
252   }  
253
254   ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
255   ListCount[0] = 0;
256
257   do {
258     IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
259     ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
260     TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
261     switch (Chunk.fccID) { 
262     case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK: {
263       TRACE_(dmfile)(": Chord track header chunk\n");
264       IStream_Read (pStm, &This->dwScale, sizeof(DWORD), NULL);
265       TRACE_(dmfile)(" - dwScale: %ld\n", This->dwScale);
266       break;
267     }
268     case DMUS_FOURCC_CHORDTRACKBODY_CHUNK: {
269       DWORD sz;
270       DWORD it;
271       DWORD num;
272       DMUS_IO_CHORD body;
273       DMUS_IO_SUBCHORD subchords;
274
275       TRACE_(dmfile)(": Chord track body chunk\n");
276
277       IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
278       TRACE_(dmfile)(" - sizeof(DMUS_IO_CHORD): %ld\n", sz);
279       if (sz != sizeof(DMUS_IO_CHORD)) return E_FAIL;
280       IStream_Read (pStm, &body, sizeof(DMUS_IO_CHORD), NULL);
281       TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(body.wszName));
282       TRACE_(dmfile)(" - mtTime: %lu\n", body.mtTime);
283       TRACE_(dmfile)(" - wMeasure: %u\n", body.wMeasure);
284       TRACE_(dmfile)(" - bBeat:  %u\n", body.bBeat);
285       TRACE_(dmfile)(" - bFlags: 0x%02x\n", body.bFlags);
286       
287       IStream_Read (pStm, &num, sizeof(DWORD), NULL);
288       TRACE_(dmfile)(" - # DMUS_IO_SUBCHORDS: %ld\n", num);
289       IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
290       TRACE_(dmfile)(" - sizeof(DMUS_IO_SUBCHORDS): %ld\n", sz);
291       if (sz != sizeof(DMUS_IO_SUBCHORD)) return E_FAIL;
292
293       for (it = 0; it < num; ++it) {
294         IStream_Read (pStm, &subchords, sizeof(DMUS_IO_SUBCHORD), NULL);
295         TRACE_(dmfile)("DMUS_IO_SUBCHORD #%ld\n", it+1);
296         TRACE_(dmfile)(" - dwChordPattern: %lu\n", subchords.dwChordPattern);
297         TRACE_(dmfile)(" - dwScalePattern: %lu\n", subchords.dwScalePattern);
298         TRACE_(dmfile)(" - dwInversionPoints: %lu\n", subchords.dwInversionPoints);
299         TRACE_(dmfile)(" - dwLevels: %lu\n", subchords.dwLevels);
300         TRACE_(dmfile)(" - bChordRoot:  %u\n", subchords.bChordRoot);
301         TRACE_(dmfile)(" - bScaleRoot: %u\n", subchords.bScaleRoot);
302       }
303       break;
304     }
305     default: {
306       TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
307       liMove.QuadPart = Chunk.dwSize;
308       IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
309       break;            
310     }
311     }
312     TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
313   } while (ListCount[0] < ListSize[0]);
314
315   return S_OK;
316 }
317
318 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
319   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
320  
321   DMUS_PRIVATE_CHUNK Chunk;
322   LARGE_INTEGER liMove;
323   HRESULT hr;
324  
325   TRACE("(%p, %p): Loading\n", This, pStm);
326
327   IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
328   TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
329   switch (Chunk.fccID) {        
330   case FOURCC_LIST: {
331     IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
332     TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
333     switch (Chunk.fccID) { 
334     case DMUS_FOURCC_CHORDTRACK_LIST: {
335       TRACE_(dmfile)(": Chord track list\n");
336       hr = IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface, &Chunk, pStm);
337       if (FAILED(hr)) return hr;
338       break;    
339     }
340     default: {
341       TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
342       liMove.QuadPart = Chunk.dwSize;
343       IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
344       return E_FAIL;
345     }
346     }
347     TRACE_(dmfile)(": reading finished\n");
348     break;
349   }
350   default: {
351     TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
352     liMove.QuadPart = Chunk.dwSize;
353     IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
354     return E_FAIL;
355   }
356   }
357
358   return S_OK;
359 }
360
361 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
362   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
363   FIXME("(%p): Saving not implemented yet\n", This);
364   return E_NOTIMPL;
365 }
366
367 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
368   ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
369   FIXME("(%p, %p): stub\n", This, pcbSize);
370   return E_NOTIMPL;
371 }
372
373 IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = {
374   IDirectMusicChordTrack_IPersistStream_QueryInterface,
375   IDirectMusicChordTrack_IPersistStream_AddRef,
376   IDirectMusicChordTrack_IPersistStream_Release,
377   IDirectMusicChordTrack_IPersistStream_GetClassID,
378   IDirectMusicChordTrack_IPersistStream_IsDirty,
379   IDirectMusicChordTrack_IPersistStream_Load,
380   IDirectMusicChordTrack_IPersistStream_Save,
381   IDirectMusicChordTrack_IPersistStream_GetSizeMax
382 };
383
384 /* for ClassFactory */
385 HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
386   IDirectMusicChordTrack* track;
387   
388   track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack));
389   if (NULL == track) {
390     *ppobj = NULL;
391     return E_OUTOFMEMORY;
392   }
393   track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl;
394   track->TrackVtbl = &DirectMusicChordTrack_Track_Vtbl;
395   track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl;
396   track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
397   DM_STRUCT_INIT(track->pDesc);
398   track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
399   memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicChordTrack, sizeof (CLSID));
400   track->ref = 0; /* will be inited by QueryInterface */
401   
402   return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
403 }