dmsynth: COM cleanup of IDirectMusicSynthSink and rename parameters.
[wine/multimedia.git] / dlls / dmsynth / synthsink.c
blob82ed894d3ac814a21bda3c48d4874ab45b8ceece
1 /*
2 * IDirectMusicSynthSink Implementation
4 * Copyright (C) 2003-2004 Rok Mandeljc
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "dmsynth_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
25 static inline IDirectMusicSynthSinkImpl *impl_from_IDirectMusicSynthSink(IDirectMusicSynthSink *iface)
27 return CONTAINING_RECORD(iface, IDirectMusicSynthSinkImpl, IDirectMusicSynthSink_iface);
30 /* IDirectMusicSynthSinkImpl IUnknown part: */
31 static HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface(LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj)
33 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
34 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
36 if (IsEqualIID (riid, &IID_IUnknown) ||
37 IsEqualIID (riid, &IID_IDirectMusicSynthSink)) {
38 IUnknown_AddRef(iface);
39 *ppobj = This;
40 return S_OK;
42 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
43 return E_NOINTERFACE;
46 static ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef(LPDIRECTMUSICSYNTHSINK iface)
48 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
49 ULONG refCount = InterlockedIncrement(&This->ref);
51 TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
53 DMSYNTH_LockModule();
55 return refCount;
58 static ULONG WINAPI IDirectMusicSynthSinkImpl_Release(LPDIRECTMUSICSYNTHSINK iface)
60 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
61 ULONG refCount = InterlockedDecrement(&This->ref);
63 TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
65 if (!refCount) {
66 HeapFree(GetProcessHeap(), 0, This);
69 DMSYNTH_UnlockModule();
71 return refCount;
74 /* IDirectMusicSynthSinkImpl IDirectMusicSynthSink part: */
75 static HRESULT WINAPI IDirectMusicSynthSinkImpl_Init(LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* synth)
77 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
79 FIXME("(%p)->(%p): stub\n", This, synth);
81 return S_OK;
84 static HRESULT WINAPI IDirectMusicSynthSinkImpl_SetMasterClock(LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* clock)
86 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
88 FIXME("(%p)->(%p): stub\n", This, clock);
90 return S_OK;
93 static HRESULT WINAPI IDirectMusicSynthSinkImpl_GetLatencyClock(LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** clock)
95 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
97 FIXME("(%p)->(%p): stub\n", This, clock);
99 return S_OK;
102 static HRESULT WINAPI IDirectMusicSynthSinkImpl_Activate(LPDIRECTMUSICSYNTHSINK iface, BOOL enable)
104 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
106 FIXME("(%p)->(%d): stub\n", This, enable);
108 return S_OK;
111 static HRESULT WINAPI IDirectMusicSynthSinkImpl_SampleToRefTime(LPDIRECTMUSICSYNTHSINK iface, LONGLONG sample_time, REFERENCE_TIME* ref_time)
113 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
115 FIXME("(%p)->(0x%s, %p): stub\n", This, wine_dbgstr_longlong(sample_time), ref_time);
117 return S_OK;
120 static HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample(LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME ref_time, LONGLONG* sample_time)
122 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
124 FIXME("(%p)->(0x%s, %p): stub\n", This, wine_dbgstr_longlong(ref_time), sample_time);
126 return S_OK;
129 static HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound(LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND dsound, LPDIRECTSOUNDBUFFER dsound_buffer)
131 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
133 FIXME("(%p)->(%p, %p): stub\n", This, dsound, dsound_buffer);
135 return S_OK;
138 static HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize(LPDIRECTMUSICSYNTHSINK iface, LPDWORD buffer_size_in_samples)
140 IDirectMusicSynthSinkImpl *This = impl_from_IDirectMusicSynthSink(iface);
142 FIXME("(%p)->(%p): stub\n", This, buffer_size_in_samples);
144 return S_OK;
147 static const IDirectMusicSynthSinkVtbl DirectMusicSynthSink_Vtbl = {
148 IDirectMusicSynthSinkImpl_QueryInterface,
149 IDirectMusicSynthSinkImpl_AddRef,
150 IDirectMusicSynthSinkImpl_Release,
151 IDirectMusicSynthSinkImpl_Init,
152 IDirectMusicSynthSinkImpl_SetMasterClock,
153 IDirectMusicSynthSinkImpl_GetLatencyClock,
154 IDirectMusicSynthSinkImpl_Activate,
155 IDirectMusicSynthSinkImpl_SampleToRefTime,
156 IDirectMusicSynthSinkImpl_RefTimeToSample,
157 IDirectMusicSynthSinkImpl_SetDirectSound,
158 IDirectMusicSynthSinkImpl_GetDesiredBufferSize
161 /* for ClassFactory */
162 HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSinkImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
163 IDirectMusicSynthSinkImpl *obj;
165 TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
166 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl));
167 if (NULL == obj) {
168 *ppobj = NULL;
169 return E_OUTOFMEMORY;
171 obj->IDirectMusicSynthSink_iface.lpVtbl = &DirectMusicSynthSink_Vtbl;
172 obj->ref = 0;
174 return IDirectMusicSynthSinkImpl_QueryInterface((LPDIRECTMUSICSYNTHSINK)obj, lpcGUID, ppobj);