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