2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicWave Implementation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2004-01-20 01:21:40 +01:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2004-01-20 01:21:40 +01:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-01-20 01:21:40 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dswave_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dswave);
|
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
2004-02-25 02:30:03 +01:00
|
|
|
|
|
|
|
/* an interface that is, according to my tests, obtained by loader after loading object; is it acting
|
|
|
|
as some sort of bridge between object and loader? */
|
2005-06-01 21:57:42 +02:00
|
|
|
static const GUID IID_IDirectMusicWavePRIVATE = {0x69e934e4,0x97f1,0x4f1d,{0x88,0xe8,0xf2,0xac,0x88,0x67,0x13,0x27}};
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IUnknown_AddRef (LPUNKNOWN iface);
|
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_AddRef (LPDIRECTMUSICSEGMENT8 iface);
|
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
|
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicWaveImpl implementation
|
|
|
|
*/
|
|
|
|
/* IDirectMusicWaveImpl IUnknown part: */
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, UnknownVtbl, iface);
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
if (IsEqualIID (riid, &IID_IUnknown)) {
|
|
|
|
*ppobj = (LPVOID)&This->UnknownVtbl;
|
|
|
|
IDirectMusicWaveImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualIID (riid, &IID_IDirectMusicSegment)
|
|
|
|
|| IsEqualIID (riid, &IID_IDirectMusicSegment2)
|
|
|
|
|| IsEqualIID (riid, &IID_IDirectMusicSegment8)) {
|
|
|
|
*ppobj = (LPVOID)&This->SegmentVtbl;
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_AddRef ((LPDIRECTMUSICSEGMENT8)&This->SegmentVtbl);
|
|
|
|
return S_OK;
|
2004-01-20 01:21:40 +01:00
|
|
|
} else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
|
|
|
|
*ppobj = (LPVOID)&This->ObjectVtbl;
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl);
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
|
|
|
|
*ppobj = (LPVOID)&This->PersistStreamVtbl;
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
|
|
|
|
return S_OK;
|
2004-02-25 02:30:03 +01:00
|
|
|
} else if (IsEqualIID (riid, &IID_IDirectMusicWavePRIVATE)) {
|
|
|
|
WARN(": requested private interface, expect crash\n");
|
|
|
|
return E_NOINTERFACE;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IUnknown_AddRef (LPUNKNOWN iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, UnknownVtbl, iface);
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
|
|
|
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2005-02-01 15:21:37 +01:00
|
|
|
DSWAVE_LockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IUnknown_Release (LPUNKNOWN iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, UnknownVtbl, iface);
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
|
|
|
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
|
|
|
if (!refCount) {
|
2004-01-20 01:21:40 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
2005-02-01 15:21:37 +01:00
|
|
|
|
|
|
|
DSWAVE_UnlockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IUnknownVtbl DirectMusicWave_Unknown_Vtbl = {
|
2004-01-20 01:21:40 +01:00
|
|
|
IDirectMusicWaveImpl_IUnknown_QueryInterface,
|
|
|
|
IDirectMusicWaveImpl_IUnknown_AddRef,
|
|
|
|
IDirectMusicWaveImpl_IUnknown_Release
|
|
|
|
};
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
/* IDirectMusicSegment8Impl IDirectMusicSegment part: */
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_QueryInterface (LPDIRECTMUSICSEGMENT8 iface, REFIID riid, LPVOID *ppobj) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_AddRef (LPDIRECTMUSICSEGMENT8 iface) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_Release (LPDIRECTMUSICSEGMENT8 iface) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtLength) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pmtLength);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetLength (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtLength) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %d): stub\n", This, mtLength);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwRepeats) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pdwRepeats);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetRepeats (LPDIRECTMUSICSEGMENT8 iface, DWORD dwRepeats) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %d): stub\n", This, dwRepeats);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD* pdwResolution) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pdwResolution);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetDefaultResolution (LPDIRECTMUSICSEGMENT8 iface, DWORD dwResolution) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %d): stub\n", This, dwResolution);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetTrack (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, IDirectMusicTrack** ppTrack) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %s, %d, %d, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, ppTrack);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetTrackGroup (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack, DWORD* pdwGroupBits) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p, %p): stub\n", This, pTrack, pdwGroupBits);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_InsertTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack, DWORD dwGroupBits) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %p, %d): stub\n", This, pTrack, dwGroupBits);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_RemoveTrack (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicTrack* pTrack) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pTrack);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_InitPlay (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicSegmentState** ppSegState, IDirectMusicPerformance* pPerformance, DWORD dwFlags) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %p, %p, %d): stub\n", This, ppSegState, pPerformance, dwFlags);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph** ppGraph) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, ppGraph);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetGraph (LPDIRECTMUSICSEGMENT8 iface, IDirectMusicGraph* pGraph) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pGraph);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_AddNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_RemoveNotificationType (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidNotificationType) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetParam (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %s, %d, %d, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pmtNext, pParam);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetParam (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, void* pParam) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %s, %d, %d, %d, %p): stub\n", This, debugstr_dmguid(rguidType), dwGroupBits, dwIndex, mtTime, pParam);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_Clone (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicSegment** ppSegment) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppSegment);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %d): stub\n", This, mtStart);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetStartPoint (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pmtStart);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %d, %d): stub\n", This, mtStart, mtEnd);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetLoopPoints (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME* pmtStart, MUSIC_TIME* pmtEnd) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p, %p): stub\n", This, pmtStart, pmtEnd);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetPChannelsUsed (LPDIRECTMUSICSEGMENT8 iface, DWORD dwNumPChannels, DWORD* paPChannels) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %d, %p): stub\n", This, dwNumPChannels, paPChannels);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_SetTrackConfig (LPDIRECTMUSICSEGMENT8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2006-10-08 23:50:59 +02:00
|
|
|
FIXME("(%p, %s, %d, %d, %d, %d): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_GetAudioPathConfig (LPDIRECTMUSICSEGMENT8 iface, IUnknown** ppAudioPathConfig){
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, ppAudioPathConfig);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_Compose (LPDIRECTMUSICSEGMENT8 iface, MUSIC_TIME mtTime, IDirectMusicSegment* pFromSegment, IDirectMusicSegment* pToSegment, IDirectMusicSegment** ppComposedSegment) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
2009-01-10 02:44:41 +01:00
|
|
|
FIXME("(%p, %d, %p, %p, %p): stub\n", This, mtTime, pFromSegment, pToSegment, ppComposedSegment);
|
2004-02-25 02:30:03 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_Download (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pAudioPath);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicSegment8_Unload (LPDIRECTMUSICSEGMENT8 iface, IUnknown *pAudioPath) {
|
2004-02-25 02:30:03 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, SegmentVtbl, iface);
|
|
|
|
FIXME("(%p, %p): stub\n", This, pAudioPath);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusicSegment8Vtbl DirectMusicSegment8_Segment_Vtbl = {
|
2004-02-25 02:30:03 +01:00
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_QueryInterface,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_AddRef,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_Release,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetLength,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetLength,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetRepeats,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetRepeats,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetDefaultResolution,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetDefaultResolution,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetTrack,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetTrackGroup,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_InsertTrack,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_RemoveTrack,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_InitPlay,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetGraph,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetGraph,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_AddNotificationType,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_RemoveNotificationType,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetParam,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetParam,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_Clone,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetStartPoint,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetStartPoint,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetLoopPoints,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetLoopPoints,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetPChannelsUsed,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_SetTrackConfig,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_GetAudioPathConfig,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_Compose,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_Download,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicSegment8_Unload
|
|
|
|
};
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicWaveImpl IDirectMusicObject part: */
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
|
|
|
|
TRACE("(%p, %p)\n", This, pDesc);
|
|
|
|
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
|
|
|
|
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%p, %p, %s): setting descriptor:\n", This, pDesc, debugstr_DMUS_OBJECTDESC(pDesc));
|
2008-02-26 21:20:15 +01:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* According to MSDN, we should copy only given values, not whole struct */
|
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
|
2008-02-26 21:20:15 +01:00
|
|
|
This->pDesc->guidObject = pDesc->guidObject;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
|
2008-02-26 21:20:15 +01:00
|
|
|
This->pDesc->guidClass = pDesc->guidClass;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_NAME)
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
|
2008-02-26 21:20:15 +01:00
|
|
|
This->pDesc->vVersion = pDesc->vVersion;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_DATE)
|
2008-02-26 21:20:15 +01:00
|
|
|
This->pDesc->ftDate = pDesc->ftDate;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
|
|
|
|
memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));
|
|
|
|
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
|
|
|
|
}
|
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
|
|
|
|
/* according to MSDN, we copy the stream */
|
|
|
|
IStream_Clone (pDesc->pStream, &This->pDesc->pStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add new flags */
|
|
|
|
This->pDesc->dwValidData |= pDesc->dwValidData;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
|
2004-01-20 01:21:40 +01:00
|
|
|
DMUS_PRIVATE_CHUNK Chunk;
|
|
|
|
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
|
|
|
|
LARGE_INTEGER liMove; /* used when skipping chunks */
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pStream, pDesc);
|
2008-02-26 21:20:15 +01:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* FIXME: should this be determined from stream? */
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
2008-02-26 21:20:15 +01:00
|
|
|
pDesc->guidClass = CLSID_DirectMusicSegment;
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
case FOURCC_RIFF: {
|
|
|
|
IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
|
|
|
StreamSize = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
StreamCount = 0;
|
|
|
|
if (Chunk.fccID == mmioFOURCC('W','A','V','E')) {
|
|
|
|
TRACE_(dmfile)(": wave form\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
|
|
|
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
case DMUS_FOURCC_GUID_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": GUID chunk\n");
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_OBJECT;
|
|
|
|
IStream_Read (pStream, &pDesc->guidObject, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_VERSION_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": version chunk\n");
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_VERSION;
|
|
|
|
IStream_Read (pStream, &pDesc->vVersion, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_CATEGORY_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": category chunk\n");
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
|
|
|
|
IStream_Read (pStream, pDesc->wszCategory, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FOURCC_LIST: {
|
|
|
|
IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
|
|
|
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
ListCount[0] = 0;
|
|
|
|
switch (Chunk.fccID) {
|
|
|
|
/* evil M$ UNFO list, which can (!?) contain INFO elements */
|
|
|
|
case DMUS_FOURCC_UNFO_LIST: {
|
|
|
|
TRACE_(dmfile)(": UNFO list\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
|
|
|
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
|
|
|
|
(though strings seem to be valid unicode) */
|
|
|
|
case mmioFOURCC('I','N','A','M'):
|
|
|
|
case DMUS_FOURCC_UNAM_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": name chunk\n");
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_NAME;
|
|
|
|
IStream_Read (pStream, pDesc->wszName, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','A','R','T'):
|
|
|
|
case DMUS_FOURCC_UART_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": artist chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','C','O','P'):
|
|
|
|
case DMUS_FOURCC_UCOP_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": copyright chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','S','B','J'):
|
|
|
|
case DMUS_FOURCC_USBJ_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": subject chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','C','M','T'):
|
|
|
|
case DMUS_FOURCC_UCMT_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": comment chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
|
2004-01-20 01:21:40 +01:00
|
|
|
} while (ListCount[0] < ListSize[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown (skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
} while (StreamCount < StreamSize);
|
|
|
|
} else {
|
|
|
|
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
|
|
|
|
liMove.QuadPart = StreamSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE_(dmfile)(": reading finished\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
|
|
|
return DMUS_E_INVALIDFILE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE(": returning descriptor: %s\n", debugstr_DMUS_OBJECTDESC (pDesc));
|
2004-01-20 01:21:40 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusicObjectVtbl DirectMusicWave_Object_Vtbl = {
|
2004-01-20 01:21:40 +01:00
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_AddRef,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_Release,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor,
|
|
|
|
IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor
|
|
|
|
};
|
|
|
|
|
|
|
|
/* IDirectMusicWaveImpl IPersistStream part: */
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static ULONG WINAPI IDirectMusicWaveImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
|
|
|
|
return IDirectMusicWaveImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
|
2004-01-20 01:21:40 +01:00
|
|
|
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
|
2004-02-25 02:30:03 +01:00
|
|
|
|
|
|
|
DMUS_PRIVATE_CHUNK Chunk;
|
|
|
|
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
|
|
|
|
LARGE_INTEGER liMove; /* used when skipping chunks */
|
|
|
|
|
|
|
|
FIXME("(%p, %p): loading not implemented yet (only descriptor is loaded)\n", This, pStm);
|
2008-02-26 21:20:15 +01:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
/* FIXME: should this be determined from stream? */
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
2008-02-26 21:20:15 +01:00
|
|
|
This->pDesc->guidClass = CLSID_DirectMusicSegment;
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-02-25 02:30:03 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
case FOURCC_RIFF: {
|
|
|
|
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
|
|
|
StreamSize = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
StreamCount = 0;
|
|
|
|
if (Chunk.fccID == mmioFOURCC('W','A','V','E')) {
|
|
|
|
TRACE_(dmfile)(": wave form\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
|
|
|
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-02-25 02:30:03 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
case DMUS_FOURCC_GUID_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": GUID chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_OBJECT;
|
|
|
|
IStream_Read (pStm, &This->pDesc->guidObject, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_VERSION_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": version chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_VERSION;
|
|
|
|
IStream_Read (pStm, &This->pDesc->vVersion, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_CATEGORY_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": category chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
|
|
|
|
IStream_Read (pStm, This->pDesc->wszCategory, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FOURCC_LIST: {
|
|
|
|
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
|
|
|
|
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
ListCount[0] = 0;
|
|
|
|
switch (Chunk.fccID) {
|
|
|
|
/* evil M$ UNFO list, which can (!?) contain INFO elements */
|
|
|
|
case DMUS_FOURCC_UNFO_LIST: {
|
|
|
|
TRACE_(dmfile)(": UNFO list\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
|
|
|
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
|
2004-02-25 02:30:03 +01:00
|
|
|
switch (Chunk.fccID) {
|
|
|
|
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
|
|
|
|
(though strings seem to be valid unicode) */
|
|
|
|
case mmioFOURCC('I','N','A','M'):
|
|
|
|
case DMUS_FOURCC_UNAM_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": name chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_NAME;
|
|
|
|
IStream_Read (pStm, This->pDesc->wszName, Chunk.dwSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','A','R','T'):
|
|
|
|
case DMUS_FOURCC_UART_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": artist chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','C','O','P'):
|
|
|
|
case DMUS_FOURCC_UCOP_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": copyright chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','S','B','J'):
|
|
|
|
case DMUS_FOURCC_USBJ_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": subject chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','C','M','T'):
|
|
|
|
case DMUS_FOURCC_UCMT_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": comment chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
|
2004-02-25 02:30:03 +01:00
|
|
|
} while (ListCount[0] < ListSize[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown (skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-08 23:50:59 +02:00
|
|
|
TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
|
2004-02-25 02:30:03 +01:00
|
|
|
} while (StreamCount < StreamSize);
|
|
|
|
} else {
|
|
|
|
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
|
|
|
|
liMove.QuadPart = StreamSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE_(dmfile)(": reading finished\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
|
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
|
|
|
return DMUS_E_INVALIDFILE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:58:01 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IPersistStreamVtbl DirectMusicWave_PersistStream_Vtbl = {
|
2004-01-20 01:21:40 +01:00
|
|
|
IDirectMusicWaveImpl_IPersistStream_QueryInterface,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_AddRef,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_Release,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_GetClassID,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_IsDirty,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_Load,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_Save,
|
|
|
|
IDirectMusicWaveImpl_IPersistStream_GetSizeMax
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* for ClassFactory */
|
|
|
|
HRESULT WINAPI DMUSIC_CreateDirectMusicWaveImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
|
|
|
IDirectMusicWaveImpl* obj;
|
|
|
|
|
|
|
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveImpl));
|
|
|
|
if (NULL == obj) {
|
2004-12-22 16:13:20 +01:00
|
|
|
*ppobj = NULL;
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
obj->UnknownVtbl = &DirectMusicWave_Unknown_Vtbl;
|
2008-12-16 21:09:01 +01:00
|
|
|
obj->SegmentVtbl = &DirectMusicSegment8_Segment_Vtbl;
|
2004-01-20 01:21:40 +01:00
|
|
|
obj->ObjectVtbl = &DirectMusicWave_Object_Vtbl;
|
|
|
|
obj->PersistStreamVtbl = &DirectMusicWave_PersistStream_Vtbl;
|
|
|
|
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
|
|
|
|
DM_STRUCT_INIT(obj->pDesc);
|
|
|
|
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
2008-02-26 21:20:15 +01:00
|
|
|
obj->pDesc->guidClass = CLSID_DirectMusicSegment; /* shown by tests */
|
2004-01-20 01:21:40 +01:00
|
|
|
obj->ref = 0; /* will be inited by QueryInterface */
|
2008-02-26 21:20:15 +01:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
return IDirectMusicWaveImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);
|
|
|
|
}
|