Stub implementations for DrawDibChangePalette, DrawDibGetBuffer,
[wine] / dlls / dmusic / port.c
1 /* IDirectMusicPort Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #include "dmusic_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
23
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);
28
29         if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort)) {
30                 IDirectMusicPortImpl_AddRef(iface);
31                 *ppobj = This;
32                 return S_OK;
33         }
34         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
35         return E_NOINTERFACE;
36 }
37
38 ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
39         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
40         ULONG refCount = InterlockedIncrement(&This->ref);
41
42         TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
43
44         return refCount;
45 }
46
47 ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
48         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
49         ULONG refCount = InterlockedDecrement(&This->ref);
50
51         TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
52
53         if (!refCount) {
54                 HeapFree(GetProcessHeap(), 0, This);
55         }
56         return refCount;
57 }
58
59 /* IDirectMusicPortImpl IDirectMusicPort part: */
60 HRESULT WINAPI IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
61         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
62         FIXME("(%p, %p): stub\n", This, pBuffer);
63         return S_OK;
64 }
65
66 HRESULT WINAPI IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface, HANDLE hEvent) {
67         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
68         FIXME("(%p, %p): stub\n", This, hEvent);
69         return S_OK;
70 }
71
72 HRESULT WINAPI IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
73         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
74         FIXME("(%p, %p): stub\n", This, pBuffer);
75         return S_OK;
76 }
77
78 HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges) {
79         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
80         FIXME("(%p, %p, %p, %p, %ld): stub\n", This, pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
81         return S_OK;
82 }
83
84 HRESULT WINAPI IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicDownloadedInstrument *pDownloadedInstrument) {
85         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
86         FIXME("(%p, %p): stub\n", This, pDownloadedInstrument);
87         return S_OK;
88 }
89
90 HRESULT WINAPI IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface, IReferenceClock** ppClock) {
91         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
92         TRACE("(%p, %p)\n", This, ppClock);
93         *ppClock = This->pLatencyClock;
94         IReferenceClock_AddRef (*ppClock);
95         return S_OK;
96 }
97
98 HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LPDMUS_SYNTHSTATS pStats) {
99         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
100         FIXME("(%p, %p): stub\n", This, pStats);
101         return S_OK;
102 }
103
104 HRESULT WINAPI IDirectMusicPortImpl_Compact (LPDIRECTMUSICPORT iface) {
105         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
106         FIXME("(%p): stub\n", This);
107         return S_OK;
108 }
109
110 HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps) {
111         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
112         TRACE("(%p, %p)\n", This, pPortCaps);
113         pPortCaps = This->pCaps;        
114         return S_OK;
115 }
116
117 HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
118         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
119         FIXME("(%p, %ld, %p, %ld, %p, %ld, %p, %p): stub\n", This, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
120         return S_OK;
121 }
122
123 HRESULT WINAPI IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface, DWORD dwChannelGroups) {
124         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
125         FIXME("(%p, %ld): semi-stub\n", This, dwChannelGroups);
126         This->nrofgroups = dwChannelGroups;
127         return S_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface, LPDWORD pdwChannelGroups) {
131         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
132         TRACE("(%p, %p)\n", This, pdwChannelGroups);
133         *pdwChannelGroups = This->nrofgroups;
134         return S_OK;
135 }
136
137 HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive) {
138         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
139         TRACE("(%p, %d)\n", This, fActive);
140         This->fActive = fActive;
141         return S_OK;
142 }
143
144 HRESULT WINAPI IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) {
145         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
146         FIXME("(%p, %ld, %ld, %ld): semi-stub\n", This, dwChannelGroup, dwChannel, dwPriority);
147         if (dwChannel > 16) {
148                 WARN("isn't there supposed to be 16 channels (no. %ld requested)?! (faking as it is ok)\n", dwChannel);
149                 /*return E_INVALIDARG;*/
150         }       
151         return S_OK;
152 }
153
154 HRESULT WINAPI IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) {
155         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
156         TRACE("(%p, %ld, %ld, %p)\n", This, dwChannelGroup, dwChannel, pdwPriority);
157         *pdwPriority = This->group[dwChannelGroup-1].channel[dwChannel].priority;
158         return S_OK;
159 }
160
161 HRESULT WINAPI IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) {
162         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
163         FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
164         return S_OK;
165 }
166
167 HRESULT WINAPI IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) {
168         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
169         FIXME("(%p, %p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSize, pdwBufferSize);
170         return S_OK;
171 }
172
173 IDirectMusicPortVtbl DirectMusicPort_Vtbl = {
174         IDirectMusicPortImpl_QueryInterface,
175         IDirectMusicPortImpl_AddRef,
176         IDirectMusicPortImpl_Release,
177         IDirectMusicPortImpl_PlayBuffer,
178         IDirectMusicPortImpl_SetReadNotificationHandle,
179         IDirectMusicPortImpl_Read,
180         IDirectMusicPortImpl_DownloadInstrument,
181         IDirectMusicPortImpl_UnloadInstrument,
182         IDirectMusicPortImpl_GetLatencyClock,
183         IDirectMusicPortImpl_GetRunningStats,
184         IDirectMusicPortImpl_Compact,
185         IDirectMusicPortImpl_GetCaps,
186         IDirectMusicPortImpl_DeviceIoControl,
187         IDirectMusicPortImpl_SetNumChannelGroups,
188         IDirectMusicPortImpl_GetNumChannelGroups,
189         IDirectMusicPortImpl_Activate,
190         IDirectMusicPortImpl_SetChannelPriority,
191         IDirectMusicPortImpl_GetChannelPriority,
192         IDirectMusicPortImpl_SetDirectSound,
193         IDirectMusicPortImpl_GetFormat
194 };