1 /* IDirectMusicSysExTrack Implementation
3 * Copyright (C) 2003 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.
24 #include "wine/debug.h"
26 #include "dmime_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
29 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
31 /*****************************************************************************
32 * IDirectMusicSysExTrack implementation
34 /* IDirectMusicSysExTrack IUnknown part: */
35 HRESULT WINAPI IDirectMusicSysExTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj)
37 ICOM_THIS(IDirectMusicSysExTrack,iface);
39 if (IsEqualIID (riid, &IID_IUnknown) ||
40 IsEqualIID (riid, &IID_IDirectMusicTrack) ||
41 IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
42 IDirectMusicSysExTrack_AddRef(iface);
45 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
46 IDirectMusicSysExTrackStream_AddRef ((LPPERSISTSTREAM)This->pStream);
47 *ppobj = This->pStream;
50 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
54 ULONG WINAPI IDirectMusicSysExTrack_AddRef (LPDIRECTMUSICTRACK8 iface)
56 ICOM_THIS(IDirectMusicSysExTrack,iface);
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
61 ULONG WINAPI IDirectMusicSysExTrack_Release (LPDIRECTMUSICTRACK8 iface)
63 ICOM_THIS(IDirectMusicSysExTrack,iface);
64 ULONG ref = --This->ref;
65 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
67 HeapFree(GetProcessHeap(), 0, This);
72 /* IDirectMusicSysExTrack IDirectMusicTrack part: */
73 HRESULT WINAPI IDirectMusicSysExTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment)
75 ICOM_THIS(IDirectMusicSysExTrack,iface);
77 FIXME("(%p, %p): stub\n", This, pSegment);
82 HRESULT WINAPI IDirectMusicSysExTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
84 ICOM_THIS(IDirectMusicSysExTrack,iface);
86 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
91 HRESULT WINAPI IDirectMusicSysExTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
93 ICOM_THIS(IDirectMusicSysExTrack,iface);
95 FIXME("(%p, %p): stub\n", This, pStateData);
100 HRESULT WINAPI IDirectMusicSysExTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
102 ICOM_THIS(IDirectMusicSysExTrack,iface);
104 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
109 HRESULT WINAPI IDirectMusicSysExTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
111 ICOM_THIS(IDirectMusicSysExTrack,iface);
113 FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pmtNext, pParam);
118 HRESULT WINAPI IDirectMusicSysExTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam)
120 ICOM_THIS(IDirectMusicSysExTrack,iface);
122 FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_guid(rguidType), mtTime, pParam);
127 HRESULT WINAPI IDirectMusicSysExTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType)
129 ICOM_THIS(IDirectMusicSysExTrack,iface);
131 TRACE("(%p, %s): ", This, debugstr_guid(rguidType));
132 /* didn't find any params */
134 TRACE("param unsupported\n");
135 return DMUS_E_TYPE_UNSUPPORTED;
138 HRESULT WINAPI IDirectMusicSysExTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType)
140 ICOM_THIS(IDirectMusicSysExTrack,iface);
142 FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType));
147 HRESULT WINAPI IDirectMusicSysExTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType)
149 ICOM_THIS(IDirectMusicSysExTrack,iface);
151 FIXME("(%p, %s): stub\n", This, debugstr_guid(rguidNotificationType));
156 HRESULT WINAPI IDirectMusicSysExTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack)
158 ICOM_THIS(IDirectMusicSysExTrack,iface);
160 FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
165 /* IDirectMusicSysExTrack IDirectMusicTrack8 part: */
166 HRESULT WINAPI IDirectMusicSysExTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
168 ICOM_THIS(IDirectMusicSysExTrack,iface);
170 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
175 HRESULT WINAPI IDirectMusicSysExTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags)
177 ICOM_THIS(IDirectMusicSysExTrack,iface);
179 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
184 HRESULT WINAPI IDirectMusicSysExTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags)
186 ICOM_THIS(IDirectMusicSysExTrack,iface);
188 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_guid(rguidType), rtTime, pParam, pStateData, dwFlags);
193 HRESULT WINAPI IDirectMusicSysExTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack)
195 ICOM_THIS(IDirectMusicSysExTrack,iface);
197 FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
202 HRESULT WINAPI IDirectMusicSysExTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack)
204 ICOM_THIS(IDirectMusicSysExTrack,iface);
206 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
211 ICOM_VTABLE(IDirectMusicTrack8) DirectMusicSysExTrack_Vtbl =
213 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
214 IDirectMusicSysExTrack_QueryInterface,
215 IDirectMusicSysExTrack_AddRef,
216 IDirectMusicSysExTrack_Release,
217 IDirectMusicSysExTrack_Init,
218 IDirectMusicSysExTrack_InitPlay,
219 IDirectMusicSysExTrack_EndPlay,
220 IDirectMusicSysExTrack_Play,
221 IDirectMusicSysExTrack_GetParam,
222 IDirectMusicSysExTrack_SetParam,
223 IDirectMusicSysExTrack_IsParamSupported,
224 IDirectMusicSysExTrack_AddNotificationType,
225 IDirectMusicSysExTrack_RemoveNotificationType,
226 IDirectMusicSysExTrack_Clone,
227 IDirectMusicSysExTrack_PlayEx,
228 IDirectMusicSysExTrack_GetParamEx,
229 IDirectMusicSysExTrack_SetParamEx,
230 IDirectMusicSysExTrack_Compose,
231 IDirectMusicSysExTrack_Join
234 /* for ClassFactory */
235 HRESULT WINAPI DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID, LPDIRECTMUSICTRACK8 *ppTrack, LPUNKNOWN pUnkOuter)
237 IDirectMusicSysExTrack* track;
239 if (IsEqualIID (lpcGUID, &IID_IDirectMusicTrack)
240 || IsEqualIID (lpcGUID, &IID_IDirectMusicTrack8)) {
241 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSysExTrack));
243 *ppTrack = (LPDIRECTMUSICTRACK8) NULL;
244 return E_OUTOFMEMORY;
246 track->lpVtbl = &DirectMusicSysExTrack_Vtbl;
248 track->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSysExTrackStream));
249 track->pStream->lpVtbl = &DirectMusicSysExTrackStream_Vtbl;
250 track->pStream->ref = 1;
251 track->pStream->pParentTrack = track;
252 *ppTrack = (LPDIRECTMUSICTRACK8) track;
255 WARN("No interface found\n");
257 return E_NOINTERFACE;
261 /*****************************************************************************
262 * IDirectMusicSysExTrackStream implementation
264 /* IDirectMusicSysExTrackStream IUnknown part follow: */
265 HRESULT WINAPI IDirectMusicSysExTrackStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
267 ICOM_THIS(IDirectMusicSysExTrackStream,iface);
269 if (IsEqualIID (riid, &IID_IUnknown)
270 || IsEqualIID (riid, &IID_IPersistStream)) {
271 IDirectMusicSysExTrackStream_AddRef(iface);
276 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
277 return E_NOINTERFACE;
280 ULONG WINAPI IDirectMusicSysExTrackStream_AddRef (LPPERSISTSTREAM iface)
282 ICOM_THIS(IDirectMusicSysExTrackStream,iface);
283 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
284 return ++(This->ref);
287 ULONG WINAPI IDirectMusicSysExTrackStream_Release (LPPERSISTSTREAM iface)
289 ICOM_THIS(IDirectMusicSysExTrackStream,iface);
290 ULONG ref = --This->ref;
291 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
293 HeapFree(GetProcessHeap(), 0, This);
298 /* IDirectMusicSysExTrackStream IPersist part: */
299 HRESULT WINAPI IDirectMusicSysExTrackStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
304 /* IDirectMusicSysExTrackStream IPersistStream part: */
305 HRESULT WINAPI IDirectMusicSysExTrackStream_IsDirty (LPPERSISTSTREAM iface)
310 HRESULT WINAPI IDirectMusicSysExTrackStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
312 FIXME(": Loading not implemented yet\n");
316 HRESULT WINAPI IDirectMusicSysExTrackStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
321 HRESULT WINAPI IDirectMusicSysExTrackStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
326 ICOM_VTABLE(IPersistStream) DirectMusicSysExTrackStream_Vtbl =
328 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
329 IDirectMusicSysExTrackStream_QueryInterface,
330 IDirectMusicSysExTrackStream_AddRef,
331 IDirectMusicSysExTrackStream_Release,
332 IDirectMusicSysExTrackStream_GetClassID,
333 IDirectMusicSysExTrackStream_IsDirty,
334 IDirectMusicSysExTrackStream_Load,
335 IDirectMusicSysExTrackStream_Save,
336 IDirectMusicSysExTrackStream_GetSizeMax