1 /* IDirectMusicPort Implementation
3 * Copyright (C) 2003-2004 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 "dmusic_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
24 /* IDirectMusicPortImpl IUnknown part: */
25 HRESULT WINAPI
IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface
, REFIID riid
, LPVOID
*ppobj
) {
26 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
27 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
29 if (IsEqualIID (riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicPort
)) {
30 IDirectMusicPortImpl_AddRef(iface
);
34 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
38 ULONG WINAPI
IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface
) {
39 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
40 ULONG refCount
= InterlockedIncrement(&This
->ref
);
42 TRACE("(%p)->(ref before=%lu)\n", This
, refCount
- 1);
49 ULONG WINAPI
IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface
) {
50 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
51 ULONG refCount
= InterlockedDecrement(&This
->ref
);
53 TRACE("(%p)->(ref before=%lu)\n", This
, refCount
+ 1);
56 HeapFree(GetProcessHeap(), 0, This
);
59 DMUSIC_UnlockModule();
64 /* IDirectMusicPortImpl IDirectMusicPort part: */
65 HRESULT WINAPI
IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface
, LPDIRECTMUSICBUFFER pBuffer
) {
66 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
67 FIXME("(%p, %p): stub\n", This
, pBuffer
);
71 HRESULT WINAPI
IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface
, HANDLE hEvent
) {
72 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
73 FIXME("(%p, %p): stub\n", This
, hEvent
);
77 HRESULT WINAPI
IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface
, LPDIRECTMUSICBUFFER pBuffer
) {
78 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
79 FIXME("(%p, %p): stub\n", This
, pBuffer
);
83 HRESULT WINAPI
IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface
, IDirectMusicInstrument
* pInstrument
, IDirectMusicDownloadedInstrument
** ppDownloadedInstrument
, DMUS_NOTERANGE
* pNoteRanges
, DWORD dwNumNoteRanges
) {
84 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
85 FIXME("(%p, %p, %p, %p, %ld): stub\n", This
, pInstrument
, ppDownloadedInstrument
, pNoteRanges
, dwNumNoteRanges
);
89 HRESULT WINAPI
IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface
, IDirectMusicDownloadedInstrument
*pDownloadedInstrument
) {
90 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
91 FIXME("(%p, %p): stub\n", This
, pDownloadedInstrument
);
95 HRESULT WINAPI
IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface
, IReferenceClock
** ppClock
) {
96 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
97 TRACE("(%p, %p)\n", This
, ppClock
);
98 *ppClock
= This
->pLatencyClock
;
99 IReferenceClock_AddRef (*ppClock
);
103 HRESULT WINAPI
IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface
, LPDMUS_SYNTHSTATS pStats
) {
104 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
105 FIXME("(%p, %p): stub\n", This
, pStats
);
109 HRESULT WINAPI
IDirectMusicPortImpl_Compact (LPDIRECTMUSICPORT iface
) {
110 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
111 FIXME("(%p): stub\n", This
);
115 HRESULT WINAPI
IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface
, LPDMUS_PORTCAPS pPortCaps
) {
116 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
117 TRACE("(%p, %p)\n", This
, pPortCaps
);
118 pPortCaps
= This
->pCaps
;
122 HRESULT WINAPI
IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface
, DWORD dwIoControlCode
, LPVOID lpInBuffer
, DWORD nInBufferSize
, LPVOID lpOutBuffer
, DWORD nOutBufferSize
, LPDWORD lpBytesReturned
, LPOVERLAPPED lpOverlapped
) {
123 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
124 FIXME("(%p, %ld, %p, %ld, %p, %ld, %p, %p): stub\n", This
, dwIoControlCode
, lpInBuffer
, nInBufferSize
, lpOutBuffer
, nOutBufferSize
, lpBytesReturned
, lpOverlapped
);
128 HRESULT WINAPI
IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroups
) {
129 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
130 FIXME("(%p, %ld): semi-stub\n", This
, dwChannelGroups
);
131 This
->nrofgroups
= dwChannelGroups
;
135 HRESULT WINAPI
IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface
, LPDWORD pdwChannelGroups
) {
136 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
137 TRACE("(%p, %p)\n", This
, pdwChannelGroups
);
138 *pdwChannelGroups
= This
->nrofgroups
;
142 HRESULT WINAPI
IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface
, BOOL fActive
) {
143 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
144 TRACE("(%p, %d)\n", This
, fActive
);
145 This
->fActive
= fActive
;
149 HRESULT WINAPI
IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
) {
150 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
151 FIXME("(%p, %ld, %ld, %ld): semi-stub\n", This
, dwChannelGroup
, dwChannel
, dwPriority
);
152 if (dwChannel
> 16) {
153 WARN("isn't there supposed to be 16 channels (no. %ld requested)?! (faking as it is ok)\n", dwChannel
);
154 /*return E_INVALIDARG;*/
159 HRESULT WINAPI
IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
) {
160 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
161 TRACE("(%p, %ld, %ld, %p)\n", This
, dwChannelGroup
, dwChannel
, pdwPriority
);
162 *pdwPriority
= This
->group
[dwChannelGroup
-1].channel
[dwChannel
].priority
;
166 HRESULT WINAPI
IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface
, LPDIRECTSOUND pDirectSound
, LPDIRECTSOUNDBUFFER pDirectSoundBuffer
) {
167 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
168 FIXME("(%p, %p, %p): stub\n", This
, pDirectSound
, pDirectSoundBuffer
);
172 HRESULT WINAPI
IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSize
, LPDWORD pdwBufferSize
) {
173 IDirectMusicPortImpl
*This
= (IDirectMusicPortImpl
*)iface
;
174 FIXME("(%p, %p, %p, %p): stub\n", This
, pWaveFormatEx
, pdwWaveFormatExSize
, pdwBufferSize
);
178 IDirectMusicPortVtbl DirectMusicPort_Vtbl
= {
179 IDirectMusicPortImpl_QueryInterface
,
180 IDirectMusicPortImpl_AddRef
,
181 IDirectMusicPortImpl_Release
,
182 IDirectMusicPortImpl_PlayBuffer
,
183 IDirectMusicPortImpl_SetReadNotificationHandle
,
184 IDirectMusicPortImpl_Read
,
185 IDirectMusicPortImpl_DownloadInstrument
,
186 IDirectMusicPortImpl_UnloadInstrument
,
187 IDirectMusicPortImpl_GetLatencyClock
,
188 IDirectMusicPortImpl_GetRunningStats
,
189 IDirectMusicPortImpl_Compact
,
190 IDirectMusicPortImpl_GetCaps
,
191 IDirectMusicPortImpl_DeviceIoControl
,
192 IDirectMusicPortImpl_SetNumChannelGroups
,
193 IDirectMusicPortImpl_GetNumChannelGroups
,
194 IDirectMusicPortImpl_Activate
,
195 IDirectMusicPortImpl_SetChannelPriority
,
196 IDirectMusicPortImpl_GetChannelPriority
,
197 IDirectMusicPortImpl_SetDirectSound
,
198 IDirectMusicPortImpl_GetFormat