- use Interlocked* functions in AddRef and Release.
[wine/gsoc_dplay.git] / dlls / dmstyle / chordtrack.c
blobf5c9387dac39cdcafb06284f70ee4cf56aed3d51
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 ULONG ref = InterlockedIncrement(&This->ref);
57 TRACE("(%p): AddRef from %ld\n", This, ref - 1);
59 return ref;
62 ULONG WINAPI IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface) {
63 ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
64 ULONG ref = InterlockedDecrement(&This->ref);
66 TRACE("(%p): ReleaseRef to %ld\n", This, ref);
68 if (ref == 0) {
69 HeapFree(GetProcessHeap(), 0, This);
71 return ref;
74 IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl = {
75 IDirectMusicChordTrack_IUnknown_QueryInterface,
76 IDirectMusicChordTrack_IUnknown_AddRef,
77 IDirectMusicChordTrack_IUnknown_Release
80 /* IDirectMusicChordTrack IDirectMusicTrack8 part: */
81 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
82 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
83 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
86 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
87 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
88 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
91 ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
92 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
93 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
96 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) {
97 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
98 FIXME("(%p, %p): stub\n", This, pSegment);
99 return S_OK;
102 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
104 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
105 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
106 return S_OK;
109 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
111 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
112 FIXME("(%p, %p): stub\n", This, pStateData);
113 return S_OK;
116 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)
118 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
119 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
120 return S_OK;
123 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
124 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
125 FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
126 return S_OK;
129 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
130 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
131 FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
132 return S_OK;
135 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
136 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
138 TRACE("(%p, %s): ", This, debugstr_dmguid(rguidType));
139 if (IsEqualGUID (rguidType, &GUID_BandParam)
140 || IsEqualGUID (rguidType, &GUID_ChordParam)
141 || IsEqualGUID (rguidType, &GUID_RhythmParam)) {
142 TRACE("param supported\n");
143 return S_OK;
145 TRACE("param unsupported\n");
146 return DMUS_E_TYPE_UNSUPPORTED;
149 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
150 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
151 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
152 return S_OK;
155 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
156 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
157 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
158 return S_OK;
161 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
162 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
163 FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
164 return S_OK;
167 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) {
168 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
169 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
170 return S_OK;
173 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
174 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
175 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
176 return S_OK;
179 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
180 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
181 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
182 return S_OK;
185 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
186 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
187 FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
188 return S_OK;
191 HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
192 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
193 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
194 return S_OK;
197 IDirectMusicTrack8Vtbl DirectMusicChordTrack_Track_Vtbl = {
198 IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface,
199 IDirectMusicChordTrack_IDirectMusicTrack_AddRef,
200 IDirectMusicChordTrack_IDirectMusicTrack_Release,
201 IDirectMusicChordTrack_IDirectMusicTrack_Init,
202 IDirectMusicChordTrack_IDirectMusicTrack_InitPlay,
203 IDirectMusicChordTrack_IDirectMusicTrack_EndPlay,
204 IDirectMusicChordTrack_IDirectMusicTrack_Play,
205 IDirectMusicChordTrack_IDirectMusicTrack_GetParam,
206 IDirectMusicChordTrack_IDirectMusicTrack_SetParam,
207 IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported,
208 IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType,
209 IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType,
210 IDirectMusicChordTrack_IDirectMusicTrack_Clone,
211 IDirectMusicChordTrack_IDirectMusicTrack_PlayEx,
212 IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx,
213 IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx,
214 IDirectMusicChordTrack_IDirectMusicTrack_Compose,
215 IDirectMusicChordTrack_IDirectMusicTrack_Join
218 /* IDirectMusicChordTrack IPersistStream part: */
219 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
220 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
221 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
224 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
225 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
226 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
229 ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
230 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
231 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
234 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
235 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
236 TRACE("(%p, %p)\n", This, pClassID);
237 memcpy(pClassID, &CLSID_DirectMusicChordTrack, sizeof(CLSID));
238 return S_OK;
241 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
242 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
243 FIXME("(%p): stub, always S_FALSE\n", This);
244 return S_FALSE;
247 static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
249 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
250 DMUS_PRIVATE_CHUNK Chunk;
251 DWORD ListSize[3], ListCount[3];
252 LARGE_INTEGER liMove; /* used when skipping chunks */
254 if (pChunk->fccID != DMUS_FOURCC_CHORDTRACK_LIST) {
255 ERR_(dmfile)(": %s chunk should be a CHORDTRACK list\n", debugstr_fourcc (pChunk->fccID));
256 return E_FAIL;
259 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
260 ListCount[0] = 0;
262 do {
263 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
264 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
265 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
266 switch (Chunk.fccID) {
267 case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK: {
268 TRACE_(dmfile)(": Chord track header chunk\n");
269 IStream_Read (pStm, &This->dwScale, sizeof(DWORD), NULL);
270 TRACE_(dmfile)(" - dwScale: %ld\n", This->dwScale);
271 break;
273 case DMUS_FOURCC_CHORDTRACKBODY_CHUNK: {
274 DWORD sz;
275 DWORD it;
276 DWORD num;
277 DMUS_IO_CHORD body;
278 DMUS_IO_SUBCHORD subchords;
280 TRACE_(dmfile)(": Chord track body chunk\n");
282 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
283 TRACE_(dmfile)(" - sizeof(DMUS_IO_CHORD): %ld\n", sz);
284 if (sz != sizeof(DMUS_IO_CHORD)) return E_FAIL;
285 IStream_Read (pStm, &body, sizeof(DMUS_IO_CHORD), NULL);
286 TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(body.wszName));
287 TRACE_(dmfile)(" - mtTime: %lu\n", body.mtTime);
288 TRACE_(dmfile)(" - wMeasure: %u\n", body.wMeasure);
289 TRACE_(dmfile)(" - bBeat: %u\n", body.bBeat);
290 TRACE_(dmfile)(" - bFlags: 0x%02x\n", body.bFlags);
292 IStream_Read (pStm, &num, sizeof(DWORD), NULL);
293 TRACE_(dmfile)(" - # DMUS_IO_SUBCHORDS: %ld\n", num);
294 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
295 TRACE_(dmfile)(" - sizeof(DMUS_IO_SUBCHORDS): %ld\n", sz);
296 if (sz != sizeof(DMUS_IO_SUBCHORD)) return E_FAIL;
298 for (it = 0; it < num; ++it) {
299 IStream_Read (pStm, &subchords, sizeof(DMUS_IO_SUBCHORD), NULL);
300 TRACE_(dmfile)("DMUS_IO_SUBCHORD #%ld\n", it+1);
301 TRACE_(dmfile)(" - dwChordPattern: %lu\n", subchords.dwChordPattern);
302 TRACE_(dmfile)(" - dwScalePattern: %lu\n", subchords.dwScalePattern);
303 TRACE_(dmfile)(" - dwInversionPoints: %lu\n", subchords.dwInversionPoints);
304 TRACE_(dmfile)(" - dwLevels: %lu\n", subchords.dwLevels);
305 TRACE_(dmfile)(" - bChordRoot: %u\n", subchords.bChordRoot);
306 TRACE_(dmfile)(" - bScaleRoot: %u\n", subchords.bScaleRoot);
308 break;
310 default: {
311 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
312 liMove.QuadPart = Chunk.dwSize;
313 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
314 break;
317 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
318 } while (ListCount[0] < ListSize[0]);
320 return S_OK;
323 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
324 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
326 DMUS_PRIVATE_CHUNK Chunk;
327 LARGE_INTEGER liMove;
328 HRESULT hr;
330 TRACE("(%p, %p): Loading\n", This, pStm);
332 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
333 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
334 switch (Chunk.fccID) {
335 case FOURCC_LIST: {
336 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
337 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
338 switch (Chunk.fccID) {
339 case DMUS_FOURCC_CHORDTRACK_LIST: {
340 TRACE_(dmfile)(": Chord track list\n");
341 hr = IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface, &Chunk, pStm);
342 if (FAILED(hr)) return hr;
343 break;
345 default: {
346 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
347 liMove.QuadPart = Chunk.dwSize;
348 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
349 return E_FAIL;
352 TRACE_(dmfile)(": reading finished\n");
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); /* skip the rest of the chunk */
359 return E_FAIL;
363 return S_OK;
366 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
367 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
368 FIXME("(%p): Saving not implemented yet\n", This);
369 return E_NOTIMPL;
372 HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
373 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
374 FIXME("(%p, %p): stub\n", This, pcbSize);
375 return E_NOTIMPL;
378 IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = {
379 IDirectMusicChordTrack_IPersistStream_QueryInterface,
380 IDirectMusicChordTrack_IPersistStream_AddRef,
381 IDirectMusicChordTrack_IPersistStream_Release,
382 IDirectMusicChordTrack_IPersistStream_GetClassID,
383 IDirectMusicChordTrack_IPersistStream_IsDirty,
384 IDirectMusicChordTrack_IPersistStream_Load,
385 IDirectMusicChordTrack_IPersistStream_Save,
386 IDirectMusicChordTrack_IPersistStream_GetSizeMax
389 /* for ClassFactory */
390 HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
391 IDirectMusicChordTrack* track;
393 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack));
394 if (NULL == track) {
395 *ppobj = NULL;
396 return E_OUTOFMEMORY;
398 track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl;
399 track->TrackVtbl = &DirectMusicChordTrack_Track_Vtbl;
400 track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl;
401 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
402 DM_STRUCT_INIT(track->pDesc);
403 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
404 memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicChordTrack, sizeof (CLSID));
405 track->ref = 0; /* will be inited by QueryInterface */
407 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);