- fix multiple consecutive downloads (by flushing when needed the
[wine/multimedia.git] / dlls / dmusic / dmusic_synth.c
blob713952dbe5cff009da81e5d6a2a99e9c98e823a1
1 /* IDirectMusicSynth Implementation
2 * IDirectMusicSynth8 Implementation
3 * IDirectMusicSynthSink Implementation
5 * Copyright (C) 2003 Rok Mandeljc
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
28 #include "dmusic_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
32 /* IDirectMusicSynth8 IUnknown parts follow: */
33 HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicSynth8Impl,iface);
37 if (IsEqualGUID(riid, &IID_IUnknown) ||
38 IsEqualGUID(riid, &IID_IDirectMusicSynth) ||
39 IsEqualGUID(riid, &IID_IDirectMusicSynth8))
41 IDirectMusicSynth8Impl_AddRef(iface);
42 *ppobj = This;
43 return S_OK;
45 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
46 return E_NOINTERFACE;
49 ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface)
51 ICOM_THIS(IDirectMusicSynth8Impl,iface);
52 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
53 return ++(This->ref);
56 ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface)
58 ICOM_THIS(IDirectMusicSynth8Impl,iface);
59 ULONG ref = --This->ref;
60 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
61 if (ref == 0)
63 HeapFree(GetProcessHeap(), 0, This);
65 return ref;
68 /* IDirectMusicSynth Interface parts follow: */
69 HRESULT WINAPI IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTPARAMS pPortParams)
71 ICOM_THIS(IDirectMusicSynth8Impl,iface);
73 FIXME("(%p, %p): stub\n", This, pPortParams);
75 return S_OK;
78 HRESULT WINAPI IDirectMusicSynth8Impl_Close (LPDIRECTMUSICSYNTH8 iface)
80 ICOM_THIS(IDirectMusicSynth8Impl,iface);
82 FIXME("(%p): stub\n", This);
84 return S_OK;
87 HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups (LPDIRECTMUSICSYNTH8 iface, DWORD dwGroups)
89 ICOM_THIS(IDirectMusicSynth8Impl,iface);
91 FIXME("(%p, %ld): stub\n", This, dwGroups);
93 return S_OK;
96 HRESULT WINAPI IDirectMusicSynth8Impl_Download (LPDIRECTMUSICSYNTH8 iface, LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree)
98 ICOM_THIS(IDirectMusicSynth8Impl,iface);
100 FIXME("(%p, %p, %p, %p): stub\n", This, phDownload, pvData, pbFree);
102 return S_OK;
105 HRESULT WINAPI IDirectMusicSynth8Impl_Unload (LPDIRECTMUSICSYNTH8 iface, HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData)
107 ICOM_THIS(IDirectMusicSynth8Impl,iface);
109 FIXME("(%p, %p, %p): stub\n", This, hDownload, hUserData);
111 return S_OK;
114 HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer)
116 ICOM_THIS(IDirectMusicSynth8Impl,iface);
118 FIXME("(%p, FIXME, %p, %ld): stub\n", This/*, rt*/, pbBuffer, cbBuffer);
120 return S_OK;
123 HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats (LPDIRECTMUSICSYNTH8 iface, LPDMUS_SYNTHSTATS pStats)
125 ICOM_THIS(IDirectMusicSynth8Impl,iface);
127 FIXME("(%p, %p): stub\n", This, pStats);
129 return S_OK;
132 HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTCAPS pCaps)
134 ICOM_THIS(IDirectMusicSynth8Impl,iface);
136 FIXME("(%p, %p): stub\n", This, pCaps);
138 return S_OK;
141 HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock* pClock)
143 ICOM_THIS(IDirectMusicSynth8Impl,iface);
145 FIXME("(%p, %p): stub\n", This, pClock);
147 return S_OK;
150 HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock** ppClock)
152 ICOM_THIS(IDirectMusicSynth8Impl,iface);
154 FIXME("(%p, %p): stub\n", This, ppClock);
156 return S_OK;
159 HRESULT WINAPI IDirectMusicSynth8Impl_Activate (LPDIRECTMUSICSYNTH8 iface, BOOL fEnable)
161 ICOM_THIS(IDirectMusicSynth8Impl,iface);
163 FIXME("(%p, %d): stub\n", This, fEnable);
165 return S_OK;
168 HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink (LPDIRECTMUSICSYNTH8 iface, IDirectMusicSynthSink* pSynthSink)
170 ICOM_THIS(IDirectMusicSynth8Impl,iface);
172 FIXME("(%p, %p): stub\n", This, pSynthSink);
174 return S_OK;
177 HRESULT WINAPI IDirectMusicSynth8Impl_Render (LPDIRECTMUSICSYNTH8 iface, short* pBuffer, DWORD dwLength, LONGLONG llPosition)
179 ICOM_THIS(IDirectMusicSynth8Impl,iface);
181 FIXME("(%p, %p, %ld, FIXME): stub\n", This, pBuffer, dwLength/*, llPosition*/);
183 return S_OK;
186 HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority)
188 ICOM_THIS(IDirectMusicSynth8Impl,iface);
190 FIXME("(%p, %ld, %ld, %ld): stub\n", This, dwChannelGroup, dwChannel, dwPriority);
192 return S_OK;
195 HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority)
197 ICOM_THIS(IDirectMusicSynth8Impl,iface);
199 FIXME("(%p, %ld, %ld, %p): stub\n", This, dwChannelGroup, dwChannel, pdwPriority);
201 return S_OK;
204 HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat (LPDIRECTMUSICSYNTH8 iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz)
206 ICOM_THIS(IDirectMusicSynth8Impl,iface);
208 FIXME("(%p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSiz);
210 return S_OK;
213 HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface, DWORD* pdwAppend)
215 ICOM_THIS(IDirectMusicSynth8Impl,iface);
217 FIXME("(%p, %p): stub\n", This, pdwAppend);
219 return S_OK;
222 /* IDirectMusicSynth8 Interface parts follow: */
223 HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd)
225 ICOM_THIS(IDirectMusicSynth8Impl,iface);
227 FIXME("(%p, FIXME, %ld, %ld, %ld, %ld, %li, %li, FIXME, FIXME, FIXME): stub\n", This/*, rt*/, dwVoiceId, dwChannelGroup, dwChannel, dwDLId, prPitch, vrVolume/*, stVoiceStart, stLoopStart, stLoopEnd*/);
229 return S_OK;
232 HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId)
234 ICOM_THIS(IDirectMusicSynth8Impl,iface);
236 FIXME("(%p, FIXME, %ld): stub\n", This/*, rt*/, dwVoiceId);
238 return S_OK;
241 HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState (LPDIRECTMUSICSYNTH8 iface, DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[])
243 ICOM_THIS(IDirectMusicSynth8Impl,iface);
245 FIXME("(%p, %p, %ld, %p): stub\n", This, dwVoice, cbVoice, dwVoiceState);
247 return S_OK;
250 HRESULT WINAPI IDirectMusicSynth8Impl_Refresh (LPDIRECTMUSICSYNTH8 iface, DWORD dwDownloadID, DWORD dwFlags)
252 ICOM_THIS(IDirectMusicSynth8Impl,iface);
254 FIXME("(%p, %ld, %ld): stub\n", This, dwDownloadID, dwFlags);
256 return S_OK;
259 HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses)
261 ICOM_THIS(IDirectMusicSynth8Impl,iface);
263 FIXME("(%p, %ld, %ld, %p, %ld): stub\n", This, dwChannelGroup, dwChannel, pdwBuses, cBuses);
265 return S_OK;
268 ICOM_VTABLE(IDirectMusicSynth8) DirectMusicSynth8_Vtbl =
270 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
271 IDirectMusicSynth8Impl_QueryInterface,
272 IDirectMusicSynth8Impl_AddRef,
273 IDirectMusicSynth8Impl_Release,
274 IDirectMusicSynth8Impl_Open,
275 IDirectMusicSynth8Impl_Close,
276 IDirectMusicSynth8Impl_SetNumChannelGroups,
277 IDirectMusicSynth8Impl_Download,
278 IDirectMusicSynth8Impl_Unload,
279 IDirectMusicSynth8Impl_PlayBuffer,
280 IDirectMusicSynth8Impl_GetRunningStats,
281 IDirectMusicSynth8Impl_GetPortCaps,
282 IDirectMusicSynth8Impl_SetMasterClock,
283 IDirectMusicSynth8Impl_GetLatencyClock,
284 IDirectMusicSynth8Impl_Activate,
285 IDirectMusicSynth8Impl_SetSynthSink,
286 IDirectMusicSynth8Impl_Render,
287 IDirectMusicSynth8Impl_SetChannelPriority,
288 IDirectMusicSynth8Impl_GetChannelPriority,
289 IDirectMusicSynth8Impl_GetFormat,
290 IDirectMusicSynth8Impl_GetAppend,
291 IDirectMusicSynth8Impl_PlayVoice,
292 IDirectMusicSynth8Impl_StopVoice,
293 IDirectMusicSynth8Impl_GetVoiceState,
294 IDirectMusicSynth8Impl_Refresh,
295 IDirectMusicSynth8Impl_AssignChannelToBuses
299 /* IDirectMusicSynthSink IUnknown parts follow: */
300 HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj)
302 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
304 if (IsEqualGUID(riid, &IID_IUnknown) ||
305 IsEqualGUID(riid, &IID_IDirectMusicSynthSink))
307 IDirectMusicSynthSinkImpl_AddRef(iface);
308 *ppobj = This;
309 return S_OK;
311 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
312 return E_NOINTERFACE;
315 ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface)
317 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
318 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
319 return ++(This->ref);
322 ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface)
324 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
325 ULONG ref = --This->ref;
326 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
327 if (ref == 0)
329 HeapFree(GetProcessHeap(), 0, This);
331 return ref;
334 /* IDirectMusicSynth Interface follow: */
335 HRESULT WINAPI IDirectMusicSinkSynthImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth)
337 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
339 FIXME("(%p, %p): stub\n", This, pSynth);
341 return S_OK;
344 HRESULT WINAPI IDirectMusicSinkSynthImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* pClock)
346 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
348 FIXME("(%p, %p): stub\n", This, pClock);
350 return S_OK;
353 HRESULT WINAPI IDirectMusicSinkSynthImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** ppClock)
355 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
357 FIXME("(%p, %p): stub\n", This, ppClock);
359 return S_OK;
362 HRESULT WINAPI IDirectMusicSinkSynthImpl_Activate (LPDIRECTMUSICSYNTHSINK iface, BOOL fEnable)
364 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
366 FIXME("(%p, %d): stub\n", This, fEnable);
368 return S_OK;
371 HRESULT WINAPI IDirectMusicSinkSynthImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface, LONGLONG llSampleTime, REFERENCE_TIME* prfTime)
373 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
375 FIXME("(%p, FIXME, %p): stub\n", This/*, llSampleTime*/, prfTime);
377 return S_OK;
380 HRESULT WINAPI IDirectMusicSinkSynthImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME rfTime, LONGLONG* pllSampleTime)
382 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
384 FIXME("(%p, FIXME, %p): stub\n", This/*, rfTime*/, pllSampleTime );
386 return S_OK;
389 HRESULT WINAPI IDirectMusicSinkSynthImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer)
391 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
393 FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
395 return S_OK;
398 HRESULT WINAPI IDirectMusicSinkSynthImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples)
400 ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
402 FIXME("(%p, %p): stub\n", This, pdwBufferSizeInSamples);
404 return S_OK;
407 ICOM_VTABLE(IDirectMusicSynthSink) DirectMusicSynthSink_Vtbl =
409 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
410 IDirectMusicSynthSinkImpl_QueryInterface,
411 IDirectMusicSynthSinkImpl_AddRef,
412 IDirectMusicSynthSinkImpl_Release,
413 IDirectMusicSinkSynthImpl_Init,
414 IDirectMusicSinkSynthImpl_SetMasterClock,
415 IDirectMusicSinkSynthImpl_GetLatencyClock,
416 IDirectMusicSinkSynthImpl_Activate,
417 IDirectMusicSinkSynthImpl_SampleToRefTime,
418 IDirectMusicSinkSynthImpl_RefTimeToSample,
419 IDirectMusicSinkSynthImpl_SetDirectSound,
420 IDirectMusicSinkSynthImpl_GetDesiredBufferSize