winex11.drv: Map coordinates before calling send_mouse_input.
[wine/zf.git] / dlls / dmime / wavetrack.c
blob1c6b08b523556002e00ca5a3dc90bdbf828df552
1 /* IDirectMusicWaveTrack Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmime_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
25 /*****************************************************************************
26 * IDirectMusicWaveTrack implementation
28 /*****************************************************************************
29 * IDirectMusicChordMapTrack implementation
31 typedef struct IDirectMusicWaveTrack {
32 IDirectMusicTrack8 IDirectMusicTrack8_iface;
33 struct dmobject dmobj; /* IPersistStream only */
34 LONG ref;
35 } IDirectMusicWaveTrack;
37 /* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
38 static inline IDirectMusicWaveTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
40 return CONTAINING_RECORD(iface, IDirectMusicWaveTrack, IDirectMusicTrack8_iface);
43 static HRESULT WINAPI wave_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
44 void **ret_iface)
46 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
48 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
50 *ret_iface = NULL;
52 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) ||
53 IsEqualIID(riid, &IID_IDirectMusicTrack8))
54 *ret_iface = iface;
55 else if (IsEqualIID(riid, &IID_IPersistStream))
56 *ret_iface = &This->dmobj.IPersistStream_iface;
57 else {
58 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ret_iface);
63 return S_OK;
66 static ULONG WINAPI wave_track_AddRef(IDirectMusicTrack8 *iface)
68 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
69 LONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) ref=%d\n", This, ref);
73 return ref;
76 static ULONG WINAPI wave_track_Release(IDirectMusicTrack8 *iface)
78 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 if (!ref) {
84 HeapFree(GetProcessHeap(), 0, This);
85 DMIME_UnlockModule();
88 return ref;
91 static HRESULT WINAPI wave_track_Init(IDirectMusicTrack8 *iface, IDirectMusicSegment *pSegment)
93 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
94 FIXME("(%p, %p): stub\n", This, pSegment);
95 return S_OK;
98 static HRESULT WINAPI wave_track_InitPlay(IDirectMusicTrack8 *iface,
99 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
100 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
102 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
103 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
104 return S_OK;
107 static HRESULT WINAPI wave_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
109 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
110 FIXME("(%p, %p): stub\n", This, pStateData);
111 return S_OK;
114 static HRESULT WINAPI wave_track_Play(IDirectMusicTrack8 *iface, void *pStateData,
115 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
116 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
118 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
119 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
120 return S_OK;
123 static HRESULT WINAPI wave_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
124 MUSIC_TIME *next, void *param)
126 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
128 TRACE("(%p, %s, %d, %p, %p): not supported\n", This, debugstr_dmguid(type), time, next, param);
129 return DMUS_E_GET_UNSUPPORTED;
132 static HRESULT WINAPI wave_track_SetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
133 void *param)
135 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
137 TRACE("(%p, %s, %d, %p)\n", This, debugstr_dmguid(type), time, param);
139 if (IsEqualGUID(type, &GUID_Disable_Auto_Download)) {
140 FIXME("GUID_Disable_Auto_Download not handled yet\n");
141 return S_OK;
143 if (IsEqualGUID(type, &GUID_Download)) {
144 FIXME("GUID_Download not handled yet\n");
145 return S_OK;
147 if (IsEqualGUID(type, &GUID_DownloadToAudioPath)) {
148 FIXME("GUID_DownloadToAudioPath not handled yet\n");
149 return S_OK;
151 if (IsEqualGUID(type, &GUID_Enable_Auto_Download)) {
152 FIXME("GUID_Enable_Auto_Download not handled yet\n");
153 return S_OK;
155 if (IsEqualGUID(type, &GUID_Unload)) {
156 FIXME("GUID_Unload not handled yet\n");
157 return S_OK;
159 if (IsEqualGUID(type, &GUID_UnloadFromAudioPath)) {
160 FIXME("GUID_UnloadFromAudioPath not handled yet\n");
161 return S_OK;
164 return DMUS_E_TYPE_UNSUPPORTED;
167 static HRESULT WINAPI wave_track_IsParamSupported(IDirectMusicTrack8 *iface, REFGUID type)
169 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
170 static const GUID *valid[] = {
171 &GUID_Disable_Auto_Download,
172 &GUID_Download,
173 &GUID_DownloadToAudioPath,
174 &GUID_Enable_Auto_Download,
175 &GUID_Unload,
176 &GUID_UnloadFromAudioPath
178 unsigned int i;
180 TRACE("(%p, %s)\n", This, debugstr_dmguid(type));
182 for (i = 0; i < ARRAY_SIZE(valid); i++)
183 if (IsEqualGUID(type, valid[i]))
184 return S_OK;
186 TRACE("param unsupported\n");
187 return DMUS_E_TYPE_UNSUPPORTED;
190 static HRESULT WINAPI wave_track_AddNotificationType(IDirectMusicTrack8 *iface, REFGUID notiftype)
192 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
194 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
195 return E_NOTIMPL;
198 static HRESULT WINAPI wave_track_RemoveNotificationType(IDirectMusicTrack8 *iface,
199 REFGUID notiftype)
201 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
203 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
204 return E_NOTIMPL;
207 static HRESULT WINAPI wave_track_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
208 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
210 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
211 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
212 return S_OK;
215 static HRESULT WINAPI wave_track_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
216 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
217 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
219 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
220 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
221 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
222 return S_OK;
225 static HRESULT WINAPI wave_track_GetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
226 REFERENCE_TIME rtTime, REFERENCE_TIME *prtNext, void *pParam, void *pStateData,
227 DWORD dwFlags)
229 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
230 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
231 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
232 return S_OK;
235 static HRESULT WINAPI wave_track_SetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
236 REFERENCE_TIME rtTime, void *pParam, void *pStateData, DWORD dwFlags)
238 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
239 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
240 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
241 return S_OK;
244 static HRESULT WINAPI wave_track_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
245 DWORD trackgroup, IDirectMusicTrack **track)
247 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
249 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
250 return E_NOTIMPL;
253 static HRESULT WINAPI wave_track_Join(IDirectMusicTrack8 *iface, IDirectMusicTrack *newtrack,
254 MUSIC_TIME join, IUnknown *context, DWORD trackgroup, IDirectMusicTrack **resulttrack)
256 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
257 TRACE("(%p, %p, %d, %p, %d, %p): method not implemented\n", This, newtrack, join, context,
258 trackgroup, resulttrack);
259 return E_NOTIMPL;
262 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
263 wave_track_QueryInterface,
264 wave_track_AddRef,
265 wave_track_Release,
266 wave_track_Init,
267 wave_track_InitPlay,
268 wave_track_EndPlay,
269 wave_track_Play,
270 wave_track_GetParam,
271 wave_track_SetParam,
272 wave_track_IsParamSupported,
273 wave_track_AddNotificationType,
274 wave_track_RemoveNotificationType,
275 wave_track_Clone,
276 wave_track_PlayEx,
277 wave_track_GetParamEx,
278 wave_track_SetParamEx,
279 wave_track_Compose,
280 wave_track_Join
283 static HRESULT WINAPI wave_IPersistStream_Load(IPersistStream *iface, IStream *stream)
285 FIXME(": Loading not implemented yet\n");
286 return S_OK;
289 static const IPersistStreamVtbl persiststream_vtbl = {
290 dmobj_IPersistStream_QueryInterface,
291 dmobj_IPersistStream_AddRef,
292 dmobj_IPersistStream_Release,
293 dmobj_IPersistStream_GetClassID,
294 unimpl_IPersistStream_IsDirty,
295 wave_IPersistStream_Load,
296 unimpl_IPersistStream_Save,
297 unimpl_IPersistStream_GetSizeMax
300 /* for ClassFactory */
301 HRESULT WINAPI create_dmwavetrack(REFIID lpcGUID, void **ppobj)
303 IDirectMusicWaveTrack *track;
304 HRESULT hr;
306 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
307 if (!track) {
308 *ppobj = NULL;
309 return E_OUTOFMEMORY;
311 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
312 track->ref = 1;
313 dmobject_init(&track->dmobj, &CLSID_DirectMusicWaveTrack,
314 (IUnknown *)&track->IDirectMusicTrack8_iface);
315 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
317 DMIME_LockModule();
318 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
319 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
321 return hr;