Fix SetDataFormat and implement GetDeviceInfo for mouse device.
[wine] / dlls / dmusic / dmusic_port.c
1 /* IDirectMusicPort Implementation
2  * IDirectMusicPortDownloadImpl Implementation
3  *
4  * Copyright (C) 2003 Rok Mandeljc
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
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
14  * GNU Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25 #include "wine/debug.h"
26
27 #include "dmusic_private.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
30
31 /* IDirectMusicPort IUnknown parts follow: */
32 HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REFIID riid, LPVOID *ppobj)
33 {
34         ICOM_THIS(IDirectMusicPortImpl,iface);
35
36         if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort))
37         {
38                 IDirectMusicPortImpl_AddRef(iface);
39                 *ppobj = This;
40                 return DS_OK;
41         }
42         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
43         return E_NOINTERFACE;
44 }
45
46 ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface)
47 {
48         ICOM_THIS(IDirectMusicPortImpl,iface);
49         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50         return ++(This->ref);
51 }
52
53 ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface)
54 {
55         ICOM_THIS(IDirectMusicPortImpl,iface);
56         ULONG ref = --This->ref;
57         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58         if (ref == 0)
59         {
60                 HeapFree(GetProcessHeap(), 0, This);
61         }
62         return ref;
63 }
64
65 /* IDirectMusicPort Interface follow: */
66 HRESULT WINAPI IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer)
67 {
68         FIXME("stub\n");
69         return DS_OK;
70 }
71
72 HRESULT WINAPI IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface, HANDLE hEvent)
73 {
74         FIXME("stub\n");
75         return DS_OK;
76 }
77
78 HRESULT WINAPI IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer)
79 {
80         FIXME("stub\n");
81         return DS_OK;
82 }
83
84 HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges)
85 {
86         FIXME("stub\n");
87         return DS_OK;
88 }
89
90 HRESULT WINAPI IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicDownloadedInstrument *pDownloadedInstrument)
91 {
92         FIXME("stub\n");
93         return DS_OK;
94 }
95
96 HRESULT WINAPI IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface, IReferenceClock** ppClock)
97 {
98         FIXME("stub\n");
99         return DS_OK;
100 }
101
102 HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LPDMUS_SYNTHSTATS pStats)
103 {
104         FIXME("stub\n");
105         return DS_OK;
106 }
107
108 HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps)
109 {
110         ICOM_THIS(IDirectMusicPortImpl,iface);
111         
112         TRACE("(%p, %p)\n", This, pPortCaps);
113         pPortCaps = This->caps;
114         
115         return S_OK;
116 }
117
118 HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)
119 {
120         FIXME("stub\n");
121         return DS_OK;
122 }
123
124 HRESULT WINAPI IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface, DWORD dwChannelGroups)
125 {
126         FIXME("stub\n");
127         return DS_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface, LPDWORD pdwChannelGroups)
131 {
132         FIXME("stub\n");
133         return DS_OK;
134 }
135
136 HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive)
137 {
138         FIXME("stub\n");
139         return DS_OK;
140 }
141
142 HRESULT WINAPI IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority)
143 {
144         FIXME("stub\n");
145         return DS_OK;
146 }
147
148 HRESULT WINAPI IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority)
149 {
150         FIXME("stub\n");
151         return DS_OK;
152 }
153
154 HRESULT WINAPI IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer)
155 {
156         FIXME("stub\n");
157         return DS_OK;
158 }
159
160 HRESULT WINAPI IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize)
161 {
162         FIXME("stub\n");
163         return DS_OK;
164 }
165
166 ICOM_VTABLE(IDirectMusicPort) DirectMusicPort_Vtbl =
167 {
168     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
169         IDirectMusicPortImpl_QueryInterface,
170         IDirectMusicPortImpl_AddRef,
171         IDirectMusicPortImpl_Release,
172         IDirectMusicPortImpl_PlayBuffer,
173         IDirectMusicPortImpl_SetReadNotificationHandle,
174         IDirectMusicPortImpl_Read,
175         IDirectMusicPortImpl_DownloadInstrument,
176         IDirectMusicPortImpl_UnloadInstrument,
177         IDirectMusicPortImpl_GetLatencyClock,
178         IDirectMusicPortImpl_GetRunningStats,
179         IDirectMusicPortImpl_GetCaps,
180         IDirectMusicPortImpl_DeviceIoControl,
181         IDirectMusicPortImpl_SetNumChannelGroups,
182         IDirectMusicPortImpl_GetNumChannelGroups,
183         IDirectMusicPortImpl_Activate,
184         IDirectMusicPortImpl_SetChannelPriority,
185         IDirectMusicPortImpl_GetChannelPriority,
186         IDirectMusicPortImpl_SetDirectSound,
187         IDirectMusicPortImpl_GetFormat
188 };
189
190
191 /* IDirectMusicPortDownload IUnknown parts follow: */
192 HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj)
193 {
194         ICOM_THIS(IDirectMusicPortDownloadImpl,iface);
195
196         if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPortDownload))
197         {
198                 IDirectMusicPortDownloadImpl_AddRef(iface);
199                 *ppobj = This;
200                 return DS_OK;
201         }
202         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
203         return E_NOINTERFACE;
204 }
205
206 ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface)
207 {
208         ICOM_THIS(IDirectMusicPortDownloadImpl,iface);
209         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
210         return ++(This->ref);
211 }
212
213 ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface)
214 {
215         ICOM_THIS(IDirectMusicPortDownloadImpl,iface);
216         ULONG ref = --This->ref;
217         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
218         if (ref == 0)
219         {
220                 HeapFree(GetProcessHeap(), 0, This);
221         }
222         return ref;
223 }
224
225 /* IDirectMusicPortDownload Interface follow: */
226 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload)
227 {
228         FIXME("stub\n");
229         return DS_OK;
230 }
231
232 HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload)
233 {
234         FIXME("stub\n");
235         return DS_OK;
236 }
237
238 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount)
239 {
240         FIXME("stub\n");
241         return DS_OK;
242 }
243
244 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend)
245 {
246         FIXME("stub\n");
247         return DS_OK;
248 }
249
250 HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload)
251 {
252         FIXME("stub\n");
253         return DS_OK;
254 }
255
256 HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload)
257 {
258         FIXME("stub\n");
259         return DS_OK;
260 }
261
262 ICOM_VTABLE(IDirectMusicPortDownload) DirectMusicPortDownload_Vtbl =
263 {
264     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
265         IDirectMusicPortDownloadImpl_QueryInterface,
266         IDirectMusicPortDownloadImpl_AddRef,
267         IDirectMusicPortDownloadImpl_Release,
268         IDirectMusicPortDownloadImpl_GetBuffer,
269         IDirectMusicPortDownloadImpl_AllocateBuffer,
270         IDirectMusicPortDownloadImpl_GetDLId,
271         IDirectMusicPortDownloadImpl_GetAppend,
272         IDirectMusicPortDownloadImpl_Download,
273         IDirectMusicPortDownloadImpl_Unload
274 };