1 /* IDirectMusicSynth8 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 "dmsynth_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth
);
24 /* IDirectMusicSynth8Impl IUnknown part: */
25 HRESULT WINAPI
IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface
, REFIID riid
, LPVOID
*ppobj
) {
26 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
27 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
29 if (IsEqualIID (riid
, &IID_IUnknown
) ||
30 IsEqualIID (riid
, &IID_IDirectMusicSynth
) ||
31 IsEqualIID (riid
, &IID_IDirectMusicSynth8
)) {
32 IDirectMusicSynth8Impl_AddRef(iface
);
36 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
40 ULONG WINAPI
IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface
) {
41 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
42 TRACE("(%p): AddRef from %ld\n", This
, This
->ref
);
46 ULONG WINAPI
IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface
) {
47 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
48 ULONG ref
= --This
->ref
;
49 TRACE("(%p): ReleaseRef to %ld\n", This
, This
->ref
);
51 HeapFree(GetProcessHeap(), 0, This
);
56 /* IDirectMusicSynth8Impl IDirectMusicSynth part: */
57 HRESULT WINAPI
IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_PORTPARAMS pPortParams
) {
58 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
59 FIXME("(%p, %p): stub\n", This
, pPortParams
);
63 HRESULT WINAPI
IDirectMusicSynth8Impl_Close (LPDIRECTMUSICSYNTH8 iface
) {
64 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
65 FIXME("(%p): stub\n", This
);
69 HRESULT WINAPI
IDirectMusicSynth8Impl_SetNumChannelGroups (LPDIRECTMUSICSYNTH8 iface
, DWORD dwGroups
) {
70 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
71 FIXME("(%p, %ld): stub\n", This
, dwGroups
);
75 HRESULT WINAPI
IDirectMusicSynth8Impl_Download (LPDIRECTMUSICSYNTH8 iface
, LPHANDLE phDownload
, LPVOID pvData
, LPBOOL pbFree
) {
76 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
77 FIXME("(%p, %p, %p, %p): stub\n", This
, phDownload
, pvData
, pbFree
);
81 HRESULT WINAPI
IDirectMusicSynth8Impl_Unload (LPDIRECTMUSICSYNTH8 iface
, HANDLE hDownload
, HRESULT (CALLBACK
* lpFreeHandle
)(HANDLE
,HANDLE
), HANDLE hUserData
) {
82 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
83 FIXME("(%p, %p, %p): stub\n", This
, hDownload
, hUserData
);
87 HRESULT WINAPI
IDirectMusicSynth8Impl_PlayBuffer (LPDIRECTMUSICSYNTH8 iface
, REFERENCE_TIME rt
, LPBYTE pbBuffer
, DWORD cbBuffer
) {
88 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
89 FIXME("(%p, %lli, %p, %ld): stub\n", This
, rt
, pbBuffer
, cbBuffer
);
93 HRESULT WINAPI
IDirectMusicSynth8Impl_GetRunningStats (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_SYNTHSTATS pStats
) {
94 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
95 FIXME("(%p, %p): stub\n", This
, pStats
);
99 HRESULT WINAPI
IDirectMusicSynth8Impl_GetPortCaps (LPDIRECTMUSICSYNTH8 iface
, LPDMUS_PORTCAPS pCaps
) {
100 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
101 TRACE("(%p, %p)\n", This
, pCaps
);
102 *pCaps
= This
->pCaps
;
106 HRESULT WINAPI
IDirectMusicSynth8Impl_SetMasterClock (LPDIRECTMUSICSYNTH8 iface
, IReferenceClock
* pClock
) {
107 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
108 FIXME("(%p, %p): stub\n", This
, pClock
);
112 HRESULT WINAPI
IDirectMusicSynth8Impl_GetLatencyClock (LPDIRECTMUSICSYNTH8 iface
, IReferenceClock
** ppClock
) {
113 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
114 TRACE("(%p, %p)\n", This
, ppClock
);
115 *ppClock
= This
->pLatencyClock
;
119 HRESULT WINAPI
IDirectMusicSynth8Impl_Activate (LPDIRECTMUSICSYNTH8 iface
, BOOL fEnable
) {
120 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
121 TRACE("(%p, %d)\n", This
, fEnable
);
122 This
->fActive
= fEnable
;
126 HRESULT WINAPI
IDirectMusicSynth8Impl_SetSynthSink (LPDIRECTMUSICSYNTH8 iface
, IDirectMusicSynthSink
* pSynthSink
) {
127 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
128 TRACE("(%p, %p)\n", This
, pSynthSink
);
129 This
->pSynthSink
= (IDirectMusicSynthSinkImpl
*)pSynthSink
;
133 HRESULT WINAPI
IDirectMusicSynth8Impl_Render (LPDIRECTMUSICSYNTH8 iface
, short* pBuffer
, DWORD dwLength
, LONGLONG llPosition
) {
134 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
135 FIXME("(%p, %p, %ld, %lli): stub\n", This
, pBuffer
, dwLength
, llPosition
);
139 HRESULT WINAPI
IDirectMusicSynth8Impl_SetChannelPriority (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, DWORD dwPriority
) {
140 /*ICOM_THIS(IDirectMusicSynth8Impl,iface); */
141 /* silenced because of too many messages - 1000 groups * 16 channels ;=) */
142 /*FIXME("(%p, %ld, %ld, %ld): stub\n", This, dwChannelGroup, dwChannel, dwPriority); */
146 HRESULT WINAPI
IDirectMusicSynth8Impl_GetChannelPriority (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwPriority
) {
147 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
148 FIXME("(%p, %ld, %ld, %p): stub\n", This
, dwChannelGroup
, dwChannel
, pdwPriority
);
152 HRESULT WINAPI
IDirectMusicSynth8Impl_GetFormat (LPDIRECTMUSICSYNTH8 iface
, LPWAVEFORMATEX pWaveFormatEx
, LPDWORD pdwWaveFormatExSiz
) {
153 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
154 FIXME("(%p, %p, %p): stub\n", This
, pWaveFormatEx
, pdwWaveFormatExSiz
);
158 HRESULT WINAPI
IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface
, DWORD
* pdwAppend
) {
159 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
160 FIXME("(%p, %p): stub\n", This
, pdwAppend
);
164 /* IDirectMusicSynth8Impl IDirectMusicSynth8 part: */
165 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
) {
166 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
167 FIXME("(%p, %lli, %ld, %ld, %ld, %ld, %li, %li,%lli, %lli, %lli): stub\n", This
, rt
, dwVoiceId
, dwChannelGroup
, dwChannel
, dwDLId
, prPitch
, vrVolume
, stVoiceStart
, stLoopStart
, stLoopEnd
);
171 HRESULT WINAPI
IDirectMusicSynth8Impl_StopVoice (LPDIRECTMUSICSYNTH8 iface
, REFERENCE_TIME rt
, DWORD dwVoiceId
) {
172 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
173 FIXME("(%p, %lli, %ld): stub\n", This
, rt
, dwVoiceId
);
177 HRESULT WINAPI
IDirectMusicSynth8Impl_GetVoiceState (LPDIRECTMUSICSYNTH8 iface
, DWORD dwVoice
[], DWORD cbVoice
, DMUS_VOICE_STATE dwVoiceState
[]) {
178 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
179 FIXME("(%p, %p, %ld, %p): stub\n", This
, dwVoice
, cbVoice
, dwVoiceState
);
183 HRESULT WINAPI
IDirectMusicSynth8Impl_Refresh (LPDIRECTMUSICSYNTH8 iface
, DWORD dwDownloadID
, DWORD dwFlags
) {
184 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
185 FIXME("(%p, %ld, %ld): stub\n", This
, dwDownloadID
, dwFlags
);
189 HRESULT WINAPI
IDirectMusicSynth8Impl_AssignChannelToBuses (LPDIRECTMUSICSYNTH8 iface
, DWORD dwChannelGroup
, DWORD dwChannel
, LPDWORD pdwBuses
, DWORD cBuses
) {
190 ICOM_THIS(IDirectMusicSynth8Impl
,iface
);
191 FIXME("(%p, %ld, %ld, %p, %ld): stub\n", This
, dwChannelGroup
, dwChannel
, pdwBuses
, cBuses
);
195 ICOM_VTABLE(IDirectMusicSynth8
) DirectMusicSynth8_Vtbl
= {
196 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
197 IDirectMusicSynth8Impl_QueryInterface
,
198 IDirectMusicSynth8Impl_AddRef
,
199 IDirectMusicSynth8Impl_Release
,
200 IDirectMusicSynth8Impl_Open
,
201 IDirectMusicSynth8Impl_Close
,
202 IDirectMusicSynth8Impl_SetNumChannelGroups
,
203 IDirectMusicSynth8Impl_Download
,
204 IDirectMusicSynth8Impl_Unload
,
205 IDirectMusicSynth8Impl_PlayBuffer
,
206 IDirectMusicSynth8Impl_GetRunningStats
,
207 IDirectMusicSynth8Impl_GetPortCaps
,
208 IDirectMusicSynth8Impl_SetMasterClock
,
209 IDirectMusicSynth8Impl_GetLatencyClock
,
210 IDirectMusicSynth8Impl_Activate
,
211 IDirectMusicSynth8Impl_SetSynthSink
,
212 IDirectMusicSynth8Impl_Render
,
213 IDirectMusicSynth8Impl_SetChannelPriority
,
214 IDirectMusicSynth8Impl_GetChannelPriority
,
215 IDirectMusicSynth8Impl_GetFormat
,
216 IDirectMusicSynth8Impl_GetAppend
,
217 IDirectMusicSynth8Impl_PlayVoice
,
218 IDirectMusicSynth8Impl_StopVoice
,
219 IDirectMusicSynth8Impl_GetVoiceState
,
220 IDirectMusicSynth8Impl_Refresh
,
221 IDirectMusicSynth8Impl_AssignChannelToBuses
224 /* for ClassFactory */
225 HRESULT WINAPI
DMUSIC_CreateDirectMusicSynthImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) {
226 IDirectMusicSynth8Impl
*obj
;
228 TRACE("(%p,%p,%p)\n", lpcGUID
, ppobj
, pUnkOuter
);
229 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSynth8Impl
));
231 *ppobj
= (LPDIRECTMUSICSYNTH8
) NULL
;
232 return E_OUTOFMEMORY
;
234 obj
->lpVtbl
= &DirectMusicSynth8_Vtbl
;
237 obj
->pCaps
.dwSize
= sizeof(DMUS_PORTCAPS
);
238 obj
->pCaps
.dwFlags
= DMUS_PC_DLS
| DMUS_PC_SOFTWARESYNTH
| DMUS_PC_DIRECTSOUND
| DMUS_PC_DLS2
| DMUS_PC_AUDIOPATH
| DMUS_PC_WAVE
;
239 obj
->pCaps
.guidPort
= CLSID_DirectMusicSynth
;
240 obj
->pCaps
.dwClass
= DMUS_PC_OUTPUTCLASS
;
241 obj
->pCaps
.dwType
= DMUS_PORT_WINMM_DRIVER
;
242 obj
->pCaps
.dwMemorySize
= DMUS_PC_SYSTEMMEMORY
;
243 obj
->pCaps
.dwMaxChannelGroups
= 1000;
244 obj
->pCaps
.dwMaxVoices
= 1000;
245 obj
->pCaps
.dwMaxAudioChannels
= -1;
246 obj
->pCaps
.dwEffectFlags
= DMUS_EFFECT_REVERB
| DMUS_EFFECT_CHORUS
| DMUS_EFFECT_DELAY
;
247 MultiByteToWideChar (CP_ACP
, 0, "Microsotf Synthesizer", -1, obj
->pCaps
.wszDescription
, sizeof(obj
->pCaps
.wszDescription
)/sizeof(WCHAR
));
248 /* assign latency clock */
249 /*DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&This->pLatencyClock, NULL); */
251 return IDirectMusicSynth8Impl_QueryInterface ((LPDIRECTMUSICSYNTH8
)obj
, lpcGUID
, ppobj
);