1 /* IDirectMusicAudioPath Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmime_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
26 struct IDirectMusicAudioPathImpl
{
27 IDirectMusicAudioPath IDirectMusicAudioPath_iface
;
28 struct dmobject dmobj
;
30 IDirectMusicPerformance8
* pPerf
;
31 IDirectMusicGraph
* pToolGraph
;
32 IDirectSoundBuffer
* pDSBuffer
;
33 IDirectSoundBuffer
* pPrimary
;
38 static inline struct IDirectMusicAudioPathImpl
*impl_from_IDirectMusicAudioPath(IDirectMusicAudioPath
*iface
)
40 return CONTAINING_RECORD(iface
, struct IDirectMusicAudioPathImpl
, IDirectMusicAudioPath_iface
);
43 static inline struct IDirectMusicAudioPathImpl
*impl_from_IDirectMusicObject(IDirectMusicObject
*iface
)
45 return CONTAINING_RECORD(iface
, struct IDirectMusicAudioPathImpl
, dmobj
.IDirectMusicObject_iface
);
48 static inline struct IDirectMusicAudioPathImpl
*impl_from_IPersistStream(IPersistStream
*iface
)
50 return CONTAINING_RECORD(iface
, struct IDirectMusicAudioPathImpl
, dmobj
.IPersistStream_iface
);
53 void set_audiopath_perf_pointer(IDirectMusicAudioPath
*iface
, IDirectMusicPerformance8
*performance
)
55 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
56 This
->pPerf
= performance
;
59 void set_audiopath_dsound_buffer(IDirectMusicAudioPath
*iface
, IDirectSoundBuffer
*buffer
)
61 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
62 This
->pDSBuffer
= buffer
;
65 void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath
*iface
, IDirectSoundBuffer
*buffer
)
67 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
68 This
->pPrimary
= buffer
;
71 /*****************************************************************************
72 * IDirectMusicAudioPathImpl implementation
74 static HRESULT WINAPI
IDirectMusicAudioPathImpl_QueryInterface (IDirectMusicAudioPath
*iface
, REFIID riid
, void **ppobj
)
76 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
78 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
82 if (IsEqualIID (riid
, &IID_IDirectMusicAudioPath
) || IsEqualIID (riid
, &IID_IUnknown
))
83 *ppobj
= &This
->IDirectMusicAudioPath_iface
;
84 else if (IsEqualIID (riid
, &IID_IDirectMusicObject
))
85 *ppobj
= &This
->dmobj
.IDirectMusicObject_iface
;
86 else if (IsEqualIID (riid
, &IID_IPersistStream
))
87 *ppobj
= &This
->dmobj
.IPersistStream_iface
;
90 IUnknown_AddRef((IUnknown
*)*ppobj
);
94 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
98 static ULONG WINAPI
IDirectMusicAudioPathImpl_AddRef (IDirectMusicAudioPath
*iface
)
100 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
101 ULONG ref
= InterlockedIncrement(&This
->ref
);
103 TRACE("(%p): AddRef from %d\n", This
, ref
- 1);
109 static ULONG WINAPI
IDirectMusicAudioPathImpl_Release (IDirectMusicAudioPath
*iface
)
111 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
112 ULONG ref
= InterlockedDecrement(&This
->ref
);
114 TRACE("(%p): ReleaseRef to %d\n", This
, ref
);
118 IDirectSoundBuffer8_Release(This
->pDSBuffer
);
120 HeapFree(GetProcessHeap(), 0, This
);
123 DMIME_UnlockModule();
127 static HRESULT WINAPI
IDirectMusicAudioPathImpl_GetObjectInPath (IDirectMusicAudioPath
*iface
, DWORD dwPChannel
, DWORD dwStage
, DWORD dwBuffer
,
128 REFGUID guidObject
, WORD dwIndex
, REFGUID iidInterface
, void** ppObject
)
130 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
133 FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This
, dwPChannel
, dwStage
, dwBuffer
, debugstr_dmguid(guidObject
),
134 dwIndex
, debugstr_dmguid(iidInterface
), ppObject
);
137 case DMUS_PATH_BUFFER
:
140 if (IsEqualIID (iidInterface
, &IID_IDirectSoundBuffer8
)) {
141 IDirectSoundBuffer8_QueryInterface (This
->pDSBuffer
, &IID_IDirectSoundBuffer8
, ppObject
);
142 TRACE("returning %p\n",*ppObject
);
144 } else if (IsEqualIID (iidInterface
, &IID_IDirectSound3DBuffer
)) {
145 IDirectSoundBuffer8_QueryInterface (This
->pDSBuffer
, &IID_IDirectSound3DBuffer
, ppObject
);
146 TRACE("returning %p\n",*ppObject
);
154 case DMUS_PATH_PRIMARY_BUFFER
: {
155 if (IsEqualIID (iidInterface
, &IID_IDirectSound3DListener
)) {
156 IDirectSoundBuffer8_QueryInterface (This
->pPrimary
, &IID_IDirectSound3DListener
, ppObject
);
159 FIXME("bad iid...\n");
164 case DMUS_PATH_AUDIOPATH_GRAPH
:
166 if (IsEqualIID (iidInterface
, &IID_IDirectMusicGraph
)) {
167 if (NULL
== This
->pToolGraph
) {
168 IDirectMusicGraphImpl
* pGraph
;
169 hr
= create_dmgraph(&IID_IDirectMusicGraph
, (void**)&pGraph
);
172 This
->pToolGraph
= (IDirectMusicGraph
*) pGraph
;
174 *ppObject
= This
->pToolGraph
;
175 IDirectMusicGraph_AddRef((LPDIRECTMUSICGRAPH
) *ppObject
);
181 case DMUS_PATH_AUDIOPATH_TOOL
:
187 case DMUS_PATH_PERFORMANCE
:
189 /* TODO check wanted GUID */
190 *ppObject
= This
->pPerf
;
191 IUnknown_AddRef((LPUNKNOWN
) *ppObject
);
196 case DMUS_PATH_PERFORMANCE_GRAPH
:
198 IDirectMusicGraph
* pPerfoGraph
= NULL
;
199 IDirectMusicPerformance8_GetGraph(This
->pPerf
, &pPerfoGraph
);
200 if (NULL
== pPerfoGraph
) {
201 IDirectMusicGraphImpl
* pGraph
= NULL
;
202 hr
= create_dmgraph(&IID_IDirectMusicGraph
, (void**)&pGraph
);
205 IDirectMusicPerformance8_SetGraph(This
->pPerf
, (IDirectMusicGraph
*) pGraph
);
206 /* we need release as SetGraph do an AddRef */
207 IDirectMusicGraph_Release((LPDIRECTMUSICGRAPH
) pGraph
);
208 pPerfoGraph
= (LPDIRECTMUSICGRAPH
) pGraph
;
210 *ppObject
= pPerfoGraph
;
215 case DMUS_PATH_PERFORMANCE_TOOL
:
224 static HRESULT WINAPI
IDirectMusicAudioPathImpl_Activate (IDirectMusicAudioPath
*iface
, BOOL fActivate
)
226 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
227 FIXME("(%p, %d): stub\n", This
, fActivate
);
229 if (!This
->fActive
) return S_OK
;
230 This
->fActive
= FALSE
;
232 if (This
->fActive
) return S_OK
;
233 This
->fActive
= TRUE
;
234 if (NULL
!= This
->pDSBuffer
) {
235 IDirectSoundBuffer_Stop(This
->pDSBuffer
);
241 static HRESULT WINAPI
IDirectMusicAudioPathImpl_SetVolume (IDirectMusicAudioPath
*iface
, LONG lVolume
, DWORD dwDuration
)
243 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
244 FIXME("(%p, %i, %d): stub\n", This
, lVolume
, dwDuration
);
248 static HRESULT WINAPI
IDirectMusicAudioPathImpl_ConvertPChannel (IDirectMusicAudioPath
*iface
, DWORD dwPChannelIn
, DWORD
* pdwPChannelOut
)
250 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicAudioPath(iface
);
251 FIXME("(%p, %d, %p): stub\n", This
, dwPChannelIn
, pdwPChannelOut
);
255 static const IDirectMusicAudioPathVtbl DirectMusicAudioPathVtbl
= {
256 IDirectMusicAudioPathImpl_QueryInterface
,
257 IDirectMusicAudioPathImpl_AddRef
,
258 IDirectMusicAudioPathImpl_Release
,
259 IDirectMusicAudioPathImpl_GetObjectInPath
,
260 IDirectMusicAudioPathImpl_Activate
,
261 IDirectMusicAudioPathImpl_SetVolume
,
262 IDirectMusicAudioPathImpl_ConvertPChannel
265 /* IDirectMusicObject */
266 static HRESULT WINAPI
DirectMusicObject_ParseDescriptor(IDirectMusicObject
*iface
, IStream
*pStream
, DMUS_OBJECTDESC
*pDesc
)
268 struct IDirectMusicAudioPathImpl
*This
= impl_from_IDirectMusicObject(iface
);
269 DMUS_PRIVATE_CHUNK Chunk
;
270 DWORD StreamSize
, StreamCount
, ListSize
[1], ListCount
[1];
271 LARGE_INTEGER liMove
; /* used when skipping chunks */
273 TRACE("(%p, %p, %p)\n", This
, pStream
, pDesc
);
275 /* FIXME: should this be determined from stream? */
276 pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
277 pDesc
->guidClass
= This
->dmobj
.desc
.guidClass
;
279 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
280 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
281 switch (Chunk
.fccID
) {
283 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
284 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
285 StreamSize
= Chunk
.dwSize
- sizeof(FOURCC
);
287 if (Chunk
.fccID
== DMUS_FOURCC_AUDIOPATH_FORM
) {
288 TRACE_(dmfile
)(": audio path form\n");
290 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
291 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
292 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
293 switch (Chunk
.fccID
) {
294 case DMUS_FOURCC_GUID_CHUNK
: {
295 TRACE_(dmfile
)(": GUID chunk\n");
296 pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
297 IStream_Read (pStream
, &pDesc
->guidObject
, Chunk
.dwSize
, NULL
);
300 case DMUS_FOURCC_VERSION_CHUNK
: {
301 TRACE_(dmfile
)(": version chunk\n");
302 pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
303 IStream_Read (pStream
, &pDesc
->vVersion
, Chunk
.dwSize
, NULL
);
306 case DMUS_FOURCC_CATEGORY_CHUNK
: {
307 TRACE_(dmfile
)(": category chunk\n");
308 pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
309 IStream_Read (pStream
, pDesc
->wszCategory
, Chunk
.dwSize
, NULL
);
313 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
314 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
315 ListSize
[0] = Chunk
.dwSize
- sizeof(FOURCC
);
317 switch (Chunk
.fccID
) {
318 /* evil M$ UNFO list, which can (!?) contain INFO elements */
319 case DMUS_FOURCC_UNFO_LIST
: {
320 TRACE_(dmfile
)(": UNFO list\n");
322 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
323 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
324 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
325 switch (Chunk
.fccID
) {
326 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
327 (though strings seem to be valid unicode) */
328 case mmioFOURCC('I','N','A','M'):
329 case DMUS_FOURCC_UNAM_CHUNK
: {
330 TRACE_(dmfile
)(": name chunk\n");
331 pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
332 IStream_Read (pStream
, pDesc
->wszName
, Chunk
.dwSize
, NULL
);
335 case mmioFOURCC('I','A','R','T'):
336 case DMUS_FOURCC_UART_CHUNK
: {
337 TRACE_(dmfile
)(": artist chunk (ignored)\n");
338 liMove
.QuadPart
= Chunk
.dwSize
;
339 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
342 case mmioFOURCC('I','C','O','P'):
343 case DMUS_FOURCC_UCOP_CHUNK
: {
344 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
345 liMove
.QuadPart
= Chunk
.dwSize
;
346 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
349 case mmioFOURCC('I','S','B','J'):
350 case DMUS_FOURCC_USBJ_CHUNK
: {
351 TRACE_(dmfile
)(": subject chunk (ignored)\n");
352 liMove
.QuadPart
= Chunk
.dwSize
;
353 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
356 case mmioFOURCC('I','C','M','T'):
357 case DMUS_FOURCC_UCMT_CHUNK
: {
358 TRACE_(dmfile
)(": comment chunk (ignored)\n");
359 liMove
.QuadPart
= Chunk
.dwSize
;
360 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
364 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
365 liMove
.QuadPart
= Chunk
.dwSize
;
366 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
370 TRACE_(dmfile
)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount
[0], ListSize
[0]);
371 } while (ListCount
[0] < ListSize
[0]);
375 TRACE_(dmfile
)(": unknown (skipping)\n");
376 liMove
.QuadPart
= Chunk
.dwSize
- sizeof(FOURCC
);
377 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
384 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
385 liMove
.QuadPart
= Chunk
.dwSize
;
386 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
390 TRACE_(dmfile
)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount
, StreamSize
);
391 } while (StreamCount
< StreamSize
);
393 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
394 liMove
.QuadPart
= StreamSize
;
395 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
399 TRACE_(dmfile
)(": reading finished\n");
403 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
404 liMove
.QuadPart
= Chunk
.dwSize
;
405 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
406 return DMUS_E_INVALIDFILE
;
410 TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc
));
415 static const IDirectMusicObjectVtbl dmobject_vtbl
= {
416 dmobj_IDirectMusicObject_QueryInterface
,
417 dmobj_IDirectMusicObject_AddRef
,
418 dmobj_IDirectMusicObject_Release
,
419 dmobj_IDirectMusicObject_GetDescriptor
,
420 dmobj_IDirectMusicObject_SetDescriptor
,
421 DirectMusicObject_ParseDescriptor
425 static HRESULT WINAPI
PersistStream_Load(IPersistStream
*iface
, IStream
*pStm
)
427 struct IDirectMusicAudioPathImpl
*This
= impl_from_IPersistStream(iface
);
430 DWORD chunkSize
, StreamSize
, StreamCount
, ListSize
[3], ListCount
[3];
431 LARGE_INTEGER liMove
; /* used when skipping chunks */
433 FIXME("(%p, %p): Loading not implemented yet\n", This
, pStm
);
434 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
435 IStream_Read (pStm
, &chunkSize
, sizeof(DWORD
), NULL
);
436 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
439 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
440 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(chunkID
));
441 StreamSize
= chunkSize
- sizeof(FOURCC
);
444 case DMUS_FOURCC_AUDIOPATH_FORM
: {
445 TRACE_(dmfile
)(": audio path form\n");
447 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
448 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
449 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
450 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
452 case DMUS_FOURCC_GUID_CHUNK
: {
453 TRACE_(dmfile
)(": GUID chunk\n");
454 This
->dmobj
.desc
.dwValidData
|= DMUS_OBJ_OBJECT
;
455 IStream_Read (pStm
, &This
->dmobj
.desc
.guidObject
, chunkSize
, NULL
);
458 case DMUS_FOURCC_VERSION_CHUNK
: {
459 TRACE_(dmfile
)(": version chunk\n");
460 This
->dmobj
.desc
.dwValidData
|= DMUS_OBJ_VERSION
;
461 IStream_Read (pStm
, &This
->dmobj
.desc
.vVersion
, chunkSize
, NULL
);
464 case DMUS_FOURCC_CATEGORY_CHUNK
: {
465 TRACE_(dmfile
)(": category chunk\n");
466 This
->dmobj
.desc
.dwValidData
|= DMUS_OBJ_CATEGORY
;
467 IStream_Read (pStm
, This
->dmobj
.desc
.wszCategory
, chunkSize
, NULL
);
471 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
472 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(chunkID
));
473 ListSize
[0] = chunkSize
- sizeof(FOURCC
);
476 case DMUS_FOURCC_UNFO_LIST
: {
477 TRACE_(dmfile
)(": UNFO list\n");
479 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
480 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
481 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
482 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
484 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
485 (though strings seem to be valid unicode) */
486 case mmioFOURCC('I','N','A','M'):
487 case DMUS_FOURCC_UNAM_CHUNK
: {
488 TRACE_(dmfile
)(": name chunk\n");
489 This
->dmobj
.desc
.dwValidData
|= DMUS_OBJ_NAME
;
490 IStream_Read (pStm
, This
->dmobj
.desc
.wszName
, chunkSize
, NULL
);
493 case mmioFOURCC('I','A','R','T'):
494 case DMUS_FOURCC_UART_CHUNK
: {
495 TRACE_(dmfile
)(": artist chunk (ignored)\n");
496 liMove
.QuadPart
= chunkSize
;
497 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
500 case mmioFOURCC('I','C','O','P'):
501 case DMUS_FOURCC_UCOP_CHUNK
: {
502 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
503 liMove
.QuadPart
= chunkSize
;
504 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
507 case mmioFOURCC('I','S','B','J'):
508 case DMUS_FOURCC_USBJ_CHUNK
: {
509 TRACE_(dmfile
)(": subject chunk (ignored)\n");
510 liMove
.QuadPart
= chunkSize
;
511 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
514 case mmioFOURCC('I','C','M','T'):
515 case DMUS_FOURCC_UCMT_CHUNK
: {
516 TRACE_(dmfile
)(": comment chunk (ignored)\n");
517 liMove
.QuadPart
= chunkSize
;
518 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
522 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
523 liMove
.QuadPart
= chunkSize
;
524 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
528 TRACE_(dmfile
)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount
[0], ListSize
[0]);
529 } while (ListCount
[0] < ListSize
[0]);
533 TRACE_(dmfile
)(": unknown (skipping)\n");
534 liMove
.QuadPart
= chunkSize
- sizeof(FOURCC
);
535 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
542 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
543 liMove
.QuadPart
= chunkSize
;
544 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
548 TRACE_(dmfile
)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount
, StreamSize
);
549 } while (StreamCount
< StreamSize
);
553 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
554 liMove
.QuadPart
= StreamSize
;
555 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
559 TRACE_(dmfile
)(": reading finished\n");
563 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
564 liMove
.QuadPart
= chunkSize
;
565 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
573 static const IPersistStreamVtbl persiststream_vtbl
= {
574 dmobj_IPersistStream_QueryInterface
,
575 dmobj_IPersistStream_AddRef
,
576 dmobj_IPersistStream_Release
,
577 dmobj_IPersistStream_GetClassID
,
578 unimpl_IPersistStream_IsDirty
,
580 unimpl_IPersistStream_Save
,
581 unimpl_IPersistStream_GetSizeMax
584 /* for ClassFactory */
585 HRESULT WINAPI
create_dmaudiopath(REFIID riid
, void **ppobj
)
587 IDirectMusicAudioPathImpl
* obj
;
590 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicAudioPathImpl
));
593 return E_OUTOFMEMORY
;
595 obj
->IDirectMusicAudioPath_iface
.lpVtbl
= &DirectMusicAudioPathVtbl
;
597 dmobject_init(&obj
->dmobj
, &CLSID_DirectMusicAudioPathConfig
,
598 (IUnknown
*)&obj
->IDirectMusicAudioPath_iface
);
599 obj
->dmobj
.IDirectMusicObject_iface
.lpVtbl
= &dmobject_vtbl
;
600 obj
->dmobj
.IPersistStream_iface
.lpVtbl
= &persiststream_vtbl
;
602 hr
= IDirectMusicAudioPath_QueryInterface(&obj
->IDirectMusicAudioPath_iface
, riid
, ppobj
);
603 IDirectMusicAudioPath_Release(&obj
->IDirectMusicAudioPath_iface
);