2003-07-22 00:10:14 +02:00
|
|
|
/* IDirectMusicSynthSink Implementation
|
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmsynth_private.h"
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicSynthSinkImpl IUnknown part: */
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID (riid, &IID_IDirectMusicSynthSink)) {
|
2006-06-10 11:57:03 +02:00
|
|
|
IUnknown_AddRef(iface);
|
2003-07-22 00:10:14 +02:00
|
|
|
*ppobj = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2004-02-25 02:30:03 +01:00
|
|
|
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
2003-07-22 00:10:14 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
|
|
|
|
2005-01-31 21:40:26 +01:00
|
|
|
DMSYNTH_LockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
|
|
|
|
|
|
|
|
if (!refCount) {
|
2003-07-22 00:10:14 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
2005-01-31 21:40:26 +01:00
|
|
|
|
|
|
|
DMSYNTH_UnlockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicSynthSinkImpl IDirectMusicSynthSink part: */
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %p): stub\n", This, pSynth);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* pClock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %p): stub\n", This, pClock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** ppClock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %p): stub\n", This, ppClock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_Activate (LPDIRECTMUSICSYNTHSINK iface, BOOL fEnable) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %d): stub\n", This, fEnable);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface, LONGLONG llSampleTime, REFERENCE_TIME* prfTime) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2006-09-11 22:51:14 +02:00
|
|
|
FIXME("(%p, 0x%s, %p): stub\n", This, wine_dbgstr_longlong(llSampleTime), prfTime);
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME rfTime, LONGLONG* pllSampleTime) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2006-09-11 22:51:14 +02:00
|
|
|
FIXME("(%p, 0x%s, %p): stub\n", This, wine_dbgstr_longlong(rfTime), pllSampleTime );
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:03 +02:00
|
|
|
static HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
|
2003-07-22 00:10:14 +02:00
|
|
|
FIXME("(%p, %p): stub\n", This, pdwBufferSizeInSamples);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusicSynthSinkVtbl DirectMusicSynthSink_Vtbl = {
|
2003-07-22 00:10:14 +02:00
|
|
|
IDirectMusicSynthSinkImpl_QueryInterface,
|
|
|
|
IDirectMusicSynthSinkImpl_AddRef,
|
|
|
|
IDirectMusicSynthSinkImpl_Release,
|
|
|
|
IDirectMusicSynthSinkImpl_Init,
|
|
|
|
IDirectMusicSynthSinkImpl_SetMasterClock,
|
|
|
|
IDirectMusicSynthSinkImpl_GetLatencyClock,
|
|
|
|
IDirectMusicSynthSinkImpl_Activate,
|
|
|
|
IDirectMusicSynthSinkImpl_SampleToRefTime,
|
|
|
|
IDirectMusicSynthSinkImpl_RefTimeToSample,
|
|
|
|
IDirectMusicSynthSinkImpl_SetDirectSound,
|
|
|
|
IDirectMusicSynthSinkImpl_GetDesiredBufferSize
|
|
|
|
};
|
|
|
|
|
|
|
|
/* for ClassFactory */
|
2004-01-20 01:21:40 +01:00
|
|
|
HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSinkImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
|
|
|
IDirectMusicSynthSinkImpl *obj;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
|
|
|
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl));
|
|
|
|
if (NULL == obj) {
|
|
|
|
*ppobj = (LPDIRECTMUSICSYNTHSINK) NULL;
|
|
|
|
return E_OUTOFMEMORY;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
2004-01-20 01:21:40 +01:00
|
|
|
obj->lpVtbl = &DirectMusicSynthSink_Vtbl;
|
|
|
|
obj->ref = 0;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
return IDirectMusicSynthSinkImpl_QueryInterface((LPDIRECTMUSICSYNTHSINK)obj, lpcGUID, ppobj);
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|