'grep -q' is not portable -> don't use it.
[wine.git] / dlls / dmusic / port.c
bloba2ed0aca058342f5193c4a6071317b699f3bb617
1 /* IDirectMusicPort Implementation
3 * Copyright (C) 2003 Rok Mandeljc
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.
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.
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.
20 #include "windef.h"
21 #include "winbase.h"
22 #include "winuser.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
26 #include "dmusic_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
30 /* IDirectMusicPort IUnknown parts follow: */
31 HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REFIID riid, LPVOID *ppobj)
33 ICOM_THIS(IDirectMusicPortImpl,iface);
35 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort))
37 IDirectMusicPortImpl_AddRef(iface);
38 *ppobj = This;
39 return S_OK;
41 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
42 return E_NOINTERFACE;
45 ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface)
47 ICOM_THIS(IDirectMusicPortImpl,iface);
48 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
49 return ++(This->ref);
52 ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface)
54 ICOM_THIS(IDirectMusicPortImpl,iface);
55 ULONG ref = --This->ref;
56 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
57 if (ref == 0)
59 HeapFree(GetProcessHeap(), 0, This);
61 return ref;
64 /* IDirectMusicPort Interface follow: */
65 HRESULT WINAPI IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer)
67 ICOM_THIS(IDirectMusicPortImpl,iface);
69 FIXME("(%p, %p): stub\n", This, pBuffer);
71 return S_OK;
74 HRESULT WINAPI IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface, HANDLE hEvent)
76 ICOM_THIS(IDirectMusicPortImpl,iface);
78 FIXME("(%p, %p): stub\n", This, hEvent);
80 return S_OK;
83 HRESULT WINAPI IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer)
85 ICOM_THIS(IDirectMusicPortImpl,iface);
87 FIXME("(%p, %p): stub\n", This, pBuffer);
89 return S_OK;
92 HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges)
94 ICOM_THIS(IDirectMusicPortImpl,iface);
96 FIXME("(%p, %p, %p, %p, %ld): stub\n", This, pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
98 return S_OK;
101 HRESULT WINAPI IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicDownloadedInstrument *pDownloadedInstrument)
103 ICOM_THIS(IDirectMusicPortImpl,iface);
105 FIXME("(%p, %p): stub\n", This, pDownloadedInstrument);
107 return S_OK;
110 HRESULT WINAPI IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface, IReferenceClock** ppClock)
112 ICOM_THIS(IDirectMusicPortImpl,iface);
114 TRACE("(%p, %p)\n", This, ppClock);
115 *ppClock = This->pLatencyClock;
116 IReferenceClock_AddRef (*ppClock);
118 return S_OK;
121 HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LPDMUS_SYNTHSTATS pStats)
123 ICOM_THIS(IDirectMusicPortImpl,iface);
125 FIXME("(%p, %p): stub\n", This, pStats);
127 return S_OK;
130 HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps)
132 ICOM_THIS(IDirectMusicPortImpl,iface);
134 TRACE("(%p, %p)\n", This, pPortCaps);
135 pPortCaps = This->pCaps;
137 return S_OK;
140 HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)
142 ICOM_THIS(IDirectMusicPortImpl,iface);
144 FIXME("(%p, %ld, %p, %ld, %p, %ld, %p, %p): stub\n", This, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
146 return S_OK;
149 HRESULT WINAPI IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface, DWORD dwChannelGroups)
151 ICOM_THIS(IDirectMusicPortImpl,iface);
153 FIXME("(%p, %ld): semi-stub\n", This, dwChannelGroups);
154 This->nrofgroups = dwChannelGroups;
156 return S_OK;
159 HRESULT WINAPI IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface, LPDWORD pdwChannelGroups)
161 ICOM_THIS(IDirectMusicPortImpl,iface);
163 TRACE("(%p, %p)\n", This, pdwChannelGroups);
164 *pdwChannelGroups = This->nrofgroups;
166 return S_OK;
169 HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive)
171 ICOM_THIS(IDirectMusicPortImpl,iface);
173 TRACE("(%p, %d)\n", This, fActive);
174 This->fActive = fActive;
176 return S_OK;
179 HRESULT WINAPI IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority)
181 ICOM_THIS(IDirectMusicPortImpl,iface);
183 FIXME("(%p, %ld, %ld, %ld): semi-stub\n", This, dwChannelGroup, dwChannel, dwPriority);
185 if (dwChannel > 16)
187 WARN("isn't there supposed to be 16 channels (no. %ld requested)?! (faking as it is ok)\n", dwChannel);
188 /*return E_INVALIDARG;*/
191 return S_OK;
194 HRESULT WINAPI IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority)
196 ICOM_THIS(IDirectMusicPortImpl,iface);
198 TRACE("(%p, %ld, %ld, %p)\n", This, dwChannelGroup, dwChannel, pdwPriority);
199 *pdwPriority = This->group[dwChannelGroup-1].channel[dwChannel].priority;
201 return S_OK;
204 HRESULT WINAPI IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer)
206 ICOM_THIS(IDirectMusicPortImpl,iface);
208 FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
210 return S_OK;
213 HRESULT WINAPI IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize)
215 ICOM_THIS(IDirectMusicPortImpl,iface);
217 FIXME("(%p, %p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSize, pdwBufferSize);
219 return S_OK;
222 ICOM_VTABLE(IDirectMusicPort) DirectMusicPort_Vtbl =
224 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
225 IDirectMusicPortImpl_QueryInterface,
226 IDirectMusicPortImpl_AddRef,
227 IDirectMusicPortImpl_Release,
228 IDirectMusicPortImpl_PlayBuffer,
229 IDirectMusicPortImpl_SetReadNotificationHandle,
230 IDirectMusicPortImpl_Read,
231 IDirectMusicPortImpl_DownloadInstrument,
232 IDirectMusicPortImpl_UnloadInstrument,
233 IDirectMusicPortImpl_GetLatencyClock,
234 IDirectMusicPortImpl_GetRunningStats,
235 IDirectMusicPortImpl_GetCaps,
236 IDirectMusicPortImpl_DeviceIoControl,
237 IDirectMusicPortImpl_SetNumChannelGroups,
238 IDirectMusicPortImpl_GetNumChannelGroups,
239 IDirectMusicPortImpl_Activate,
240 IDirectMusicPortImpl_SetChannelPriority,
241 IDirectMusicPortImpl_GetChannelPriority,
242 IDirectMusicPortImpl_SetDirectSound,
243 IDirectMusicPortImpl_GetFormat
246 /* for ClassFactory */
247 HRESULT WINAPI DMUSIC_CreateDirectMusicPort (LPCGUID lpcGUID, LPDIRECTMUSICPORT* ppDMPort, LPUNKNOWN pUnkOuter)
249 if (IsEqualGUID (lpcGUID, &IID_IDirectMusicPort))
251 FIXME("Not yet\n");
252 return E_NOINTERFACE;
254 WARN("No interface found\n");
256 return E_NOINTERFACE;