Get rid of the no longer used ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
[wine/multimedia.git] / dlls / dmstyle / chordtrack.c
blobcb0dadf2f181dad3fdcb7fa2f164f15fe5b42260
1 /* IDirectMusicChordTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
4 * Copyright (C) 2003-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 "dmstyle_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
26 /*****************************************************************************
27 * IDirectMusicChordTrack implementation
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);
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;
49 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
50 return E_NOINTERFACE;
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);
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);
66 return ref;
69 IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl = {
70 IDirectMusicChordTrack_IUnknown_QueryInterface,
71 IDirectMusicChordTrack_IUnknown_AddRef,
72 IDirectMusicChordTrack_IUnknown_Release
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);
81 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
82 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
83 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
86 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
87 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
88 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
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;
97 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
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;
104 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
106 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
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)
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;
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;
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;
130 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
131 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
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;
140 TRACE("param unsupported\n");
141 return DMUS_E_TYPE_UNSUPPORTED;
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;
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;
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;
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;
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;
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;
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;
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;
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
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);
219 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
220 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
221 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
224 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
225 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
226 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
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;
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;
242 static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
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 */
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;
254 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
255 ListCount[0] = 0;
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;
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;
275 TRACE_(dmfile)(": Chord track body chunk\n");
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);
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;
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);
303 break;
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;
312 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
313 } while (ListCount[0] < ListSize[0]);
315 return S_OK;
318 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
319 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
321 DMUS_PRIVATE_CHUNK Chunk;
322 LARGE_INTEGER liMove;
323 HRESULT hr;
325 TRACE("(%p, %p): Loading\n", This, pStm);
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;
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;
347 TRACE_(dmfile)(": reading finished\n");
348 break;
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;
358 return S_OK;
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;
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;
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
384 /* for ClassFactory */
385 HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
386 IDirectMusicChordTrack* track;
388 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack));
389 if (NULL == track) {
390 *ppobj = (LPVOID) NULL;
391 return E_OUTOFMEMORY;
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 */
402 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);