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.
26 #include "wine/debug.h"
28 #include "dmime_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
31 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
33 /*****************************************************************************
34 * IDirectMusicSysExTrack implementation
36 /* IDirectMusicSysExTrack IUnknown part: */
37 HRESULT WINAPI
IDirectMusicSysExTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface
, REFIID riid
, LPVOID
*ppobj
)
39 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
41 if (IsEqualIID (riid
, &IID_IUnknown
) ||
42 IsEqualIID (riid
, &IID_IDirectMusicTrack
) ||
43 IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
44 IDirectMusicSysExTrack_AddRef(iface
);
47 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
48 IDirectMusicSysExTrackStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
49 *ppobj
= This
->pStream
;
52 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
56 ULONG WINAPI
IDirectMusicSysExTrack_AddRef (LPDIRECTMUSICTRACK8 iface
)
58 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
59 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
63 ULONG WINAPI
IDirectMusicSysExTrack_Release (LPDIRECTMUSICTRACK8 iface
)
65 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
66 ULONG ref
= --This
->ref
;
67 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
69 HeapFree(GetProcessHeap(), 0, This
);
74 /* IDirectMusicSysExTrack IDirectMusicTrack part: */
75 HRESULT WINAPI
IDirectMusicSysExTrack_Init (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegment
* pSegment
)
77 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
79 FIXME("(%p, %p): stub\n", This
, pSegment
);
84 HRESULT WINAPI
IDirectMusicSysExTrack_InitPlay (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegmentState
* pSegmentState
, IDirectMusicPerformance
* pPerformance
, void** ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
86 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
88 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
93 HRESULT WINAPI
IDirectMusicSysExTrack_EndPlay (LPDIRECTMUSICTRACK8 iface
, void* pStateData
)
95 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
97 FIXME("(%p, %p): stub\n", This
, pStateData
);
102 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
)
104 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
106 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
111 HRESULT WINAPI
IDirectMusicSysExTrack_GetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
)
113 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
115 FIXME("(%p, %s, %ld, %p, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pmtNext
, pParam
);
120 HRESULT WINAPI
IDirectMusicSysExTrack_SetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, void* pParam
)
122 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
124 FIXME("(%p, %s, %ld, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pParam
);
129 HRESULT WINAPI
IDirectMusicSysExTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
)
131 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
133 TRACE("(%p, %s): ", This
, debugstr_guid(rguidType
));
134 /* didn't find any params */
136 TRACE("param unsupported\n");
137 return DMUS_E_TYPE_UNSUPPORTED
;
140 HRESULT WINAPI
IDirectMusicSysExTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
142 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
144 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
149 HRESULT WINAPI
IDirectMusicSysExTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
151 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
153 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
158 HRESULT WINAPI
IDirectMusicSysExTrack_Clone (LPDIRECTMUSICTRACK8 iface
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, IDirectMusicTrack
** ppTrack
)
160 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
162 FIXME("(%p, %ld, %ld, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
167 /* IDirectMusicSysExTrack IDirectMusicTrack8 part: */
168 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
)
170 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
172 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This
, pStateData
, rtStart
, rtEnd
, rtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
177 HRESULT WINAPI
IDirectMusicSysExTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
* prtNext
, void* pParam
, void* pStateData
, DWORD dwFlags
)
179 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
181 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, prtNext
, pParam
, pStateData
, dwFlags
);
186 HRESULT WINAPI
IDirectMusicSysExTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, void* pParam
, void* pStateData
, DWORD dwFlags
)
188 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
190 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, pParam
, pStateData
, dwFlags
);
195 HRESULT WINAPI
IDirectMusicSysExTrack_Compose (LPDIRECTMUSICTRACK8 iface
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
197 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
199 FIXME("(%p, %p, %ld, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
204 HRESULT WINAPI
IDirectMusicSysExTrack_Join (LPDIRECTMUSICTRACK8 iface
, IDirectMusicTrack
* pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
206 ICOM_THIS(IDirectMusicSysExTrack
,iface
);
208 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
213 ICOM_VTABLE(IDirectMusicTrack8
) DirectMusicSysExTrack_Vtbl
=
215 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
216 IDirectMusicSysExTrack_QueryInterface
,
217 IDirectMusicSysExTrack_AddRef
,
218 IDirectMusicSysExTrack_Release
,
219 IDirectMusicSysExTrack_Init
,
220 IDirectMusicSysExTrack_InitPlay
,
221 IDirectMusicSysExTrack_EndPlay
,
222 IDirectMusicSysExTrack_Play
,
223 IDirectMusicSysExTrack_GetParam
,
224 IDirectMusicSysExTrack_SetParam
,
225 IDirectMusicSysExTrack_IsParamSupported
,
226 IDirectMusicSysExTrack_AddNotificationType
,
227 IDirectMusicSysExTrack_RemoveNotificationType
,
228 IDirectMusicSysExTrack_Clone
,
229 IDirectMusicSysExTrack_PlayEx
,
230 IDirectMusicSysExTrack_GetParamEx
,
231 IDirectMusicSysExTrack_SetParamEx
,
232 IDirectMusicSysExTrack_Compose
,
233 IDirectMusicSysExTrack_Join
236 /* for ClassFactory */
237 HRESULT WINAPI
DMUSIC_CreateDirectMusicSysExTrack (LPCGUID lpcGUID
, LPDIRECTMUSICTRACK8
*ppTrack
, LPUNKNOWN pUnkOuter
)
239 IDirectMusicSysExTrack
* track
;
241 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack
)
242 || IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack8
)) {
243 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSysExTrack
));
245 *ppTrack
= (LPDIRECTMUSICTRACK8
) NULL
;
246 return E_OUTOFMEMORY
;
248 track
->lpVtbl
= &DirectMusicSysExTrack_Vtbl
;
250 track
->pStream
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSysExTrackStream
));
251 track
->pStream
->lpVtbl
= &DirectMusicSysExTrackStream_Vtbl
;
252 track
->pStream
->ref
= 1;
253 track
->pStream
->pParentTrack
= track
;
254 *ppTrack
= (LPDIRECTMUSICTRACK8
) track
;
257 WARN("No interface found\n");
259 return E_NOINTERFACE
;
263 /*****************************************************************************
264 * IDirectMusicSysExTrackStream implementation
266 /* IDirectMusicSysExTrackStream IUnknown part follow: */
267 HRESULT WINAPI
IDirectMusicSysExTrackStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
)
269 ICOM_THIS(IDirectMusicSysExTrackStream
,iface
);
271 if (IsEqualIID (riid
, &IID_IUnknown
)
272 || IsEqualIID (riid
, &IID_IPersistStream
)) {
273 IDirectMusicSysExTrackStream_AddRef(iface
);
278 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
279 return E_NOINTERFACE
;
282 ULONG WINAPI
IDirectMusicSysExTrackStream_AddRef (LPPERSISTSTREAM iface
)
284 ICOM_THIS(IDirectMusicSysExTrackStream
,iface
);
285 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
286 return ++(This
->ref
);
289 ULONG WINAPI
IDirectMusicSysExTrackStream_Release (LPPERSISTSTREAM iface
)
291 ICOM_THIS(IDirectMusicSysExTrackStream
,iface
);
292 ULONG ref
= --This
->ref
;
293 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
295 HeapFree(GetProcessHeap(), 0, This
);
300 /* IDirectMusicSysExTrackStream IPersist part: */
301 HRESULT WINAPI
IDirectMusicSysExTrackStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
306 /* IDirectMusicSysExTrackStream IPersistStream part: */
307 HRESULT WINAPI
IDirectMusicSysExTrackStream_IsDirty (LPPERSISTSTREAM iface
)
312 HRESULT WINAPI
IDirectMusicSysExTrackStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
314 FIXME(": Loading not implemented yet\n");
318 HRESULT WINAPI
IDirectMusicSysExTrackStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
323 HRESULT WINAPI
IDirectMusicSysExTrackStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
328 ICOM_VTABLE(IPersistStream
) DirectMusicSysExTrackStream_Vtbl
=
330 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
331 IDirectMusicSysExTrackStream_QueryInterface
,
332 IDirectMusicSysExTrackStream_AddRef
,
333 IDirectMusicSysExTrackStream_Release
,
334 IDirectMusicSysExTrackStream_GetClassID
,
335 IDirectMusicSysExTrackStream_IsDirty
,
336 IDirectMusicSysExTrackStream_Load
,
337 IDirectMusicSysExTrackStream_Save
,
338 IDirectMusicSysExTrackStream_GetSizeMax