Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / dmstyle / chordtrack.c
blob7b80cb89c10ef4a955e61f7a5d0d6168a7ee0fc1
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
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "dmstyle_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
26 static ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface);
27 static ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface);
28 static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface);
30 /*****************************************************************************
31 * IDirectMusicChordTrack implementation
33 /* IDirectMusicChordTrack IUnknown part: */
34 static HRESULT WINAPI IDirectMusicChordTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
35 ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
36 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
38 if (IsEqualIID (riid, &IID_IUnknown)) {
39 *ppobj = &This->UnknownVtbl;
40 IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
41 return S_OK;
42 } else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
43 || IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
44 *ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
45 IDirectMusicChordTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
46 return S_OK;
47 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
48 *ppobj = &This->PersistStreamVtbl;
49 IDirectMusicChordTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
50 return S_OK;
53 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
54 return E_NOINTERFACE;
57 static ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface) {
58 ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
59 ULONG ref = InterlockedIncrement(&This->ref);
61 TRACE("(%p): AddRef from %d\n", This, ref - 1);
63 DMSTYLE_LockModule();
65 return ref;
68 static ULONG WINAPI IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface) {
69 ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface);
70 ULONG ref = InterlockedDecrement(&This->ref);
72 TRACE("(%p): ReleaseRef to %d\n", This, ref);
74 if (ref == 0) {
75 HeapFree(GetProcessHeap(), 0, This);
78 DMSTYLE_UnlockModule();
80 return ref;
83 static const IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl = {
84 IDirectMusicChordTrack_IUnknown_QueryInterface,
85 IDirectMusicChordTrack_IUnknown_AddRef,
86 IDirectMusicChordTrack_IUnknown_Release
89 /* IDirectMusicChordTrack IDirectMusicTrack8 part: */
90 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
91 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
92 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
95 static ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
96 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
97 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
100 static ULONG WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
101 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
102 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
105 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment) {
106 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
107 FIXME("(%p, %p): stub\n", This, pSegment);
108 return S_OK;
111 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
113 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
114 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
115 return S_OK;
118 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
120 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
121 FIXME("(%p, %p): stub\n", This, pStateData);
122 return S_OK;
125 static 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)
127 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
128 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
129 return S_OK;
132 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
133 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
134 FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
135 return S_OK;
138 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
139 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
140 FIXME("(%p, %s, %d, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
141 return S_OK;
144 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
145 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
147 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
148 if (IsEqualGUID (rguidType, &GUID_BandParam)
149 || IsEqualGUID (rguidType, &GUID_ChordParam)
150 || IsEqualGUID (rguidType, &GUID_RhythmParam)) {
151 TRACE("param supported\n");
152 return S_OK;
154 TRACE("param unsupported\n");
155 return DMUS_E_TYPE_UNSUPPORTED;
158 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
159 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
160 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
161 return S_OK;
164 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
165 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
166 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
167 return S_OK;
170 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
171 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
172 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
173 return S_OK;
176 static 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) {
177 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
178 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
179 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
180 return S_OK;
183 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
184 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
185 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
186 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
187 return S_OK;
190 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
191 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
192 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
193 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
194 return S_OK;
197 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
198 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
199 FIXME("(%p, %p, %d, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
200 return S_OK;
203 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
204 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
205 FIXME("(%p, %p, %d, %p, %d, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
206 return S_OK;
209 static const IDirectMusicTrack8Vtbl DirectMusicChordTrack_Track_Vtbl = {
210 IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface,
211 IDirectMusicChordTrack_IDirectMusicTrack_AddRef,
212 IDirectMusicChordTrack_IDirectMusicTrack_Release,
213 IDirectMusicChordTrack_IDirectMusicTrack_Init,
214 IDirectMusicChordTrack_IDirectMusicTrack_InitPlay,
215 IDirectMusicChordTrack_IDirectMusicTrack_EndPlay,
216 IDirectMusicChordTrack_IDirectMusicTrack_Play,
217 IDirectMusicChordTrack_IDirectMusicTrack_GetParam,
218 IDirectMusicChordTrack_IDirectMusicTrack_SetParam,
219 IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported,
220 IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType,
221 IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType,
222 IDirectMusicChordTrack_IDirectMusicTrack_Clone,
223 IDirectMusicChordTrack_IDirectMusicTrack_PlayEx,
224 IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx,
225 IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx,
226 IDirectMusicChordTrack_IDirectMusicTrack_Compose,
227 IDirectMusicChordTrack_IDirectMusicTrack_Join
230 /* IDirectMusicChordTrack IPersistStream part: */
231 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
232 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
233 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
236 static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
237 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
238 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
241 static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
242 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
243 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
246 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
247 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
248 TRACE("(%p, %p)\n", This, pClassID);
249 *pClassID = CLSID_DirectMusicChordTrack;
250 return S_OK;
253 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
254 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
255 FIXME("(%p): stub, always S_FALSE\n", This);
256 return S_FALSE;
259 static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
261 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
262 DMUS_PRIVATE_CHUNK Chunk;
263 DWORD ListSize[3], ListCount[3];
264 LARGE_INTEGER liMove; /* used when skipping chunks */
266 if (pChunk->fccID != DMUS_FOURCC_CHORDTRACK_LIST) {
267 ERR_(dmfile)(": %s chunk should be a CHORDTRACK list\n", debugstr_fourcc (pChunk->fccID));
268 return E_FAIL;
271 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
272 ListCount[0] = 0;
274 do {
275 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
276 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
277 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
278 switch (Chunk.fccID) {
279 case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK: {
280 TRACE_(dmfile)(": Chord track header chunk\n");
281 IStream_Read (pStm, &This->dwScale, sizeof(DWORD), NULL);
282 TRACE_(dmfile)(" - dwScale: %d\n", This->dwScale);
283 break;
285 case DMUS_FOURCC_CHORDTRACKBODY_CHUNK: {
286 DWORD sz;
287 DWORD it;
288 DWORD num;
289 DMUS_IO_CHORD body;
290 DMUS_IO_SUBCHORD subchords;
292 TRACE_(dmfile)(": Chord track body chunk\n");
294 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
295 TRACE_(dmfile)(" - sizeof(DMUS_IO_CHORD): %d\n", sz);
296 if (sz != sizeof(DMUS_IO_CHORD)) return E_FAIL;
297 IStream_Read (pStm, &body, sizeof(DMUS_IO_CHORD), NULL);
298 TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(body.wszName));
299 TRACE_(dmfile)(" - mtTime: %u\n", body.mtTime);
300 TRACE_(dmfile)(" - wMeasure: %u\n", body.wMeasure);
301 TRACE_(dmfile)(" - bBeat: %u\n", body.bBeat);
302 TRACE_(dmfile)(" - bFlags: 0x%02x\n", body.bFlags);
304 IStream_Read (pStm, &num, sizeof(DWORD), NULL);
305 TRACE_(dmfile)(" - # DMUS_IO_SUBCHORDS: %d\n", num);
306 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
307 TRACE_(dmfile)(" - sizeof(DMUS_IO_SUBCHORDS): %d\n", sz);
308 if (sz != sizeof(DMUS_IO_SUBCHORD)) return E_FAIL;
310 for (it = 0; it < num; ++it) {
311 IStream_Read (pStm, &subchords, sizeof(DMUS_IO_SUBCHORD), NULL);
312 TRACE_(dmfile)("DMUS_IO_SUBCHORD #%d\n", it+1);
313 TRACE_(dmfile)(" - dwChordPattern: %u\n", subchords.dwChordPattern);
314 TRACE_(dmfile)(" - dwScalePattern: %u\n", subchords.dwScalePattern);
315 TRACE_(dmfile)(" - dwInversionPoints: %u\n", subchords.dwInversionPoints);
316 TRACE_(dmfile)(" - dwLevels: %u\n", subchords.dwLevels);
317 TRACE_(dmfile)(" - bChordRoot: %u\n", subchords.bChordRoot);
318 TRACE_(dmfile)(" - bScaleRoot: %u\n", subchords.bScaleRoot);
320 break;
322 default: {
323 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
324 liMove.QuadPart = Chunk.dwSize;
325 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
326 break;
329 TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
330 } while (ListCount[0] < ListSize[0]);
332 return S_OK;
335 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
336 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
338 DMUS_PRIVATE_CHUNK Chunk;
339 LARGE_INTEGER liMove;
340 HRESULT hr;
342 TRACE("(%p, %p): Loading\n", This, pStm);
344 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
345 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
346 switch (Chunk.fccID) {
347 case FOURCC_LIST: {
348 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
349 TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
350 switch (Chunk.fccID) {
351 case DMUS_FOURCC_CHORDTRACK_LIST: {
352 TRACE_(dmfile)(": Chord track list\n");
353 hr = IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface, &Chunk, pStm);
354 if (FAILED(hr)) return hr;
355 break;
357 default: {
358 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
359 liMove.QuadPart = Chunk.dwSize;
360 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
361 return E_FAIL;
364 TRACE_(dmfile)(": reading finished\n");
365 break;
367 default: {
368 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
369 liMove.QuadPart = Chunk.dwSize;
370 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
371 return E_FAIL;
375 return S_OK;
378 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
379 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
380 FIXME("(%p): Saving not implemented yet\n", This);
381 return E_NOTIMPL;
384 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
385 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
386 FIXME("(%p, %p): stub\n", This, pcbSize);
387 return E_NOTIMPL;
390 static const IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = {
391 IDirectMusicChordTrack_IPersistStream_QueryInterface,
392 IDirectMusicChordTrack_IPersistStream_AddRef,
393 IDirectMusicChordTrack_IPersistStream_Release,
394 IDirectMusicChordTrack_IPersistStream_GetClassID,
395 IDirectMusicChordTrack_IPersistStream_IsDirty,
396 IDirectMusicChordTrack_IPersistStream_Load,
397 IDirectMusicChordTrack_IPersistStream_Save,
398 IDirectMusicChordTrack_IPersistStream_GetSizeMax
401 /* for ClassFactory */
402 HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
403 IDirectMusicChordTrack* track;
405 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack));
406 if (NULL == track) {
407 *ppobj = NULL;
408 return E_OUTOFMEMORY;
410 track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl;
411 track->TrackVtbl = &DirectMusicChordTrack_Track_Vtbl;
412 track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl;
413 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
414 DM_STRUCT_INIT(track->pDesc);
415 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
416 track->pDesc->guidClass = CLSID_DirectMusicChordTrack;
417 track->ref = 0; /* will be inited by QueryInterface */
419 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);