1 /* IDirectMusicPort Implementation
2 * IDirectMusicPortDownloadImpl Implementation
4 * Copyright (C) 2003 Rok Mandeljc
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.
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.
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.
25 #include "wine/debug.h"
27 #include "dmusic_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
31 /* IDirectMusicPort IUnknown parts follow: */
32 HRESULT WINAPI
IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface
, REFIID riid
, LPVOID
*ppobj
)
34 ICOM_THIS(IDirectMusicPortImpl
,iface
);
36 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicPort
))
38 IDirectMusicPortImpl_AddRef(iface
);
42 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
46 ULONG WINAPI
IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface
)
48 ICOM_THIS(IDirectMusicPortImpl
,iface
);
49 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
53 ULONG WINAPI
IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface
)
55 ICOM_THIS(IDirectMusicPortImpl
,iface
);
56 ULONG ref
= --This
->ref
;
57 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
60 HeapFree(GetProcessHeap(), 0, This
);
65 /* IDirectMusicPort Interface follow: */
66 HRESULT WINAPI
IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface
, LPDIRECTMUSICBUFFER pBuffer
)
68 ICOM_THIS(IDirectMusicPortImpl
,iface
);
70 FIXME("(%p, %p): stub\n", This
, pBuffer
);
75 HRESULT WINAPI
IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface
, HANDLE hEvent
)
77 ICOM_THIS(IDirectMusicPortImpl
,iface
);
79 FIXME("(%p, %p): stub\n", This
, hEvent
);
84 HRESULT WINAPI
IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface
, LPDIRECTMUSICBUFFER pBuffer
)
86 ICOM_THIS(IDirectMusicPortImpl
,iface
);
88 FIXME("(%p, %p): stub\n", This
, pBuffer
);
93 HRESULT WINAPI
IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface
, IDirectMusicInstrument
* pInstrument
, IDirectMusicDownloadedInstrument
** ppDownloadedInstrument
, DMUS_NOTERANGE
* pNoteRanges
, DWORD dwNumNoteRanges
)
95 ICOM_THIS(IDirectMusicPortImpl
,iface
);
97 FIXME("(%p, %p, %p, %p, %ld): stub\n", This
, pInstrument
, ppDownloadedInstrument
, pNoteRanges
, dwNumNoteRanges
);
102 HRESULT WINAPI
IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface
, IDirectMusicDownloadedInstrument
*pDownloadedInstrument
)
104 ICOM_THIS(IDirectMusicPortImpl
,iface
);
106 FIXME("(%p, %p): stub\n", This
, pDownloadedInstrument
);
111 HRESULT WINAPI
IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface
, IReferenceClock
** ppClock
)
113 ICOM_THIS(IDirectMusicPortImpl
,iface
);
115 FIXME("(%p, %p): stub\n", This
, ppClock
);
120 HRESULT WINAPI
IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface
, LPDMUS_SYNTHSTATS pStats
)
122 ICOM_THIS(IDirectMusicPortImpl
,iface
);
124 FIXME("(%p, %p): stub\n", This
, pStats
);
129 HRESULT WINAPI
IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface
, LPDMUS_PORTCAPS pPortCaps
)
131 ICOM_THIS(IDirectMusicPortImpl
,iface
);
133 TRACE("(%p, %p)\n", This
, pPortCaps
);
134 pPortCaps
= This
->caps
;
139 HRESULT WINAPI
IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface
, DWORD dwIoControlCode
, LPVOID lpInBuffer
, DWORD nInBufferSize
, LPVOID lpOutBuffer
, DWORD nOutBufferSize
, LPDWORD lpBytesReturned
, LPOVERLAPPED lpOverlapped
)
141 ICOM_THIS(IDirectMusicPortImpl
,iface
);
143 FIXME("(%p, %ld, %p, %ld, %p, %ld, %p, %p): stub\n", This
, dwIoControlCode
, lpInBuffer
, nInBufferSize
, lpOutBuffer
, nOutBufferSize
, lpBytesReturned
, lpOverlapped
);
148 HRESULT WINAPI
IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroups
)
150 ICOM_THIS(IDirectMusicPortImpl
,iface
);
152 FIXME("(%p, %ld): semi-stub\n", This
, dwChannelGroups
);
153 This
->nrofgroups
= dwChannelGroups
;
158 HRESULT WINAPI
IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface
, LPDWORD pdwChannelGroups
)
160 ICOM_THIS(IDirectMusicPortImpl
,iface
);
162 TRACE("(%p, %p)\n", This
, pdwChannelGroups
);
163 *pdwChannelGroups
= This
->nrofgroups
;
168 HRESULT WINAPI
IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface
, BOOL fActive
)
170 ICOM_THIS(IDirectMusicPortImpl
,iface
);
172 TRACE("(%p, %d)\n", This
, fActive
);
173 This
->active
= fActive
;
178 HRESULT WINAPI
IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
)
180 ICOM_THIS(IDirectMusicPortImpl
,iface
);
182 FIXME("(%p, %ld, %ld, %ld): semi-stub\n", This
, dwChannelGroup
, dwChannel
, dwPriority
);
186 WARN("isn't there supposed to be 16 channels (no. %ld requested)?! (faking as it is ok)\n", dwChannel
);
187 /*return E_INVALIDARG;*/
193 HRESULT WINAPI
IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
)
195 ICOM_THIS(IDirectMusicPortImpl
,iface
);
197 TRACE("(%p, %ld, %ld, %p)\n", This
, dwChannelGroup
, dwChannel
, pdwPriority
);
198 *pdwPriority
= This
->group
[dwChannelGroup
-1].channel
[dwChannel
].priority
;
203 HRESULT WINAPI
IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface
, LPDIRECTSOUND pDirectSound
, LPDIRECTSOUNDBUFFER pDirectSoundBuffer
)
205 ICOM_THIS(IDirectMusicPortImpl
,iface
);
207 FIXME("(%p, %p, %p): stub\n", This
, pDirectSound
, pDirectSoundBuffer
);
212 HRESULT WINAPI
IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSize
, LPDWORD pdwBufferSize
)
214 ICOM_THIS(IDirectMusicPortImpl
,iface
);
216 FIXME("(%p, %p, %p, %p): stub\n", This
, pWaveFormatEx
, pdwWaveFormatExSize
, pdwBufferSize
);
221 ICOM_VTABLE(IDirectMusicPort
) DirectMusicPort_Vtbl
=
223 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
224 IDirectMusicPortImpl_QueryInterface
,
225 IDirectMusicPortImpl_AddRef
,
226 IDirectMusicPortImpl_Release
,
227 IDirectMusicPortImpl_PlayBuffer
,
228 IDirectMusicPortImpl_SetReadNotificationHandle
,
229 IDirectMusicPortImpl_Read
,
230 IDirectMusicPortImpl_DownloadInstrument
,
231 IDirectMusicPortImpl_UnloadInstrument
,
232 IDirectMusicPortImpl_GetLatencyClock
,
233 IDirectMusicPortImpl_GetRunningStats
,
234 IDirectMusicPortImpl_GetCaps
,
235 IDirectMusicPortImpl_DeviceIoControl
,
236 IDirectMusicPortImpl_SetNumChannelGroups
,
237 IDirectMusicPortImpl_GetNumChannelGroups
,
238 IDirectMusicPortImpl_Activate
,
239 IDirectMusicPortImpl_SetChannelPriority
,
240 IDirectMusicPortImpl_GetChannelPriority
,
241 IDirectMusicPortImpl_SetDirectSound
,
242 IDirectMusicPortImpl_GetFormat
246 /* IDirectMusicPortDownload IUnknown parts follow: */
247 HRESULT WINAPI
IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface
, REFIID riid
, LPVOID
*ppobj
)
249 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
251 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicPortDownload
))
253 IDirectMusicPortDownloadImpl_AddRef(iface
);
257 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
258 return E_NOINTERFACE
;
261 ULONG WINAPI
IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface
)
263 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
264 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
265 return ++(This
->ref
);
268 ULONG WINAPI
IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface
)
270 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
271 ULONG ref
= --This
->ref
;
272 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
275 HeapFree(GetProcessHeap(), 0, This
);
280 /* IDirectMusicPortDownload Interface follow: */
281 HRESULT WINAPI
IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface
, DWORD dwDLId
, IDirectMusicDownload
** ppIDMDownload
)
283 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
285 FIXME("(%p, %ld, %p): stub\n", This
, dwDLId
, ppIDMDownload
);
290 HRESULT WINAPI
IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface
, DWORD dwSize
, IDirectMusicDownload
** ppIDMDownload
)
292 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
294 FIXME("(%p, %ld, %p): stub\n", This
, dwSize
, ppIDMDownload
);
299 HRESULT WINAPI
IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface
, DWORD
* pdwStartDLId
, DWORD dwCount
)
301 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
303 FIXME("(%p, %p, %ld): stub\n", This
, pdwStartDLId
, dwCount
);
308 HRESULT WINAPI
IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface
, DWORD
* pdwAppend
)
310 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
312 FIXME("(%p, %p): stub\n", This
, pdwAppend
);
317 HRESULT WINAPI
IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface
, IDirectMusicDownload
* pIDMDownload
)
319 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
321 FIXME("(%p, %p): stub\n", This
, pIDMDownload
);
326 HRESULT WINAPI
IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface
, IDirectMusicDownload
* pIDMDownload
)
328 ICOM_THIS(IDirectMusicPortDownloadImpl
,iface
);
330 FIXME("(%p, %p): stub\n", This
, pIDMDownload
);
335 ICOM_VTABLE(IDirectMusicPortDownload
) DirectMusicPortDownload_Vtbl
=
337 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
338 IDirectMusicPortDownloadImpl_QueryInterface
,
339 IDirectMusicPortDownloadImpl_AddRef
,
340 IDirectMusicPortDownloadImpl_Release
,
341 IDirectMusicPortDownloadImpl_GetBuffer
,
342 IDirectMusicPortDownloadImpl_AllocateBuffer
,
343 IDirectMusicPortDownloadImpl_GetDLId
,
344 IDirectMusicPortDownloadImpl_GetAppend
,
345 IDirectMusicPortDownloadImpl_Download
,
346 IDirectMusicPortDownloadImpl_Unload