Some dmusic functions implementation.

This commit is contained in:
Rok Mandeljc 2003-04-27 00:35:30 +00:00 committed by Alexandre Julliard
parent 5101dfcdb2
commit ecaf53f172
5 changed files with 105 additions and 39 deletions

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = dmusic.dll
IMPORTS = user32 kernel32
IMPORTS = dsound winmm user32 kernel32
EXTRALIBS = $(LIBUUID)
LDDLLFLAGS = @LDDLLFLAGS@

View File

@ -100,8 +100,10 @@ HRESULT WINAPI IDirectMusicImpl_CreateMusicBuffer (LPDIRECTMUSIC iface, LPDMUS_B
HRESULT WINAPI IDirectMusicImpl_CreatePort (LPDIRECTMUSIC iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicImpl,iface);
FIXME("(%p, %s, %p, %p, %p): stub\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter);
return E_OUTOFMEMORY;
}
HRESULT WINAPI IDirectMusicImpl_EnumMasterClock (LPDIRECTMUSIC iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo)
@ -157,6 +159,34 @@ ICOM_VTABLE(IDirectMusic) DirectMusic_Vtbl =
IDirectMusicImpl_SetDirectSound
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, LPUNKNOWN pUnkOuter)
{
IDirectMusicImpl *dmusic;
TRACE("(%p,%p,%p)\n",lpcGUID, ppDM, pUnkOuter);
if (IsEqualGUID(lpcGUID, &IID_IDirectMusic))
{
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicImpl));
if (NULL == dmusic)
{
*ppDM = (LPDIRECTMUSIC)NULL;
return E_OUTOFMEMORY;
}
dmusic->lpVtbl = &DirectMusic_Vtbl;
dmusic->ref = 0;
*ppDM = (LPDIRECTMUSIC)dmusic;
return S_OK;
}
WARN("No interface found\n");
return E_NOINTERFACE;
}
/* IDirectMusic8 IUnknown parts follow: */
HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj)
{
@ -191,32 +221,6 @@ ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface)
return ref;
}
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, LPUNKNOWN pUnkOuter)
{
IDirectMusicImpl *dmusic;
TRACE("(%p,%p,%p)\n",lpcGUID, ppDM, pUnkOuter);
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicImpl));
if (NULL == dmusic)
{
*ppDM = (LPDIRECTMUSIC)NULL;
return E_OUTOFMEMORY;
}
dmusic->lpVtbl = &DirectMusic_Vtbl;
dmusic->ref = 1;
*ppDM = (LPDIRECTMUSIC)dmusic;
return S_OK;
WARN("No interface found\n");
return E_NOINTERFACE;
}
/* IDirectMusic8 Interface follow: */
HRESULT WINAPI IDirectMusic8Impl_EnumPort (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps)
{
@ -232,8 +236,9 @@ HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, LPDMUS
HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusic8Impl,iface);
FIXME("(%p, %s, %p, %p, %p): stub\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter);
return S_OK;
}
HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo)

View File

@ -28,8 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
*
*/
extern HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, LPUNKNOWN pUnkOuter);
typedef struct
{
/* IUnknown fields */
@ -67,6 +65,10 @@ static HRESULT WINAPI DMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter
{
return DMUSIC_CreateDirectMusic (riid, (LPDIRECTMUSIC*)ppobj, pOuter);
}
if (IsEqualGUID (&IID_IDirectMusicPerformance, riid))
{
return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE*)ppobj, pOuter);
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
@ -100,12 +102,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if (fdwReason == DLL_PROCESS_ATTACH)
{
/* FIXME: Initialisation */
FIXME("stub\n");
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
/* FIXME: Cleanup */
FIXME("stub\n");
}
return TRUE;

View File

@ -65,8 +65,36 @@ ULONG WINAPI IDirectMusicPerformanceImpl_Release (LPDIRECTMUSICPERFORMANCE iface
/* IDirectMusicPerformance Interface follow: */
HRESULT WINAPI IDirectMusicPerformanceImpl_Init (LPDIRECTMUSICPERFORMANCE iface, IDirectMusic** ppDirectMusic, LPDIRECTSOUND pDirectSound, HWND hWnd)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicPerformanceImpl,iface);
FIXME("(iface = %p, dmusic = %p (*dmusic = %p), dsound = %p, hwnd = %p): semi-stub\n", This, ppDirectMusic, *ppDirectMusic, pDirectSound, hWnd);
/* app creates it's own dmusic object and gives it to performance */
if (*ppDirectMusic)
{
TRACE("App provides DirectMusic\n");
/* FIXME: is this correct? */
memcpy(This->dmusic, *ppDirectMusic, sizeof(*ppDirectMusic));
IDirectMusic_AddRef(This->dmusic);
/* app is supposed to be in charge of everything else */
return S_OK;
}
/* app allows the performance to initialise itfself and needs a pointer to object*/
if (!*ppDirectMusic)
{
TRACE("DirectMusic to be created; needed\n");
if (!This->dmusic)
DMUSIC_CreateDirectMusic(&IID_IDirectMusic, &This->dmusic, NULL);
*ppDirectMusic = This->dmusic;
if (*ppDirectMusic)
IDirectMusic_AddRef(*ppDirectMusic);
}
/* app allows the performance to initialise itself and does not need a pointer to object*/
if (!ppDirectMusic)
{
TRACE("DirectMusic to be created; not needed\n");
}
return S_OK;
}
HRESULT WINAPI IDirectMusicPerformanceImpl_PlaySegment (LPDIRECTMUSICPERFORMANCE iface, IDirectMusicSegment* pSegment, DWORD dwFlags, __int64 i64StartTime, IDirectMusicSegmentState** ppSegmentState)
@ -275,8 +303,9 @@ HRESULT WINAPI IDirectMusicPerformanceImpl_AdjustTime (LPDIRECTMUSICPERFORMANCE
HRESULT WINAPI IDirectMusicPerformanceImpl_CloseDown (LPDIRECTMUSICPERFORMANCE iface)
{
FIXME("stub\n");
return DS_OK;
ICOM_THIS(IDirectMusicPerformanceImpl,iface);
FIXME("(%p): semi-stub\n", This);
return S_OK;
}
HRESULT WINAPI IDirectMusicPerformanceImpl_GetResolvedTime (LPDIRECTMUSICPERFORMANCE iface, REFERENCE_TIME rtTime, REFERENCE_TIME* prtResolved, DWORD dwTimeResolveFlags)
@ -358,6 +387,30 @@ ICOM_VTABLE(IDirectMusicPerformance) DirectMusicPerformance_Vtbl =
IDirectMusicPerformanceImpl_RhythmToTime
};
HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE *ppDMPerf, LPUNKNOWN pUnkOuter)
{
IDirectMusicPerformanceImpl *pPerf;
TRACE("(%p,%p,%p)\n",lpcGUID, ppDMPerf, pUnkOuter);
if (IsEqualGUID(lpcGUID, &IID_IDirectMusicPerformance))
{
pPerf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPerformanceImpl));
if (NULL == pPerf)
{
*ppDMPerf = (LPDIRECTMUSICPERFORMANCE)NULL;
return E_OUTOFMEMORY;
}
pPerf->lpVtbl = &DirectMusicPerformance_Vtbl;
pPerf->ref = 1;
*ppDMPerf = (LPDIRECTMUSICPERFORMANCE)pPerf;
return S_OK;
}
WARN("No interface found\n");
return E_NOINTERFACE;
}
/* IDirectMusicPerformance8 IUnknown parts follow: */
HRESULT WINAPI IDirectMusicPerformance8Impl_QueryInterface (LPDIRECTMUSICPERFORMANCE8 iface, REFIID riid, LPVOID *ppobj)

View File

@ -150,6 +150,9 @@ extern HRESULT WINAPI IDirectMusicImpl_Activate (LPDIRECTMUSIC iface, BOOL fEnab
extern HRESULT WINAPI IDirectMusicImpl_GetDefaultPort (LPDIRECTMUSIC iface, LPGUID pguidPort);
extern HRESULT WINAPI IDirectMusicImpl_SetDirectSound (LPDIRECTMUSIC iface, LPDIRECTSOUND pDirectSound, HWND hWnd);
/* ClassFactory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, LPUNKNOWN pUnkOuter);
/*****************************************************************************
* IDirectMusic8Impl implementation structure
*/
@ -890,6 +893,8 @@ struct IDirectMusicPerformanceImpl
DWORD ref;
/* IDirectMusicPerformanceImpl fields */
IDirectMusic *dmusic;
IDirectSound *dsound;
};
/* IUnknown: */
@ -939,6 +944,9 @@ extern HRESULT WINAPI IDirectMusicPerformanceImpl_MusicToMIDI (LPDIRECTMUSICPERF
extern HRESULT WINAPI IDirectMusicPerformanceImpl_TimeToRhythm (LPDIRECTMUSICPERFORMANCE iface, MUSIC_TIME mtTime, DMUS_TIMESIGNATURE* pTimeSig, WORD* pwMeasure, BYTE* pbBeat, BYTE* pbGrid, short* pnOffset);
extern HRESULT WINAPI IDirectMusicPerformanceImpl_RhythmToTime (LPDIRECTMUSICPERFORMANCE iface, WORD wMeasure, BYTE bBeat, BYTE bGrid, short nOffset, DMUS_TIMESIGNATURE* pTimeSig, MUSIC_TIME* pmtTime);
/* ClassFactory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPerformance (LPCGUID lpcGUID, LPDIRECTMUSICPERFORMANCE *ppDMPerf, LPUNKNOWN pUnkOuter);
/*****************************************************************************
* IDirectMusicPerformance8Impl implementation structure
*/