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.
26 #include "wine/debug.h"
28 #include "dmusic_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
32 /* IDirectMusicSynth IUnknown parts follow: */
33 HRESULT WINAPI
IDirectMusicSynthImpl_QueryInterface (LPDIRECTMUSICSYNTH iface
, REFIID riid
, LPVOID
*ppobj
)
35 ICOM_THIS(IDirectMusicSynthImpl
,iface
);
37 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicSynth
))
39 IDirectMusicSynthImpl_AddRef(iface
);
43 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
47 ULONG WINAPI
IDirectMusicSynthImpl_AddRef (LPDIRECTMUSICSYNTH iface
)
49 ICOM_THIS(IDirectMusicSynthImpl
,iface
);
50 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
54 ULONG WINAPI
IDirectMusicSynthImpl_Release (LPDIRECTMUSICSYNTH iface
)
56 ICOM_THIS(IDirectMusicSynthImpl
,iface
);
57 ULONG ref
= --This
->ref
;
58 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
61 HeapFree(GetProcessHeap(), 0, This
);
66 /* IDirectMusicSynth Interface follow: */
67 HRESULT WINAPI
IDirectMusicSynthImpl_Open (LPDIRECTMUSICSYNTH iface
, LPDMUS_PORTPARAMS pPortParams
)
73 HRESULT WINAPI
IDirectMusicSynthImpl_Close (LPDIRECTMUSICSYNTH iface
)
79 HRESULT WINAPI
IDirectMusicSynthImpl_SetNumChannelGroups (LPDIRECTMUSICSYNTH iface
, DWORD dwGroups
)
85 HRESULT WINAPI
IDirectMusicSynthImpl_Download (LPDIRECTMUSICSYNTH iface
, LPHANDLE phDownload
, LPVOID pvData
, LPBOOL pbFree
)
91 HRESULT WINAPI
IDirectMusicSynthImpl_Unload (LPDIRECTMUSICSYNTH iface
, HANDLE hDownload
, HRESULT (CALLBACK
* lpFreeHandle
)(HANDLE
,HANDLE
), HANDLE hUserData
)
97 HRESULT WINAPI
IDirectMusicSynthImpl_PlayBuffer (LPDIRECTMUSICSYNTH iface
, REFERENCE_TIME rt
, LPBYTE pbBuffer
, DWORD cbBuffer
)
103 HRESULT WINAPI
IDirectMusicSynthImpl_GetRunningStats (LPDIRECTMUSICSYNTH iface
, LPDMUS_SYNTHSTATS pStats
)
109 HRESULT WINAPI
IDirectMusicSynthImpl_GetPortCaps (LPDIRECTMUSICSYNTH iface
, LPDMUS_PORTCAPS pCaps
)
115 HRESULT WINAPI
IDirectMusicSynthImpl_SetMasterClock (LPDIRECTMUSICSYNTH iface
, IReferenceClock
* pClock
)
121 HRESULT WINAPI
IDirectMusicSynthImpl_GetLatencyClock (LPDIRECTMUSICSYNTH iface
, IReferenceClock
** ppClock
)
127 HRESULT WINAPI
IDirectMusicSynthImpl_Activate (LPDIRECTMUSICSYNTH iface
, BOOL fEnable
)
133 HRESULT WINAPI
IDirectMusicSynthImpl_SetSynthSink (LPDIRECTMUSICSYNTH iface
, IDirectMusicSynthSink
* pSynthSink
)
139 HRESULT WINAPI
IDirectMusicSynthImpl_Render (LPDIRECTMUSICSYNTH iface
, short* pBuffer
, DWORD dwLength
, LONGLONG llPosition
)
145 HRESULT WINAPI
IDirectMusicSynthImpl_SetChannelPriority (LPDIRECTMUSICSYNTH iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
)
151 HRESULT WINAPI
IDirectMusicSynthImpl_GetChannelPriority (LPDIRECTMUSICSYNTH iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
)
157 HRESULT WINAPI
IDirectMusicSynthImpl_GetFormat (LPDIRECTMUSICSYNTH iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSiz
)
163 HRESULT WINAPI
IDirectMusicSynthImpl_GetAppend (LPDIRECTMUSICSYNTH iface
, DWORD
* pdwAppend
)
169 ICOM_VTABLE(IDirectMusicSynth
) DirectMusicSynth_Vtbl
=
171 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
172 IDirectMusicSynthImpl_QueryInterface
,
173 IDirectMusicSynthImpl_AddRef
,
174 IDirectMusicSynthImpl_Release
,
175 IDirectMusicSynthImpl_Open
,
176 IDirectMusicSynthImpl_Close
,
177 IDirectMusicSynthImpl_SetNumChannelGroups
,
178 IDirectMusicSynthImpl_Download
,
179 IDirectMusicSynthImpl_Unload
,
180 IDirectMusicSynthImpl_PlayBuffer
,
181 IDirectMusicSynthImpl_GetRunningStats
,
182 IDirectMusicSynthImpl_GetPortCaps
,
183 IDirectMusicSynthImpl_SetMasterClock
,
184 IDirectMusicSynthImpl_GetLatencyClock
,
185 IDirectMusicSynthImpl_Activate
,
186 IDirectMusicSynthImpl_SetSynthSink
,
187 IDirectMusicSynthImpl_Render
,
188 IDirectMusicSynthImpl_SetChannelPriority
,
189 IDirectMusicSynthImpl_GetChannelPriority
,
190 IDirectMusicSynthImpl_GetFormat
,
191 IDirectMusicSynthImpl_GetAppend
195 /* IDirectMusicSynth8 IUnknown parts follow: */
196 HRESULT WINAPI
IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface
, REFIID riid
, LPVOID
*ppobj
)
198 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
200 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicSynth8
))
202 IDirectMusicSynth8Impl_AddRef(iface
);
206 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
207 return E_NOINTERFACE
;
210 ULONG WINAPI
IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface
)
212 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
213 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
214 return ++(This
->ref
);
217 ULONG WINAPI
IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface
)
219 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
220 ULONG ref
= --This
->ref
;
221 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
224 HeapFree(GetProcessHeap(), 0, This
);
229 /* IDirectMusicSynth Interface parts follow: */
230 HRESULT WINAPI
IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_PORTPARAMS pPortParams
)
236 HRESULT WINAPI
IDirectMusicSynth8Impl_Close (LPDIRECTMUSICSYNTH8 iface
)
242 HRESULT WINAPI
IDirectMusicSynth8Impl_SetNumChannelGroups (LPDIRECTMUSICSYNTH8 iface
, DWORD dwGroups
)
248 HRESULT WINAPI
IDirectMusicSynth8Impl_Download (LPDIRECTMUSICSYNTH8 iface
, LPHANDLE phDownload
, LPVOID pvData
, LPBOOL pbFree
)
254 HRESULT WINAPI
IDirectMusicSynth8Impl_Unload (LPDIRECTMUSICSYNTH8 iface
, HANDLE hDownload
, HRESULT (CALLBACK
* lpFreeHandle
)(HANDLE
,HANDLE
), HANDLE hUserData
)
260 HRESULT WINAPI
IDirectMusicSynth8Impl_PlayBuffer (LPDIRECTMUSICSYNTH8 iface
, REFERENCE_TIME rt
, LPBYTE pbBuffer
, DWORD cbBuffer
)
266 HRESULT WINAPI
IDirectMusicSynth8Impl_GetRunningStats (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_SYNTHSTATS pStats
)
272 HRESULT WINAPI
IDirectMusicSynth8Impl_GetPortCaps (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_PORTCAPS pCaps
)
278 HRESULT WINAPI
IDirectMusicSynth8Impl_SetMasterClock (LPDIRECTMUSICSYNTH8 iface
, IReferenceClock
* pClock
)
284 HRESULT WINAPI
IDirectMusicSynth8Impl_GetLatencyClock (LPDIRECTMUSICSYNTH8 iface
, IReferenceClock
** ppClock
)
290 HRESULT WINAPI
IDirectMusicSynth8Impl_Activate (LPDIRECTMUSICSYNTH8 iface
, BOOL fEnable
)
296 HRESULT WINAPI
IDirectMusicSynth8Impl_SetSynthSink (LPDIRECTMUSICSYNTH8 iface
, IDirectMusicSynthSink
* pSynthSink
)
302 HRESULT WINAPI
IDirectMusicSynth8Impl_Render (LPDIRECTMUSICSYNTH8 iface
, short* pBuffer
, DWORD dwLength
, LONGLONG llPosition
)
308 HRESULT WINAPI
IDirectMusicSynth8Impl_SetChannelPriority (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
)
314 HRESULT WINAPI
IDirectMusicSynth8Impl_GetChannelPriority (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
)
320 HRESULT WINAPI
IDirectMusicSynth8Impl_GetFormat (LPDIRECTMUSICSYNTH8 iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSiz
)
326 HRESULT WINAPI
IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface
, DWORD
* pdwAppend
)
332 /* IDirectMusicSynth8 Interface parts follow: */
333 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
)
339 HRESULT WINAPI
IDirectMusicSynth8Impl_StopVoice (LPDIRECTMUSICSYNTH8 iface
, REFERENCE_TIME rt
, DWORD dwVoiceId
)
345 HRESULT WINAPI
IDirectMusicSynth8Impl_GetVoiceState (LPDIRECTMUSICSYNTH8 iface
, DWORD dwVoice
[], DWORD cbVoice
, DMUS_VOICE_STATE dwVoiceState
[])
351 HRESULT WINAPI
IDirectMusicSynth8Impl_Refresh (LPDIRECTMUSICSYNTH8 iface
, DWORD dwDownloadID
, DWORD dwFlags
)
357 HRESULT WINAPI
IDirectMusicSynth8Impl_AssignChannelToBuses (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwBuses
, DWORD cBuses
)
363 ICOM_VTABLE(IDirectMusicSynth8
) DirectMusicSynth8_Vtbl
=
365 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
366 IDirectMusicSynth8Impl_QueryInterface
,
367 IDirectMusicSynth8Impl_AddRef
,
368 IDirectMusicSynth8Impl_Release
,
369 IDirectMusicSynth8Impl_Open
,
370 IDirectMusicSynth8Impl_Close
,
371 IDirectMusicSynth8Impl_SetNumChannelGroups
,
372 IDirectMusicSynth8Impl_Download
,
373 IDirectMusicSynth8Impl_Unload
,
374 IDirectMusicSynth8Impl_PlayBuffer
,
375 IDirectMusicSynth8Impl_GetRunningStats
,
376 IDirectMusicSynth8Impl_GetPortCaps
,
377 IDirectMusicSynth8Impl_SetMasterClock
,
378 IDirectMusicSynth8Impl_GetLatencyClock
,
379 IDirectMusicSynth8Impl_Activate
,
380 IDirectMusicSynth8Impl_SetSynthSink
,
381 IDirectMusicSynth8Impl_Render
,
382 IDirectMusicSynth8Impl_SetChannelPriority
,
383 IDirectMusicSynth8Impl_GetChannelPriority
,
384 IDirectMusicSynth8Impl_GetFormat
,
385 IDirectMusicSynth8Impl_GetAppend
,
386 IDirectMusicSynth8Impl_PlayVoice
,
387 IDirectMusicSynth8Impl_StopVoice
,
388 IDirectMusicSynth8Impl_GetVoiceState
,
389 IDirectMusicSynth8Impl_Refresh
,
390 IDirectMusicSynth8Impl_AssignChannelToBuses
394 /* IDirectMusicSynthSink IUnknown parts follow: */
395 HRESULT WINAPI
IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface
, REFIID riid
, LPVOID
*ppobj
)
397 ICOM_THIS(IDirectMusicSynthSinkImpl
,iface
);
399 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectMusicSynthSink
))
401 IDirectMusicSynthSinkImpl_AddRef(iface
);
405 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
406 return E_NOINTERFACE
;
409 ULONG WINAPI
IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface
)
411 ICOM_THIS(IDirectMusicSynthSinkImpl
,iface
);
412 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
413 return ++(This
->ref
);
416 ULONG WINAPI
IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface
)
418 ICOM_THIS(IDirectMusicSynthSinkImpl
,iface
);
419 ULONG ref
= --This
->ref
;
420 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
423 HeapFree(GetProcessHeap(), 0, This
);
428 /* IDirectMusicSynth Interface follow: */
429 HRESULT WINAPI
IDirectMusicSinkSynthImpl_Init (LPDIRECTMUSICSYNTHSINK iface
, IDirectMusicSynth
* pSynth
)
435 HRESULT WINAPI
IDirectMusicSinkSynthImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface
, IReferenceClock
* pClock
)
441 HRESULT WINAPI
IDirectMusicSinkSynthImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface
, IReferenceClock
** ppClock
)
447 HRESULT WINAPI
IDirectMusicSinkSynthImpl_Activate (LPDIRECTMUSICSYNTHSINK iface
, BOOL fEnable
)
453 HRESULT WINAPI
IDirectMusicSinkSynthImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface
, LONGLONG llSampleTime
, REFERENCE_TIME
* prfTime
)
459 HRESULT WINAPI
IDirectMusicSinkSynthImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface
, REFERENCE_TIME rfTime
, LONGLONG
* pllSampleTime
)
465 HRESULT WINAPI
IDirectMusicSinkSynthImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface
, LPDIRECTSOUND pDirectSound
, LPDIRECTSOUNDBUFFER pDirectSoundBuffer
)
471 HRESULT WINAPI
IDirectMusicSinkSynthImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface
, LPDWORD pdwBufferSizeInSamples
)
477 ICOM_VTABLE(IDirectMusicSynthSink
) DirectMusicSynthSink_Vtbl
=
479 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
480 IDirectMusicSynthSinkImpl_QueryInterface
,
481 IDirectMusicSynthSinkImpl_AddRef
,
482 IDirectMusicSynthSinkImpl_Release
,
483 IDirectMusicSinkSynthImpl_Init
,
484 IDirectMusicSinkSynthImpl_SetMasterClock
,
485 IDirectMusicSinkSynthImpl_GetLatencyClock
,
486 IDirectMusicSinkSynthImpl_Activate
,
487 IDirectMusicSinkSynthImpl_SampleToRefTime
,
488 IDirectMusicSinkSynthImpl_RefTimeToSample
,
489 IDirectMusicSinkSynthImpl_SetDirectSound
,
490 IDirectMusicSinkSynthImpl_GetDesiredBufferSize