Commit bba49757 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- always use IDirectMusicPerformance8Impl instead of

IDirectMusicPerformanceImpl (as the first inherits from the second) - implement many Loader, AudioPath and Performance8 stubs - fix the class factory - more debug traces - for now IDirectMusicLoader8::LoadObjectFromFile always returns not supported format - fix the IDirectMusicPerformance8::Init (many crashes) - implementation of IDirectMusicPerformance8InitAudio
parent 77c00c95
......@@ -24,6 +24,7 @@
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "dmusic_private.h"
......@@ -64,12 +65,13 @@ ULONG WINAPI IDirectMusicLoaderImpl_Release (LPDIRECTMUSICLOADER iface)
}
/* IDirectMusicLoader Interface follow: */
HRESULT WINAPI IDirectMusicLoaderImpl_GetObject (LPDIRECTMUSICLOADER iface, LPDMUS_OBJECTDESC pDesc, REFIID riid, LPVOID*ppv)
HRESULT WINAPI IDirectMusicLoaderImpl_GetObject (LPDIRECTMUSICLOADER iface, LPDMUS_OBJECTDESC pDesc, REFIID riid, LPVOID* ppv)
{
ICOM_THIS(IDirectMusicLoaderImpl,iface);
FIXME("(%p, %p, %s, %p): stub\n", This, pDesc, debugstr_guid(riid), ppv);
*ppv = NULL;
return S_OK;
}
......@@ -84,11 +86,15 @@ HRESULT WINAPI IDirectMusicLoaderImpl_SetObject (LPDIRECTMUSICLOADER iface, LPDM
HRESULT WINAPI IDirectMusicLoaderImpl_SetSearchDirectory (LPDIRECTMUSICLOADER iface, REFGUID rguidClass, WCHAR* pwzPath, BOOL fClear)
{
ICOM_THIS(IDirectMusicLoaderImpl,iface);
FIXME("(%p, %s, %p, %d): stub\n", This, debugstr_guid(rguidClass), pwzPath, fClear);
ICOM_THIS(IDirectMusicLoaderImpl,iface);
FIXME("(%p, %s, %p, %d): to check\n", This, debugstr_guid(rguidClass), pwzPath, fClear);
return S_OK;
if (0 == strncmpW(This->searchPath, pwzPath, MAX_PATH)) {
return S_FALSE;
}
strncpyW(This->searchPath, pwzPath, MAX_PATH);
return DS_OK;
}
HRESULT WINAPI IDirectMusicLoaderImpl_ScanDirectory (LPDIRECTMUSICLOADER iface, REFGUID rguidClass, WCHAR* pwzFileExtension, WCHAR* pwzScanFileName)
......@@ -201,10 +207,11 @@ ULONG WINAPI IDirectMusicLoader8Impl_Release (LPDIRECTMUSICLOADER8 iface)
HRESULT WINAPI IDirectMusicLoader8Impl_GetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc, REFIID riid, LPVOID*ppv)
{
ICOM_THIS(IDirectMusicLoader8Impl,iface);
FIXME("(%p, %p, %s, %p): stub\n", This, pDesc, debugstr_guid(riid), ppv);
return S_OK;
*ppv = NULL;
return DS_OK;
}
HRESULT WINAPI IDirectMusicLoader8Impl_SetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc)
......@@ -220,9 +227,9 @@ HRESULT WINAPI IDirectMusicLoader8Impl_SetSearchDirectory (LPDIRECTMUSICLOADER8
{
ICOM_THIS(IDirectMusicLoader8Impl,iface);
FIXME("(%p, %s, %p, %d): stub\n", This, debugstr_guid(rguidClass), pwzPath, fClear);
FIXME("(%p, %s, %p, %d): forward to IDirectMusicLoaderImpl::SetSearchDirectory\n", This, debugstr_guid(rguidClass), pwzPath, fClear);
return S_OK;
return IDirectMusicLoaderImpl_SetSearchDirectory((LPDIRECTMUSICLOADER) iface, rguidClass, pwzPath, fClear);
}
HRESULT WINAPI IDirectMusicLoader8Impl_ScanDirectory (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, WCHAR* pwzFileExtension, WCHAR* pwzScanFileName)
......@@ -296,13 +303,26 @@ HRESULT WINAPI IDirectMusicLoader8Impl_ReleaseObjectByUnknown (LPDIRECTMUSICLOAD
return S_OK;
}
HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClassID, REFIID iidInterfaceID, WCHAR* pwzFilePath, void** ppObject)
HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8 iface,
REFGUID rguidClassID,
REFIID iidInterfaceID,
WCHAR* pwzFilePath,
void** ppObject)
{
ICOM_THIS(IDirectMusicLoader8Impl,iface);
FIXME("(%p, %s, %s, %p, %p): stub\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), pwzFilePath, ppObject);
FIXME("(%p, %s, %s, %s, %p): stub\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject);
return S_OK;
if (IsEqualGUID(iidInterfaceID, &CLSID_DirectSoundWave)) {
FIXME("wanted 'wav'\n");
} else if (IsEqualGUID(iidInterfaceID, &CLSID_DirectMusicScript)) {
FIXME("wanted 'spt'\n");
} else if (IsEqualGUID(iidInterfaceID, &CLSID_DirectMusicContainer)) {
FIXME("wanted 'con'\n");
}
/** for now alway return not supported for avoiding futur crash */
return DMUS_E_LOADER_FORMATNOTSUPPORTED;
}
ICOM_VTABLE(IDirectMusicLoader8) DirectMusicLoader8_Vtbl =
......@@ -330,7 +350,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoader8 (LPCGUID lpcGUID, LPDIRECTMUSICLO
IDirectMusicLoader8Impl *dmloader8;
TRACE("(%p,%p,%p)\n",lpcGUID, ppDMLoad8, pUnkOuter);
if (IsEqualGUID(lpcGUID, &IID_IDirectMusicLoader8))
if (IsEqualGUID(lpcGUID, &IID_IDirectMusicLoader)
|| IsEqualGUID(lpcGUID, &IID_IDirectMusicLoader8))
{
dmloader8 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicImpl));
if (NULL == dmloader8)
......
......@@ -60,32 +60,30 @@ static HRESULT WINAPI DMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE ("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (IsEqualGUID (&IID_IDirectMusic, riid))
{
return DMUSIC_CreateDirectMusic (riid, (LPDIRECTMUSIC*)ppobj, pOuter);
TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
if (IsEqualGUID (&IID_IDirectMusic, riid)) {
return DMUSIC_CreateDirectMusic (riid, (LPDIRECTMUSIC*) ppobj, pOuter);
}
if (IsEqualGUID (&IID_IDirectMusicPerformance, riid))
if (IsEqualGUID (&IID_IDirectMusicPerformance, riid) ||
IsEqualGUID (&IID_IDirectMusicPerformance8, riid))
{
return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE*)ppobj, pOuter);
/*return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE*) ppobj, pOuter);*/
return DMUSIC_CreateDirectMusicPerformance8(riid, (LPDIRECTMUSICPERFORMANCE8*) ppobj, pOuter);
}
if (IsEqualGUID (&IID_IDirectMusicPerformance8, riid))
{
return DMUSIC_CreateDirectMusicPerformance8 (riid, (LPDIRECTMUSICPERFORMANCE8*)ppobj, pOuter);
if (IsEqualGUID (&IID_IDirectMusicLoader, riid) ||
IsEqualGUID (&IID_IDirectMusicLoader8, riid)) {
return DMUSIC_CreateDirectMusicLoader8(riid, (LPDIRECTMUSICLOADER8*) ppobj, pOuter);
}
/*if (IsEqualGUID (&IID_IDirectMusicLoader8, riid))
{
return DMUSIC_CreateDirectMusicLoader8 (riid, (LPDIRECTMUSICLOADER8*)ppobj, pOuter);
}*/
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI DMCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
FIXME("(%p)->(%d),stub!\n", This, dolock);
return S_OK;
}
......@@ -141,13 +139,11 @@ HRESULT WINAPI DMUSIC_DllCanUnloadNow(void)
HRESULT WINAPI DMUSIC_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if (IsEqualCLSID (&IID_IClassFactory, riid))
{
*ppv = (LPVOID)&DMUSIC_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
if (IsEqualCLSID (&IID_IClassFactory, riid)) {
*ppv = (LPVOID) &DMUSIC_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
......
......@@ -215,7 +215,65 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH
FIXME("(%p, %ld, %ld, %ld, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_guid(guidObject), dwIndex, debugstr_guid(iidInterface), ppObject);
return S_OK;
switch (dwStage) {
case DMUS_PATH_AUDIOPATH_GRAPH:
{
if (IsEqualGUID(iidInterface, &IID_IDirectMusicGraph)) {
if (NULL == This->toolGraph) {
IDirectMusicGraphImpl* pGraph;
pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
pGraph->ref = 1;
This->toolGraph = (IDirectMusicGraph*) pGraph;
}
*ppObject = (LPDIRECTMUSICGRAPH) This->toolGraph;
IDirectMusicGraphImpl_AddRef((LPDIRECTMUSICGRAPH) *ppObject);
return S_OK;
}
}
break;
case DMUS_PATH_AUDIOPATH_TOOL:
{
/* TODO */
}
break;
case DMUS_PATH_PERFORMANCE:
{
/* TODO check wanted GUID */
*ppObject = (LPDIRECTMUSICPERFORMANCE) This->perfo;
IDirectMusicPerformanceImpl_AddRef((LPDIRECTMUSICPERFORMANCE) *ppObject);
return S_OK;
}
break;
case DMUS_PATH_PERFORMANCE_GRAPH:
{
IDirectMusicGraph* pPerfoGraph = NULL;
IDirectMusicPerformanceImpl_GetGraph((LPDIRECTMUSICPERFORMANCE) This->perfo, &pPerfoGraph);
if (NULL == pPerfoGraph) {
IDirectMusicGraphImpl* pGraph = NULL;
pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
pGraph->ref = 1;
IDirectMusicPerformanceImpl_SetGraph((LPDIRECTMUSICPERFORMANCE) This->perfo, pGraph);
/* we need release as SetGraph do an AddRef */
IDirectMusicGraphImpl_Release((LPDIRECTMUSICGRAPH) pGraph);
pPerfoGraph = (LPDIRECTMUSICGRAPH) pGraph;
}
*ppObject = (LPDIRECTMUSICGRAPH) pPerfoGraph;
return S_OK;
}
break;
case DMUS_PATH_PERFORMANCE_TOOL:
default:
break;
}
*ppObject = NULL;
return E_INVALIDARG;
}
HRESULT WINAPI IDirectMusicAudioPathImpl_Activate (LPDIRECTMUSICAUDIOPATH iface, BOOL fActivate)
......@@ -704,20 +762,66 @@ HRESULT WINAPI IDirectMusicGraphImpl_StampPMsg (LPDIRECTMUSICGRAPH iface, DMUS_P
HRESULT WINAPI IDirectMusicGraphImpl_InsertTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool, DWORD* pdwPChannels, DWORD cPChannels, LONG lIndex)
{
ICOM_THIS(IDirectMusicGraphImpl,iface);
FIXME("(%p, %p, %p, %ld, %li): stub\n", This, pTool, pdwPChannels, cPChannels, lIndex);
return S_OK;
int i;
IDirectMusicToolImpl* p;
IDirectMusicToolImpl* toAdd = (IDirectMusicToolImpl*) pTool;
ICOM_THIS(IDirectMusicGraphImpl,iface);
FIXME("(%p, %p, %p, %ld, %li): use of pdwPChannels\n", This, pTool, pdwPChannels, cPChannels, lIndex);
if (0 == This->num_tools) {
This->first = This->last = toAdd;
toAdd->prev = toAdd->next = NULL;
} else if (lIndex == 0 || lIndex <= -This->num_tools) {
This->first->prev = toAdd;
toAdd->next = This->first;
toAdd->prev = NULL;
This->first = toAdd;
} else if (lIndex < 0) {
p = This->last;
for (i = 0; i < -lIndex; ++i) {
p = p->prev;
}
toAdd->next = p->next;
if (p->next) p->next->prev = toAdd;
p->next = toAdd;
toAdd->prev = p;
} else if (lIndex >= This->num_tools) {
This->last->next = toAdd;
toAdd->prev = This->last;
toAdd->next = NULL;
This->last = toAdd;
} else if (lIndex > 0) {
p = This->first;
for (i = 0; i < lIndex; ++i) {
p = p->next;
}
toAdd->prev = p->prev;
if (p->prev) p->prev->next = toAdd;
p->prev = toAdd;
toAdd->next = p;
}
++This->num_tools;
return DS_OK;
}
HRESULT WINAPI IDirectMusicGraphImpl_GetTool (LPDIRECTMUSICGRAPH iface, DWORD dwIndex, IDirectMusicTool** ppTool)
{
ICOM_THIS(IDirectMusicGraphImpl,iface);
int i;
IDirectMusicToolImpl* p = NULL;
ICOM_THIS(IDirectMusicGraphImpl,iface);
FIXME("(%p, %ld, %p): stub\n", This, dwIndex, ppTool);
return S_OK;
p = This->first;
for (i = 0; i < dwIndex && i < This->num_tools; ++i) {
p = p->next;
}
*ppTool = (IDirectMusicTool*) p;
if (NULL != *ppTool) {
IDirectMusicToolImpl_AddRef(*ppTool);
}
return DS_OK;
}
HRESULT WINAPI IDirectMusicGraphImpl_RemoveTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool)
......
......@@ -543,6 +543,8 @@ struct IDirectMusicToolImpl
DWORD ref;
/* IDirectMusicToolImpl fields */
IDirectMusicToolImpl* prev;
IDirectMusicToolImpl* next;
};
/* IUnknown: */
......@@ -567,6 +569,8 @@ struct IDirectMusicTool8Impl
DWORD ref;
/* IDirectMusicTool8Impl fields */
IDirectMusicToolImpl* prev;
IDirectMusicToolImpl* next;
};
/* IUnknown: */
......@@ -698,6 +702,7 @@ struct IDirectMusicLoaderImpl
DWORD ref;
/* IDirectMusicLoaderImpl fields */
WCHAR searchPath[MAX_PATH];
};
/* IUnknown: */
......@@ -725,6 +730,8 @@ struct IDirectMusicLoader8Impl
DWORD ref;
/* IDirectMusicLoader8Impl fields */
WCHAR searchPath[MAX_PATH];
/* IDirectMusicLoader8Impl fields */
};
/* IUnknown: */
......@@ -914,6 +921,8 @@ struct IDirectMusicAudioPathImpl
DWORD ref;
/* IDirectMusicAudioPathImpl fields */
IDirectMusicPerformance* perfo;
IDirectMusicGraph* toolGraph;
};
/* IUnknown: */
......@@ -933,17 +942,19 @@ struct IDirectMusicPerformanceImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirectMusicPerformance);
DWORD ref;
DWORD ref;
/* IDirectMusicPerformanceImpl fields */
IDirectMusicImpl *dmusic;
IDirectSound *dsound;
IDirectMusic* dmusic;
IDirectSound* dsound;
IDirectMusicGraph* toolGraph;
DMUS_AUDIOPARAMS params;
/* global parameters */
BOOL AutoDownload;
char MasterGrooveLevel;
BOOL AutoDownload;
char MasterGrooveLevel;
float MasterTempo;
long MasterVolume;
long MasterVolume;
/* performance channels */
DMUSIC_PRIVATE_PCHANNEL PChannel[1];
......@@ -1005,11 +1016,25 @@ struct IDirectMusicPerformance8Impl
{
/* IUnknown fields */
ICOM_VFIELD(IDirectMusicPerformance8);
DWORD ref;
DWORD ref;
/* IDirectMusicPerformanceImpl fields */
IDirectMusic* dmusic;
IDirectSound* dsound;
IDirectMusicGraph* toolGraph;
DMUS_AUDIOPARAMS params;
/* global parameters */
BOOL AutoDownload;
char MasterGrooveLevel;
float MasterTempo;
long MasterVolume;
/* performance channels */
DMUSIC_PRIVATE_PCHANNEL PChannel[1];
/* IDirectMusicPerformance8Impl fields */
IDirectMusicImpl *dmusic;
IDirectSound *dsound;
/* IDirectMusicPerformance8Impl fields */
IDirectMusicAudioPath* default_path;
};
/* IUnknown: */
......@@ -1081,6 +1106,9 @@ struct IDirectMusicGraphImpl
DWORD ref;
/* IDirectMusicGraphImpl fields */
IDirectMusicToolImpl* first;
IDirectMusicToolImpl* last;
WORD num_tools;
};
/* IUnknown: */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment