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.
26 #include "wine/debug.h"
28 #include "dmusic_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
32 /* IDirectMusicPort IUnknown parts follow: */
33 HRESULT WINAPI
IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface
, REFIID riid
, LPVOID
*ppobj
)
35 ICOM_THIS(IDirectMusicPortImpl
,iface
);
37 if (IsEqualIID (riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicPort
)) {
38 IDirectMusicPortImpl_AddRef(iface
);
43 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
47 ULONG WINAPI
IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface
)
49 ICOM_THIS(IDirectMusicPortImpl
,iface
);
50 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
54 ULONG WINAPI
IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface
)
56 ICOM_THIS(IDirectMusicPortImpl
,iface
);
57 ULONG ref
= --This
->ref
;
58 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 TRACE("(%p, %p)\n", This
, ppClock
);
116 *ppClock
= This
->pLatencyClock
;
117 IReferenceClock_AddRef (*ppClock
);
122 HRESULT WINAPI
IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface
, LPDMUS_SYNTHSTATS pStats
)
124 ICOM_THIS(IDirectMusicPortImpl
,iface
);
126 FIXME("(%p, %p): stub\n", This
, pStats
);
131 HRESULT WINAPI
IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface
, LPDMUS_PORTCAPS pPortCaps
)
133 ICOM_THIS(IDirectMusicPortImpl
,iface
);
135 TRACE("(%p, %p)\n", This
, pPortCaps
);
136 pPortCaps
= This
->pCaps
;
141 HRESULT WINAPI
IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface
, DWORD dwIoControlCode
, LPVOID lpInBuffer
, DWORD nInBufferSize
, LPVOID lpOutBuffer
, DWORD nOutBufferSize
, LPDWORD lpBytesReturned
, LPOVERLAPPED lpOverlapped
)
143 ICOM_THIS(IDirectMusicPortImpl
,iface
);
145 FIXME("(%p, %ld, %p, %ld, %p, %ld, %p, %p): stub\n", This
, dwIoControlCode
, lpInBuffer
, nInBufferSize
, lpOutBuffer
, nOutBufferSize
, lpBytesReturned
, lpOverlapped
);
150 HRESULT WINAPI
IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroups
)
152 ICOM_THIS(IDirectMusicPortImpl
,iface
);
154 FIXME("(%p, %ld): semi-stub\n", This
, dwChannelGroups
);
155 This
->nrofgroups
= dwChannelGroups
;
160 HRESULT WINAPI
IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface
, LPDWORD pdwChannelGroups
)
162 ICOM_THIS(IDirectMusicPortImpl
,iface
);
164 TRACE("(%p, %p)\n", This
, pdwChannelGroups
);
165 *pdwChannelGroups
= This
->nrofgroups
;
170 HRESULT WINAPI
IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface
, BOOL fActive
)
172 ICOM_THIS(IDirectMusicPortImpl
,iface
);
174 TRACE("(%p, %d)\n", This
, fActive
);
175 This
->fActive
= fActive
;
180 HRESULT WINAPI
IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
)
182 ICOM_THIS(IDirectMusicPortImpl
,iface
);
184 FIXME("(%p, %ld, %ld, %ld): semi-stub\n", This
, dwChannelGroup
, dwChannel
, dwPriority
);
188 WARN("isn't there supposed to be 16 channels (no. %ld requested)?! (faking as it is ok)\n", dwChannel
);
189 /*return E_INVALIDARG;*/
195 HRESULT WINAPI
IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
)
197 ICOM_THIS(IDirectMusicPortImpl
,iface
);
199 TRACE("(%p, %ld, %ld, %p)\n", This
, dwChannelGroup
, dwChannel
, pdwPriority
);
200 *pdwPriority
= This
->group
[dwChannelGroup
-1].channel
[dwChannel
].priority
;
205 HRESULT WINAPI
IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface
, LPDIRECTSOUND pDirectSound
, LPDIRECTSOUNDBUFFER pDirectSoundBuffer
)
207 ICOM_THIS(IDirectMusicPortImpl
,iface
);
209 FIXME("(%p, %p, %p): stub\n", This
, pDirectSound
, pDirectSoundBuffer
);
214 HRESULT WINAPI
IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSize
, LPDWORD pdwBufferSize
)
216 ICOM_THIS(IDirectMusicPortImpl
,iface
);
218 FIXME("(%p, %p, %p, %p): stub\n", This
, pWaveFormatEx
, pdwWaveFormatExSize
, pdwBufferSize
);
223 ICOM_VTABLE(IDirectMusicPort
) DirectMusicPort_Vtbl
=
225 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
226 IDirectMusicPortImpl_QueryInterface
,
227 IDirectMusicPortImpl_AddRef
,
228 IDirectMusicPortImpl_Release
,
229 IDirectMusicPortImpl_PlayBuffer
,
230 IDirectMusicPortImpl_SetReadNotificationHandle
,
231 IDirectMusicPortImpl_Read
,
232 IDirectMusicPortImpl_DownloadInstrument
,
233 IDirectMusicPortImpl_UnloadInstrument
,
234 IDirectMusicPortImpl_GetLatencyClock
,
235 IDirectMusicPortImpl_GetRunningStats
,
236 IDirectMusicPortImpl_GetCaps
,
237 IDirectMusicPortImpl_DeviceIoControl
,
238 IDirectMusicPortImpl_SetNumChannelGroups
,
239 IDirectMusicPortImpl_GetNumChannelGroups
,
240 IDirectMusicPortImpl_Activate
,
241 IDirectMusicPortImpl_SetChannelPriority
,
242 IDirectMusicPortImpl_GetChannelPriority
,
243 IDirectMusicPortImpl_SetDirectSound
,
244 IDirectMusicPortImpl_GetFormat
247 /* for ClassFactory */
248 HRESULT WINAPI
DMUSIC_CreateDirectMusicPort (LPCGUID lpcGUID
, LPDIRECTMUSICPORT
* ppDMPort
, LPUNKNOWN pUnkOuter
)
250 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicPort
))
253 return E_NOINTERFACE
;
255 WARN("No interface found\n");
257 return E_NOINTERFACE
;