user/tests: Fix a compiler warning, and remove some useless casts.
[wine/testsucceed.git] / dlls / dmstyle / chordtrack.c
blobab9d94ed460eb6c02a00041524df0ed8f8e2982c
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., 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 = (LPUNKNOWN)&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 = (LPPERSISTSTREAM)&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 %ld\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 %ld\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, %ld, %ld): 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, %ld, %ld, %ld, %ld, %p, %p, %ld): 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, %ld, %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, %ld, %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): ", 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, %ld, %ld, %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, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
179 return S_OK;
182 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
183 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
184 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
185 return S_OK;
188 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
189 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
190 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
191 return S_OK;
194 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
195 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
196 FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
197 return S_OK;
200 static HRESULT WINAPI IDirectMusicChordTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
201 ICOM_THIS_MULTI(IDirectMusicChordTrack, TrackVtbl, iface);
202 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
203 return S_OK;
206 static const IDirectMusicTrack8Vtbl DirectMusicChordTrack_Track_Vtbl = {
207 IDirectMusicChordTrack_IDirectMusicTrack_QueryInterface,
208 IDirectMusicChordTrack_IDirectMusicTrack_AddRef,
209 IDirectMusicChordTrack_IDirectMusicTrack_Release,
210 IDirectMusicChordTrack_IDirectMusicTrack_Init,
211 IDirectMusicChordTrack_IDirectMusicTrack_InitPlay,
212 IDirectMusicChordTrack_IDirectMusicTrack_EndPlay,
213 IDirectMusicChordTrack_IDirectMusicTrack_Play,
214 IDirectMusicChordTrack_IDirectMusicTrack_GetParam,
215 IDirectMusicChordTrack_IDirectMusicTrack_SetParam,
216 IDirectMusicChordTrack_IDirectMusicTrack_IsParamSupported,
217 IDirectMusicChordTrack_IDirectMusicTrack_AddNotificationType,
218 IDirectMusicChordTrack_IDirectMusicTrack_RemoveNotificationType,
219 IDirectMusicChordTrack_IDirectMusicTrack_Clone,
220 IDirectMusicChordTrack_IDirectMusicTrack_PlayEx,
221 IDirectMusicChordTrack_IDirectMusicTrack_GetParamEx,
222 IDirectMusicChordTrack_IDirectMusicTrack_SetParamEx,
223 IDirectMusicChordTrack_IDirectMusicTrack_Compose,
224 IDirectMusicChordTrack_IDirectMusicTrack_Join
227 /* IDirectMusicChordTrack IPersistStream part: */
228 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
229 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
230 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
233 static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
234 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
235 return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
238 static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
239 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
240 return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
243 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
244 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
245 TRACE("(%p, %p)\n", This, pClassID);
246 memcpy(pClassID, &CLSID_DirectMusicChordTrack, sizeof(CLSID));
247 return S_OK;
250 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
251 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
252 FIXME("(%p): stub, always S_FALSE\n", This);
253 return S_FALSE;
256 static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
258 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
259 DMUS_PRIVATE_CHUNK Chunk;
260 DWORD ListSize[3], ListCount[3];
261 LARGE_INTEGER liMove; /* used when skipping chunks */
263 if (pChunk->fccID != DMUS_FOURCC_CHORDTRACK_LIST) {
264 ERR_(dmfile)(": %s chunk should be a CHORDTRACK list\n", debugstr_fourcc (pChunk->fccID));
265 return E_FAIL;
268 ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
269 ListCount[0] = 0;
271 do {
272 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
273 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
274 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
275 switch (Chunk.fccID) {
276 case DMUS_FOURCC_CHORDTRACKHEADER_CHUNK: {
277 TRACE_(dmfile)(": Chord track header chunk\n");
278 IStream_Read (pStm, &This->dwScale, sizeof(DWORD), NULL);
279 TRACE_(dmfile)(" - dwScale: %ld\n", This->dwScale);
280 break;
282 case DMUS_FOURCC_CHORDTRACKBODY_CHUNK: {
283 DWORD sz;
284 DWORD it;
285 DWORD num;
286 DMUS_IO_CHORD body;
287 DMUS_IO_SUBCHORD subchords;
289 TRACE_(dmfile)(": Chord track body chunk\n");
291 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
292 TRACE_(dmfile)(" - sizeof(DMUS_IO_CHORD): %ld\n", sz);
293 if (sz != sizeof(DMUS_IO_CHORD)) return E_FAIL;
294 IStream_Read (pStm, &body, sizeof(DMUS_IO_CHORD), NULL);
295 TRACE_(dmfile)(" - wszName: %s\n", debugstr_w(body.wszName));
296 TRACE_(dmfile)(" - mtTime: %lu\n", body.mtTime);
297 TRACE_(dmfile)(" - wMeasure: %u\n", body.wMeasure);
298 TRACE_(dmfile)(" - bBeat: %u\n", body.bBeat);
299 TRACE_(dmfile)(" - bFlags: 0x%02x\n", body.bFlags);
301 IStream_Read (pStm, &num, sizeof(DWORD), NULL);
302 TRACE_(dmfile)(" - # DMUS_IO_SUBCHORDS: %ld\n", num);
303 IStream_Read (pStm, &sz, sizeof(DWORD), NULL);
304 TRACE_(dmfile)(" - sizeof(DMUS_IO_SUBCHORDS): %ld\n", sz);
305 if (sz != sizeof(DMUS_IO_SUBCHORD)) return E_FAIL;
307 for (it = 0; it < num; ++it) {
308 IStream_Read (pStm, &subchords, sizeof(DMUS_IO_SUBCHORD), NULL);
309 TRACE_(dmfile)("DMUS_IO_SUBCHORD #%ld\n", it+1);
310 TRACE_(dmfile)(" - dwChordPattern: %lu\n", subchords.dwChordPattern);
311 TRACE_(dmfile)(" - dwScalePattern: %lu\n", subchords.dwScalePattern);
312 TRACE_(dmfile)(" - dwInversionPoints: %lu\n", subchords.dwInversionPoints);
313 TRACE_(dmfile)(" - dwLevels: %lu\n", subchords.dwLevels);
314 TRACE_(dmfile)(" - bChordRoot: %u\n", subchords.bChordRoot);
315 TRACE_(dmfile)(" - bScaleRoot: %u\n", subchords.bScaleRoot);
317 break;
319 default: {
320 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
321 liMove.QuadPart = Chunk.dwSize;
322 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
323 break;
326 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
327 } while (ListCount[0] < ListSize[0]);
329 return S_OK;
332 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
333 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
335 DMUS_PRIVATE_CHUNK Chunk;
336 LARGE_INTEGER liMove;
337 HRESULT hr;
339 TRACE("(%p, %p): Loading\n", This, pStm);
341 IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
342 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
343 switch (Chunk.fccID) {
344 case FOURCC_LIST: {
345 IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
346 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
347 switch (Chunk.fccID) {
348 case DMUS_FOURCC_CHORDTRACK_LIST: {
349 TRACE_(dmfile)(": Chord track list\n");
350 hr = IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface, &Chunk, pStm);
351 if (FAILED(hr)) return hr;
352 break;
354 default: {
355 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
356 liMove.QuadPart = Chunk.dwSize;
357 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
358 return E_FAIL;
361 TRACE_(dmfile)(": reading finished\n");
362 break;
364 default: {
365 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
366 liMove.QuadPart = Chunk.dwSize;
367 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
368 return E_FAIL;
372 return S_OK;
375 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
376 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
377 FIXME("(%p): Saving not implemented yet\n", This);
378 return E_NOTIMPL;
381 static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
382 ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
383 FIXME("(%p, %p): stub\n", This, pcbSize);
384 return E_NOTIMPL;
387 static const IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = {
388 IDirectMusicChordTrack_IPersistStream_QueryInterface,
389 IDirectMusicChordTrack_IPersistStream_AddRef,
390 IDirectMusicChordTrack_IPersistStream_Release,
391 IDirectMusicChordTrack_IPersistStream_GetClassID,
392 IDirectMusicChordTrack_IPersistStream_IsDirty,
393 IDirectMusicChordTrack_IPersistStream_Load,
394 IDirectMusicChordTrack_IPersistStream_Save,
395 IDirectMusicChordTrack_IPersistStream_GetSizeMax
398 /* for ClassFactory */
399 HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
400 IDirectMusicChordTrack* track;
402 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack));
403 if (NULL == track) {
404 *ppobj = NULL;
405 return E_OUTOFMEMORY;
407 track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl;
408 track->TrackVtbl = &DirectMusicChordTrack_Track_Vtbl;
409 track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl;
410 track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
411 DM_STRUCT_INIT(track->pDesc);
412 track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
413 memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicChordTrack, sizeof (CLSID));
414 track->ref = 0; /* will be inited by QueryInterface */
416 return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);