2003-07-22 00:10:14 +02:00
|
|
|
/* IDirectMusicAudioPath Implementation
|
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
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.
|
2003-07-22 00:10:14 +02: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.
|
2003-07-22 00:10:14 +02: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
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmime_private.h"
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
|
2004-01-20 01:21:40 +01:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2015-04-27 00:49:04 +02:00
|
|
|
struct IDirectMusicAudioPathImpl {
|
2015-04-27 09:49:11 +02:00
|
|
|
IDirectMusicAudioPath IDirectMusicAudioPath_iface;
|
|
|
|
IDirectMusicObject IDirectMusicObject_iface;
|
|
|
|
IPersistStream IPersistStream_iface;
|
|
|
|
LONG ref;
|
2015-04-27 00:49:04 +02:00
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
/* IDirectMusicAudioPathImpl fields */
|
|
|
|
LPDMUS_OBJECTDESC pDesc;
|
2015-04-27 00:49:04 +02:00
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
IDirectMusicPerformance8* pPerf;
|
|
|
|
IDirectMusicGraph* pToolGraph;
|
|
|
|
IDirectSoundBuffer* pDSBuffer;
|
|
|
|
IDirectSoundBuffer* pPrimary;
|
2015-04-27 00:49:04 +02:00
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
BOOL fActive;
|
2015-04-27 00:49:04 +02:00
|
|
|
};
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static inline struct IDirectMusicAudioPathImpl *impl_from_IDirectMusicAudioPath(IDirectMusicAudioPath *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct IDirectMusicAudioPathImpl, IDirectMusicAudioPath_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct IDirectMusicAudioPathImpl *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct IDirectMusicAudioPathImpl, IDirectMusicObject_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct IDirectMusicAudioPathImpl *impl_from_IPersistStream(IPersistStream *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct IDirectMusicAudioPathImpl, IPersistStream_iface);
|
|
|
|
}
|
|
|
|
|
2015-04-27 00:49:04 +02:00
|
|
|
void set_audiopath_perf_pointer(IDirectMusicAudioPath *iface, IDirectMusicPerformance8 *performance)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-04-27 00:49:04 +02:00
|
|
|
This->pPerf = performance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_audiopath_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-04-27 00:49:04 +02:00
|
|
|
This->pDSBuffer = buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-04-27 00:49:04 +02:00
|
|
|
This->pPrimary = buffer;
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicAudioPathImpl implementation
|
|
|
|
*/
|
2015-04-27 01:10:26 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface (IDirectMusicAudioPath *iface, REFIID riid, void **ppobj)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
2005-01-11 17:02:21 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
*ppobj = NULL;
|
2005-01-11 17:02:21 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
if (IsEqualIID (riid, &IID_IDirectMusicAudioPath) || IsEqualIID (riid, &IID_IUnknown))
|
2015-04-27 09:49:11 +02:00
|
|
|
*ppobj = &This->IDirectMusicAudioPath_iface;
|
2015-04-27 01:10:26 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IDirectMusicObject))
|
2015-04-27 09:49:11 +02:00
|
|
|
*ppobj = &This->IDirectMusicObject_iface;
|
2015-04-27 01:10:26 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IPersistStream))
|
2015-04-27 09:49:11 +02:00
|
|
|
*ppobj = &This->IPersistStream_iface;
|
2005-02-02 10:31:06 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
if (*ppobj) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppobj);
|
|
|
|
return S_OK;
|
2004-05-10 21:56:17 +02:00
|
|
|
}
|
2005-02-02 10:31:06 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
|
|
|
return E_NOINTERFACE;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
static ULONG WINAPI IDirectMusicAudioPathImpl_AddRef (IDirectMusicAudioPath *iface)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-04-27 01:10:26 +02:00
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
TRACE("(%p): AddRef from %d\n", This, ref - 1);
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
DMIME_LockModule();
|
|
|
|
return ref;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
|
2015-04-27 01:10:26 +02:00
|
|
|
static ULONG WINAPI IDirectMusicAudioPathImpl_Release (IDirectMusicAudioPath *iface)
|
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-04-27 01:10:26 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p): ReleaseRef to %d\n", This, ref);
|
|
|
|
|
|
|
|
if (ref == 0) {
|
|
|
|
if (This->pDSBuffer)
|
|
|
|
IDirectSoundBuffer8_Release(This->pDSBuffer);
|
|
|
|
This->pPerf = NULL;
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
|
|
|
|
|
|
|
DMIME_UnlockModule();
|
|
|
|
return ref;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (IDirectMusicAudioPath *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer,
|
|
|
|
REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2015-05-06 08:49:33 +02:00
|
|
|
HRESULT hr;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject),
|
|
|
|
dwIndex, debugstr_dmguid(iidInterface), ppObject);
|
2004-05-05 03:32:55 +02:00
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
switch (dwStage) {
|
2014-02-26 10:03:35 +01:00
|
|
|
case DMUS_PATH_BUFFER:
|
|
|
|
if (This->pDSBuffer)
|
|
|
|
{
|
|
|
|
if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) {
|
|
|
|
IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject);
|
|
|
|
TRACE("returning %p\n",*ppObject);
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) {
|
|
|
|
IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject);
|
|
|
|
TRACE("returning %p\n",*ppObject);
|
|
|
|
return S_OK;
|
|
|
|
} else {
|
|
|
|
FIXME("Bad iid\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
case DMUS_PATH_PRIMARY_BUFFER: {
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) {
|
|
|
|
IDirectSoundBuffer8_QueryInterface (This->pPrimary, &IID_IDirectSound3DListener, ppObject);
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
2003-08-23 01:53:27 +02:00
|
|
|
} else {
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("bad iid...\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DMUS_PATH_AUDIOPATH_GRAPH:
|
|
|
|
{
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) {
|
2003-07-22 00:10:14 +02:00
|
|
|
if (NULL == This->pToolGraph) {
|
|
|
|
IDirectMusicGraphImpl* pGraph;
|
2015-05-06 08:49:33 +02:00
|
|
|
hr = create_dmgraph(&IID_IDirectMusicGraph, (void**)&pGraph);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2003-07-22 00:10:14 +02:00
|
|
|
This->pToolGraph = (IDirectMusicGraph*) pGraph;
|
|
|
|
}
|
2007-12-08 00:01:46 +01:00
|
|
|
*ppObject = This->pToolGraph;
|
2004-01-20 01:21:40 +01:00
|
|
|
IDirectMusicGraph_AddRef((LPDIRECTMUSICGRAPH) *ppObject);
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DMUS_PATH_AUDIOPATH_TOOL:
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DMUS_PATH_PERFORMANCE:
|
|
|
|
{
|
|
|
|
/* TODO check wanted GUID */
|
2007-12-08 00:01:46 +01:00
|
|
|
*ppObject = This->pPerf;
|
2005-06-21 11:44:28 +02:00
|
|
|
IUnknown_AddRef((LPUNKNOWN) *ppObject);
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DMUS_PATH_PERFORMANCE_GRAPH:
|
|
|
|
{
|
|
|
|
IDirectMusicGraph* pPerfoGraph = NULL;
|
2007-12-08 00:01:46 +01:00
|
|
|
IDirectMusicPerformance8_GetGraph(This->pPerf, &pPerfoGraph);
|
2003-07-22 00:10:14 +02:00
|
|
|
if (NULL == pPerfoGraph) {
|
|
|
|
IDirectMusicGraphImpl* pGraph = NULL;
|
2015-05-06 08:49:33 +02:00
|
|
|
hr = create_dmgraph(&IID_IDirectMusicGraph, (void**)&pGraph);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2007-12-08 00:01:46 +01:00
|
|
|
IDirectMusicPerformance8_SetGraph(This->pPerf, (IDirectMusicGraph*) pGraph);
|
2003-07-22 00:10:14 +02:00
|
|
|
/* we need release as SetGraph do an AddRef */
|
2004-01-20 01:21:40 +01:00
|
|
|
IDirectMusicGraph_Release((LPDIRECTMUSICGRAPH) pGraph);
|
2003-07-22 00:10:14 +02:00
|
|
|
pPerfoGraph = (LPDIRECTMUSICGRAPH) pGraph;
|
|
|
|
}
|
2007-12-08 00:01:46 +01:00
|
|
|
*ppObject = pPerfoGraph;
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DMUS_PATH_PERFORMANCE_TOOL:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppObject = NULL;
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicAudioPathImpl_Activate (IDirectMusicAudioPath *iface, BOOL fActivate)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2004-05-10 21:56:17 +02:00
|
|
|
FIXME("(%p, %d): stub\n", This, fActivate);
|
|
|
|
if (!fActivate) {
|
|
|
|
if (!This->fActive) return S_OK;
|
|
|
|
This->fActive = FALSE;
|
|
|
|
} else {
|
|
|
|
if (This->fActive) return S_OK;
|
|
|
|
This->fActive = TRUE;
|
2004-05-11 06:27:23 +02:00
|
|
|
if (NULL != This->pDSBuffer) {
|
|
|
|
IDirectSoundBuffer_Stop(This->pDSBuffer);
|
|
|
|
}
|
2004-05-10 21:56:17 +02:00
|
|
|
}
|
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume (IDirectMusicAudioPath *iface, LONG lVolume, DWORD dwDuration)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2009-01-10 02:44:57 +01:00
|
|
|
FIXME("(%p, %i, %d): stub\n", This, lVolume, dwDuration);
|
2004-05-19 06:32:43 +02:00
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel (IDirectMusicAudioPath *iface, DWORD dwPChannelIn, DWORD* pdwPChannelOut)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface);
|
2006-10-10 01:07:26 +02:00
|
|
|
FIXME("(%p, %d, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
|
2004-05-19 06:32:43 +02:00
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static const IDirectMusicAudioPathVtbl DirectMusicAudioPathVtbl = {
|
2015-04-27 01:10:26 +02:00
|
|
|
IDirectMusicAudioPathImpl_QueryInterface,
|
|
|
|
IDirectMusicAudioPathImpl_AddRef,
|
|
|
|
IDirectMusicAudioPathImpl_Release,
|
2015-04-27 09:49:11 +02:00
|
|
|
IDirectMusicAudioPathImpl_GetObjectInPath,
|
|
|
|
IDirectMusicAudioPathImpl_Activate,
|
|
|
|
IDirectMusicAudioPathImpl_SetVolume,
|
|
|
|
IDirectMusicAudioPathImpl_ConvertPChannel
|
2003-07-22 00:10:14 +02:00
|
|
|
};
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
/* IDirectMusicObject */
|
|
|
|
static HRESULT WINAPI DirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ppobj)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(iface);
|
|
|
|
return IDirectMusicAudioPath_QueryInterface(&This->IDirectMusicAudioPath_iface, riid, ppobj);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static ULONG WINAPI DirectMusicObject_AddRef(IDirectMusicObject *iface)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(iface);
|
|
|
|
return IDirectMusicAudioPath_AddRef(&This->IDirectMusicAudioPath_iface);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static ULONG WINAPI DirectMusicObject_Release(IDirectMusicObject *iface)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(iface);
|
|
|
|
return IDirectMusicAudioPath_Release(&This->IDirectMusicAudioPath_iface);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI DirectMusicObject_GetDescriptor(IDirectMusicObject *iface, LPDMUS_OBJECTDESC pDesc)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(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;
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI DirectMusicObject_SetDescriptor(IDirectMusicObject *iface, LPDMUS_OBJECTDESC pDesc)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(iface);
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
|
2008-02-23 16:19:04 +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-23 16:19:04 +01:00
|
|
|
This->pDesc->guidObject = pDesc->guidObject;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
|
2008-02-23 16:19:04 +01:00
|
|
|
This->pDesc->guidClass = pDesc->guidClass;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_NAME)
|
2005-04-18 12:30:55 +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-04-18 12:30:55 +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-04-18 12:30:55 +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-23 16:19:04 +01:00
|
|
|
This->pDesc->vVersion = pDesc->vVersion;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_DATE)
|
2008-02-23 16:19:04 +01:00
|
|
|
This->pDesc->ftDate = pDesc->ftDate;
|
2004-01-20 01:21:40 +01:00
|
|
|
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
|
2011-10-18 05:22:10 +02:00
|
|
|
This->pDesc->llMemLength = pDesc->llMemLength;
|
|
|
|
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength);
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|
|
|
|
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;
|
2003-08-23 01:53:27 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI DirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, IStream *pStream, DMUS_OBJECTDESC *pDesc)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicObject(iface);
|
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 */
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
TRACE("(%p, %p, %p)\n", This, pStream, pDesc);
|
2008-02-23 16:19:04 +01:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* FIXME: should this be determined from stream? */
|
|
|
|
pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
2014-01-10 11:08:38 +01:00
|
|
|
pDesc->guidClass = This->pDesc->guidClass;
|
2008-02-23 16:19:04 +01:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
2006-10-10 01:07:26 +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 == DMUS_FOURCC_AUDIOPATH_FORM) {
|
|
|
|
TRACE_(dmfile)(": audio path form\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
|
|
|
|
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
|
2006-10-10 01:07:26 +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-10 01:07:26 +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: {
|
2011-07-30 12:03:08 +02:00
|
|
|
TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
|
2004-01-20 01:21:40 +01:00
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-10 01:07:26 +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: {
|
2011-07-30 12:03:08 +02:00
|
|
|
TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
|
2004-01-20 01:21:40 +01:00
|
|
|
liMove.QuadPart = Chunk.dwSize;
|
|
|
|
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-10 01:07:26 +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:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc));
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static const IDirectMusicObjectVtbl DirectMusicObjectVtbl = {
|
|
|
|
DirectMusicObject_QueryInterface,
|
|
|
|
DirectMusicObject_AddRef,
|
|
|
|
DirectMusicObject_Release,
|
|
|
|
DirectMusicObject_GetDescriptor,
|
|
|
|
DirectMusicObject_SetDescriptor,
|
|
|
|
DirectMusicObject_ParseDescriptor
|
2003-08-23 01:53:27 +02:00
|
|
|
};
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
/* IPersistStream */
|
|
|
|
static HRESULT WINAPI PersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ppobj)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IPersistStream(iface);
|
|
|
|
return IDirectMusicAudioPath_QueryInterface(&This->IDirectMusicAudioPath_iface, riid, ppobj);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static ULONG WINAPI PersistStream_AddRef(IPersistStream *iface)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IPersistStream(iface);
|
|
|
|
return IDirectMusicAudioPath_AddRef(&This->IDirectMusicAudioPath_iface);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static ULONG WINAPI PersistStream_Release(IPersistStream *iface)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IPersistStream(iface);
|
|
|
|
return IDirectMusicAudioPath_Release(&This->IDirectMusicAudioPath_iface);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI PersistStream_GetClassID(IPersistStream *iface, CLSID* pClassID)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI PersistStream_IsDirty(IPersistStream *iface)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI PersistStream_Load(IPersistStream *iface, IStream *pStm)
|
|
|
|
{
|
|
|
|
struct IDirectMusicAudioPathImpl *This = impl_from_IPersistStream(iface);
|
2004-01-20 01:21:40 +01:00
|
|
|
|
|
|
|
FOURCC chunkID;
|
|
|
|
DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3];
|
|
|
|
LARGE_INTEGER liMove; /* used when skipping chunks */
|
|
|
|
|
|
|
|
FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
|
|
|
|
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
|
|
|
|
IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL);
|
2006-10-10 01:07:26 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (chunkID), chunkSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (chunkID) {
|
|
|
|
case FOURCC_RIFF: {
|
|
|
|
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunkID));
|
|
|
|
StreamSize = chunkSize - sizeof(FOURCC);
|
|
|
|
StreamCount = 0;
|
|
|
|
switch (chunkID) {
|
|
|
|
case DMUS_FOURCC_AUDIOPATH_FORM: {
|
|
|
|
TRACE_(dmfile)(": audio path form\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
|
|
|
|
IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL);
|
|
|
|
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + chunkSize;
|
2006-10-10 01:07:26 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (chunkID), chunkSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (chunkID) {
|
|
|
|
case DMUS_FOURCC_GUID_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": GUID chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_OBJECT;
|
|
|
|
IStream_Read (pStm, &This->pDesc->guidObject, chunkSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_VERSION_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": version chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_VERSION;
|
|
|
|
IStream_Read (pStm, &This->pDesc->vVersion, chunkSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DMUS_FOURCC_CATEGORY_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": category chunk\n");
|
|
|
|
This->pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
|
|
|
|
IStream_Read (pStm, This->pDesc->wszCategory, chunkSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FOURCC_LIST: {
|
|
|
|
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
|
|
|
|
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID));
|
|
|
|
ListSize[0] = chunkSize - sizeof(FOURCC);
|
|
|
|
ListCount[0] = 0;
|
|
|
|
switch (chunkID) {
|
|
|
|
case DMUS_FOURCC_UNFO_LIST: {
|
|
|
|
TRACE_(dmfile)(": UNFO list\n");
|
|
|
|
do {
|
|
|
|
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
|
|
|
|
IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL);
|
|
|
|
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize;
|
2006-10-10 01:07:26 +02:00
|
|
|
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (chunkID), chunkSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
switch (chunkID) {
|
|
|
|
/* 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, chunkSize, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mmioFOURCC('I','A','R','T'):
|
|
|
|
case DMUS_FOURCC_UART_CHUNK: {
|
|
|
|
TRACE_(dmfile)(": artist chunk (ignored)\n");
|
|
|
|
liMove.QuadPart = chunkSize;
|
|
|
|
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 = chunkSize;
|
|
|
|
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 = chunkSize;
|
|
|
|
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 = chunkSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
2011-07-30 12:03:08 +02:00
|
|
|
TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
|
2004-01-20 01:21:40 +01:00
|
|
|
liMove.QuadPart = chunkSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-10 01:07:26 +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 = chunkSize - sizeof(FOURCC);
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
2011-07-30 12:03:08 +02:00
|
|
|
TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
|
2004-01-20 01:21:40 +01:00
|
|
|
liMove.QuadPart = chunkSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-10-10 01:07:26 +02:00
|
|
|
TRACE_(dmfile)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount, StreamSize);
|
2004-01-20 01:21:40 +01:00
|
|
|
} while (StreamCount < StreamSize);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
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 = chunkSize;
|
|
|
|
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI PersistStream_Save(IPersistStream *iface, IStream *pStm, BOOL fClearDirty)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static HRESULT WINAPI PersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *pcbSize)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-27 09:49:11 +02:00
|
|
|
static const IPersistStreamVtbl PersistStreamVtbl = {
|
|
|
|
PersistStream_QueryInterface,
|
|
|
|
PersistStream_AddRef,
|
|
|
|
PersistStream_Release,
|
|
|
|
PersistStream_GetClassID,
|
|
|
|
PersistStream_IsDirty,
|
|
|
|
PersistStream_Load,
|
|
|
|
PersistStream_Save,
|
|
|
|
PersistStream_GetSizeMax
|
2003-08-23 01:53:27 +02:00
|
|
|
};
|
2004-01-20 01:21:40 +01:00
|
|
|
|
|
|
|
/* for ClassFactory */
|
2015-04-27 09:49:11 +02:00
|
|
|
HRESULT WINAPI create_dmaudiopath(REFIID riid, void **ppobj)
|
2014-01-10 10:41:27 +01:00
|
|
|
{
|
2015-04-27 09:49:11 +02:00
|
|
|
IDirectMusicAudioPathImpl* obj;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl));
|
|
|
|
if (NULL == obj) {
|
|
|
|
*ppobj = NULL;
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
obj->IDirectMusicAudioPath_iface.lpVtbl = &DirectMusicAudioPathVtbl;
|
|
|
|
obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicObjectVtbl;
|
|
|
|
obj->IPersistStream_iface.lpVtbl = &PersistStreamVtbl;
|
|
|
|
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
|
|
|
|
DM_STRUCT_INIT(obj->pDesc);
|
|
|
|
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
|
|
|
obj->pDesc->guidClass = CLSID_DirectMusicAudioPathConfig;
|
|
|
|
obj->ref = 1;
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_QueryInterface(&obj->IDirectMusicAudioPath_iface, riid, ppobj);
|
|
|
|
IDirectMusicAudioPath_Release(&obj->IDirectMusicAudioPath_iface);
|
|
|
|
return hr;
|
2004-01-20 01:21:40 +01:00
|
|
|
}
|