- define additional shell paths for CSIDL_... constants
[wine] / dlls / dmsynth / synthsink.c
1 /* IDirectMusicSynthSink Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmsynth_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
23
24 /* IDirectMusicSynthSinkImpl IUnknown part: */
25 HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj) {
26         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
27
28         if (IsEqualIID (riid, &IID_IUnknown) || 
29             IsEqualIID (riid, &IID_IDirectMusicSynthSink)) {
30                 IDirectMusicSynthSinkImpl_AddRef(iface);
31                 *ppobj = This;
32                 return S_OK;
33         }
34         WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
35         return E_NOINTERFACE;
36 }
37
38 ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface) {
39         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
40         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
41         return ++(This->ref);
42 }
43
44 ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) {
45         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
46         ULONG ref = --This->ref;
47         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
48         if (ref == 0) {
49                 HeapFree(GetProcessHeap(), 0, This);
50         }
51         return ref;
52 }
53
54 /* IDirectMusicSynthSinkImpl IDirectMusicSynthSink part: */
55 HRESULT WINAPI IDirectMusicSynthSinkImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth) {
56         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
57         FIXME("(%p, %p): stub\n", This, pSynth);
58         return S_OK;
59 }
60
61 HRESULT WINAPI IDirectMusicSynthSinkImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* pClock) {
62         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
63         FIXME("(%p, %p): stub\n", This, pClock);
64         return S_OK;
65 }
66
67 HRESULT WINAPI IDirectMusicSynthSinkImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** ppClock) {
68         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
69         FIXME("(%p, %p): stub\n", This, ppClock);
70         return S_OK;
71 }
72
73 HRESULT WINAPI IDirectMusicSynthSinkImpl_Activate (LPDIRECTMUSICSYNTHSINK iface, BOOL fEnable) {
74         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
75         FIXME("(%p, %d): stub\n", This, fEnable);
76         return S_OK;
77 }
78
79 HRESULT WINAPI IDirectMusicSynthSinkImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface, LONGLONG llSampleTime, REFERENCE_TIME* prfTime) {
80         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
81         FIXME("(%p, %lli, %p): stub\n", This, llSampleTime, prfTime);
82         return S_OK;
83 }
84
85 HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME rfTime, LONGLONG* pllSampleTime) {
86         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
87         FIXME("(%p, %lli, %p): stub\n", This, rfTime, pllSampleTime );
88         return S_OK;
89 }
90
91 HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) {
92         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
93         FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
94         return S_OK;
95 }
96
97 HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples) {
98         ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
99         FIXME("(%p, %p): stub\n", This, pdwBufferSizeInSamples);
100         return S_OK;
101 }
102
103 ICOM_VTABLE(IDirectMusicSynthSink) DirectMusicSynthSink_Vtbl = {
104     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
105         IDirectMusicSynthSinkImpl_QueryInterface,
106         IDirectMusicSynthSinkImpl_AddRef,
107         IDirectMusicSynthSinkImpl_Release,
108         IDirectMusicSynthSinkImpl_Init,
109         IDirectMusicSynthSinkImpl_SetMasterClock,
110         IDirectMusicSynthSinkImpl_GetLatencyClock,
111         IDirectMusicSynthSinkImpl_Activate,
112         IDirectMusicSynthSinkImpl_SampleToRefTime,
113         IDirectMusicSynthSinkImpl_RefTimeToSample,
114         IDirectMusicSynthSinkImpl_SetDirectSound,
115         IDirectMusicSynthSinkImpl_GetDesiredBufferSize
116 };
117
118 /* for ClassFactory */
119 HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSinkImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
120         IDirectMusicSynthSinkImpl *obj;
121         
122         TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
123         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl));
124         if (NULL == obj) {
125                 *ppobj = (LPDIRECTMUSICSYNTHSINK) NULL;
126                 return E_OUTOFMEMORY;
127         }
128         obj->lpVtbl = &DirectMusicSynthSink_Vtbl;
129         obj->ref = 0;
130         
131         return IDirectMusicSynthSinkImpl_QueryInterface((LPDIRECTMUSICSYNTHSINK)obj, lpcGUID, ppobj);
132 }