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
);
38 } else if (IsEqualIID (riid
, &IID_IDirectMusicTrack
)
39 || IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
40 *ppobj
= (LPDIRECTMUSICTRACK8
)&This
->TrackVtbl
;
41 IDirectMusicChordTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8
)&This
->TrackVtbl
);
43 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
44 *ppobj
= (LPPERSISTSTREAM
)&This
->PersistStreamVtbl
;
45 IDirectMusicChordTrack_IPersistStream_AddRef ((LPPERSISTSTREAM
)&This
->PersistStreamVtbl
);
49 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
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);
64 ULONG WINAPI
IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface
) {
65 ICOM_THIS_MULTI(IDirectMusicChordTrack
, UnknownVtbl
, iface
);
66 ULONG ref
= InterlockedDecrement(&This
->ref
);
68 TRACE("(%p): ReleaseRef to %ld\n", This
, ref
);
71 HeapFree(GetProcessHeap(), 0, This
);
74 DMSTYLE_UnlockModule();
79 IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl
= {
80 IDirectMusicChordTrack_IUnknown_QueryInterface
,
81 IDirectMusicChordTrack_IUnknown_AddRef
,
82 IDirectMusicChordTrack_IUnknown_Release
85 /* IDirectMusicChordTrack IDirectMusicTrack8 part: */
86 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface
, REFIID riid
, LPVOID
*ppobj
) {
87 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
88 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
91 ULONG WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface
) {
92 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
93 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
96 ULONG WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface
) {
97 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
98 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
101 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegment
* pSegment
) {
102 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
103 FIXME("(%p, %p): stub\n", This
, pSegment
);
107 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegmentState
* pSegmentState
, IDirectMusicPerformance
* pPerformance
, void** ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
109 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
110 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
114 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface
, void* pStateData
)
116 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
117 FIXME("(%p, %p): stub\n", This
, pStateData
);
121 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
)
123 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
124 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
128 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
) {
129 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
130 FIXME("(%p, %s, %ld, %p, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pmtNext
, pParam
);
134 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, void* pParam
) {
135 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
136 FIXME("(%p, %s, %ld, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pParam
);
140 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
) {
141 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
143 TRACE("(%p, %s): ", This
, debugstr_dmguid(rguidType
));
144 if (IsEqualGUID (rguidType
, &GUID_BandParam
)
145 || IsEqualGUID (rguidType
, &GUID_ChordParam
)
146 || IsEqualGUID (rguidType
, &GUID_RhythmParam
)) {
147 TRACE("param supported\n");
150 TRACE("param unsupported\n");
151 return DMUS_E_TYPE_UNSUPPORTED
;
154 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
) {
155 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
156 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
160 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
) {
161 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
162 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
166 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, IDirectMusicTrack
** ppTrack
) {
167 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
168 FIXME("(%p, %ld, %ld, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
172 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
) {
173 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
174 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This
, pStateData
, rtStart
, rtEnd
, rtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
178 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
* prtNext
, void* pParam
, void* pStateData
, DWORD dwFlags
) {
179 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
180 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This
, debugstr_dmguid(rguidType
), rtTime
, prtNext
, pParam
, pStateData
, dwFlags
);
184 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, void* pParam
, void* pStateData
, DWORD dwFlags
) {
185 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
186 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This
, debugstr_dmguid(rguidType
), rtTime
, pParam
, pStateData
, dwFlags
);
190 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
) {
191 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
192 FIXME("(%p, %p, %ld, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
196 HRESULT WINAPI
IDirectMusicChordTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface
, IDirectMusicTrack
* pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
) {
197 ICOM_THIS_MULTI(IDirectMusicChordTrack
, TrackVtbl
, iface
);
198 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
202 IDirectMusicTrack8Vtbl DirectMusicChordTrack_Track_Vtbl
= {
203 IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface
,
204 IDirectMusicChordTrack_IDirectMusicTrack_AddRef
,
205 IDirectMusicChordTrack_IDirectMusicTrack_Release
,
206 IDirectMusicChordTrack_IDirectMusicTrack_Init
,
207 IDirectMusicChordTrack_IDirectMusicTrack_InitPlay
,
208 IDirectMusicChordTrack_IDirectMusicTrack_EndPlay
,
209 IDirectMusicChordTrack_IDirectMusicTrack_Play
,
210 IDirectMusicChordTrack_IDirectMusicTrack_GetParam
,
211 IDirectMusicChordTrack_IDirectMusicTrack_SetParam
,
212 IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported
,
213 IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType
,
214 IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType
,
215 IDirectMusicChordTrack_IDirectMusicTrack_Clone
,
216 IDirectMusicChordTrack_IDirectMusicTrack_PlayEx
,
217 IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx
,
218 IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx
,
219 IDirectMusicChordTrack_IDirectMusicTrack_Compose
,
220 IDirectMusicChordTrack_IDirectMusicTrack_Join
223 /* IDirectMusicChordTrack IPersistStream part: */
224 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
) {
225 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
226 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
229 ULONG WINAPI
IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface
) {
230 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
231 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
234 ULONG WINAPI
IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface
) {
235 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
236 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
239 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
) {
240 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
241 TRACE("(%p, %p)\n", This
, pClassID
);
242 memcpy(pClassID
, &CLSID_DirectMusicChordTrack
, sizeof(CLSID
));
246 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface
) {
247 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
248 FIXME("(%p): stub, always S_FALSE\n", This
);
252 static HRESULT
IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface
, DMUS_PRIVATE_CHUNK
* pChunk
, IStream
* pStm
) {
254 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
255 DMUS_PRIVATE_CHUNK Chunk
;
256 DWORD ListSize
[3], ListCount
[3];
257 LARGE_INTEGER liMove
; /* used when skipping chunks */
259 if (pChunk
->fccID
!= DMUS_FOURCC_CHORDTRACK_LIST
) {
260 ERR_(dmfile
)(": %s chunk should be a CHORDTRACK list\n", debugstr_fourcc (pChunk
->fccID
));
264 ListSize
[0] = pChunk
->dwSize
- sizeof(FOURCC
);
268 IStream_Read (pStm
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
269 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
270 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
271 switch (Chunk
.fccID
) {
272 case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK
: {
273 TRACE_(dmfile
)(": Chord track header chunk\n");
274 IStream_Read (pStm
, &This
->dwScale
, sizeof(DWORD
), NULL
);
275 TRACE_(dmfile
)(" - dwScale: %ld\n", This
->dwScale
);
278 case DMUS_FOURCC_CHORDTRACKBODY_CHUNK
: {
283 DMUS_IO_SUBCHORD subchords
;
285 TRACE_(dmfile
)(": Chord track body chunk\n");
287 IStream_Read (pStm
, &sz
, sizeof(DWORD
), NULL
);
288 TRACE_(dmfile
)(" - sizeof(DMUS_IO_CHORD): %ld\n", sz
);
289 if (sz
!= sizeof(DMUS_IO_CHORD
)) return E_FAIL
;
290 IStream_Read (pStm
, &body
, sizeof(DMUS_IO_CHORD
), NULL
);
291 TRACE_(dmfile
)(" - wszName: %s\n", debugstr_w(body
.wszName
));
292 TRACE_(dmfile
)(" - mtTime: %lu\n", body
.mtTime
);
293 TRACE_(dmfile
)(" - wMeasure: %u\n", body
.wMeasure
);
294 TRACE_(dmfile
)(" - bBeat: %u\n", body
.bBeat
);
295 TRACE_(dmfile
)(" - bFlags: 0x%02x\n", body
.bFlags
);
297 IStream_Read (pStm
, &num
, sizeof(DWORD
), NULL
);
298 TRACE_(dmfile
)(" - # DMUS_IO_SUBCHORDS: %ld\n", num
);
299 IStream_Read (pStm
, &sz
, sizeof(DWORD
), NULL
);
300 TRACE_(dmfile
)(" - sizeof(DMUS_IO_SUBCHORDS): %ld\n", sz
);
301 if (sz
!= sizeof(DMUS_IO_SUBCHORD
)) return E_FAIL
;
303 for (it
= 0; it
< num
; ++it
) {
304 IStream_Read (pStm
, &subchords
, sizeof(DMUS_IO_SUBCHORD
), NULL
);
305 TRACE_(dmfile
)("DMUS_IO_SUBCHORD #%ld\n", it
+1);
306 TRACE_(dmfile
)(" - dwChordPattern: %lu\n", subchords
.dwChordPattern
);
307 TRACE_(dmfile
)(" - dwScalePattern: %lu\n", subchords
.dwScalePattern
);
308 TRACE_(dmfile
)(" - dwInversionPoints: %lu\n", subchords
.dwInversionPoints
);
309 TRACE_(dmfile
)(" - dwLevels: %lu\n", subchords
.dwLevels
);
310 TRACE_(dmfile
)(" - bChordRoot: %u\n", subchords
.bChordRoot
);
311 TRACE_(dmfile
)(" - bScaleRoot: %u\n", subchords
.bScaleRoot
);
316 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
317 liMove
.QuadPart
= Chunk
.dwSize
;
318 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
322 TRACE_(dmfile
)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount
[0], ListSize
[0]);
323 } while (ListCount
[0] < ListSize
[0]);
328 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
) {
329 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
331 DMUS_PRIVATE_CHUNK Chunk
;
332 LARGE_INTEGER liMove
;
335 TRACE("(%p, %p): Loading\n", This
, pStm
);
337 IStream_Read (pStm
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
338 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
339 switch (Chunk
.fccID
) {
341 IStream_Read (pStm
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
342 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
343 switch (Chunk
.fccID
) {
344 case DMUS_FOURCC_CHORDTRACK_LIST
: {
345 TRACE_(dmfile
)(": Chord track list\n");
346 hr
= IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface
, &Chunk
, pStm
);
347 if (FAILED(hr
)) return hr
;
351 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
352 liMove
.QuadPart
= Chunk
.dwSize
;
353 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
357 TRACE_(dmfile
)(": reading finished\n");
361 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
362 liMove
.QuadPart
= Chunk
.dwSize
;
363 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
371 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
) {
372 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
373 FIXME("(%p): Saving not implemented yet\n", This
);
377 HRESULT WINAPI
IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
) {
378 ICOM_THIS_MULTI(IDirectMusicChordTrack
, PersistStreamVtbl
, iface
);
379 FIXME("(%p, %p): stub\n", This
, pcbSize
);
383 IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl
= {
384 IDirectMusicChordTrack_IPersistStream_QueryInterface
,
385 IDirectMusicChordTrack_IPersistStream_AddRef
,
386 IDirectMusicChordTrack_IPersistStream_Release
,
387 IDirectMusicChordTrack_IPersistStream_GetClassID
,
388 IDirectMusicChordTrack_IPersistStream_IsDirty
,
389 IDirectMusicChordTrack_IPersistStream_Load
,
390 IDirectMusicChordTrack_IPersistStream_Save
,
391 IDirectMusicChordTrack_IPersistStream_GetSizeMax
394 /* for ClassFactory */
395 HRESULT WINAPI
DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID
, LPVOID
*ppobj
, LPUNKNOWN pUnkOuter
) {
396 IDirectMusicChordTrack
* track
;
398 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicChordTrack
));
401 return E_OUTOFMEMORY
;
403 track
->UnknownVtbl
= &DirectMusicChordTrack_Unknown_Vtbl
;
404 track
->TrackVtbl
= &DirectMusicChordTrack_Track_Vtbl
;
405 track
->PersistStreamVtbl
= &DirectMusicChordTrack_PersistStream_Vtbl
;
406 track
->pDesc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DMUS_OBJECTDESC
));
407 DM_STRUCT_INIT(track
->pDesc
);
408 track
->pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
409 memcpy (&track
->pDesc
->guidClass
, &CLSID_DirectMusicChordTrack
, sizeof (CLSID
));
410 track
->ref
= 0; /* will be inited by QueryInterface */
412 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&track
->UnknownVtbl
, lpcGUID
, ppobj
);