1 /* IDirectMusicScriptTrack 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 "dmscript_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmscript
);
24 /*****************************************************************************
25 * IDirectMusicScriptTrack implementation
28 /* IDirectMusicScriptTrack IUnknown part: */
29 static HRESULT WINAPI
IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppobj
) {
30 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, UnknownVtbl
, iface
);
32 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
33 if (IsEqualIID (riid
, &IID_IUnknown
)) {
34 *ppobj
= &This
->UnknownVtbl
;
35 IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
37 } else if (IsEqualIID (riid
, &IID_IDirectMusicTrack
)
38 || IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
39 *ppobj
= (LPDIRECTMUSICTRACK8
)&This
->TrackVtbl
;
40 IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8
)&This
->TrackVtbl
);
42 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
43 *ppobj
= &This
->PersistStreamVtbl
;
44 IPersistStream_AddRef ((LPPERSISTSTREAM
)&This
->PersistStreamVtbl
);
48 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
52 static ULONG WINAPI
IDirectMusicScriptTrack_IUnknown_AddRef (LPUNKNOWN iface
) {
53 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, UnknownVtbl
, iface
);
54 ULONG ref
= InterlockedIncrement(&This
->ref
);
56 TRACE("(%p): AddRef from %d\n", This
, ref
- 1);
58 DMSCRIPT_LockModule();
63 static ULONG WINAPI
IDirectMusicScriptTrack_IUnknown_Release (LPUNKNOWN iface
) {
64 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, UnknownVtbl
, iface
);
65 ULONG ref
= InterlockedDecrement(&This
->ref
);
67 TRACE("(%p): ReleaseRef to %d\n", This
, ref
);
70 HeapFree(GetProcessHeap(), 0, This
);
73 DMSCRIPT_UnlockModule();
78 static const IUnknownVtbl DirectMusicScriptTrack_Unknown_Vtbl
= {
79 IDirectMusicScriptTrack_IUnknown_QueryInterface
,
80 IDirectMusicScriptTrack_IUnknown_AddRef
,
81 IDirectMusicScriptTrack_IUnknown_Release
84 /* IDirectMusicScriptTrack IDirectMusicTrack8 part: */
85 static HRESULT WINAPI
IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
88 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
89 return IDirectMusicScriptTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
92 static ULONG WINAPI
IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8
*iface
)
94 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
95 return IDirectMusicScriptTrack_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
98 static ULONG WINAPI
IDirectMusicTrack8Impl_Release(IDirectMusicTrack8
*iface
)
100 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
101 return IDirectMusicScriptTrack_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
104 static HRESULT WINAPI
IDirectMusicTrack8Impl_Init(IDirectMusicTrack8
*iface
,
105 IDirectMusicSegment
*pSegment
)
107 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
108 FIXME("(%p, %p): stub\n", This
, pSegment
);
112 static HRESULT WINAPI
IDirectMusicTrack8Impl_InitPlay(IDirectMusicTrack8
*iface
,
113 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
114 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
116 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
117 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
121 static HRESULT WINAPI
IDirectMusicTrack8Impl_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
123 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
124 FIXME("(%p, %p): stub\n", This
, pStateData
);
128 static HRESULT WINAPI
IDirectMusicTrack8Impl_Play(IDirectMusicTrack8
*iface
, void *pStateData
,
129 MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
,
130 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
132 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
133 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
137 static HRESULT WINAPI
IDirectMusicTrack8Impl_GetParam(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
138 MUSIC_TIME mtTime
, MUSIC_TIME
*pmtNext
, void *pParam
)
140 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
141 FIXME("(%p, %s, %d, %p, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pmtNext
, pParam
);
145 static HRESULT WINAPI
IDirectMusicTrack8Impl_SetParam(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
146 MUSIC_TIME mtTime
, void *pParam
)
148 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
149 FIXME("(%p, %s, %d, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pParam
);
153 static HRESULT WINAPI
IDirectMusicTrack8Impl_IsParamSupported(IDirectMusicTrack8
*iface
,
156 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
158 TRACE("(%p, %s)\n", This
, debugstr_dmguid(rguidType
));
159 /* didn't find any params */
160 TRACE("param unsupported\n");
161 return DMUS_E_TYPE_UNSUPPORTED
;
164 static HRESULT WINAPI
IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8
*iface
,
165 REFGUID rguidNotificationType
)
167 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
168 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
172 static HRESULT WINAPI
IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8
*iface
,
173 REFGUID rguidNotificationType
)
175 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
176 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
180 static HRESULT WINAPI
IDirectMusicTrack8Impl_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
181 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
183 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
184 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
188 static HRESULT WINAPI
IDirectMusicTrack8Impl_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
189 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
190 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
192 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
193 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
194 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
198 static HRESULT WINAPI
IDirectMusicTrack8Impl_GetParamEx(IDirectMusicTrack8
*iface
,
199 REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
*prtNext
, void *pParam
,
200 void *pStateData
, DWORD dwFlags
)
202 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
203 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
204 wine_dbgstr_longlong(rtTime
), prtNext
, pParam
, pStateData
, dwFlags
);
208 static HRESULT WINAPI
IDirectMusicTrack8Impl_SetParamEx(IDirectMusicTrack8
*iface
,
209 REFGUID rguidType
, REFERENCE_TIME rtTime
, void *pParam
, void *pStateData
, DWORD dwFlags
)
211 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
212 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
213 wine_dbgstr_longlong(rtTime
), pParam
, pStateData
, dwFlags
);
217 static HRESULT WINAPI
IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8
*iface
, IUnknown
*pContext
,
218 DWORD dwTrackGroup
, IDirectMusicTrack
**ppResultTrack
)
220 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
221 FIXME("(%p, %p, %d, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
225 static HRESULT WINAPI
IDirectMusicTrack8Impl_Join(IDirectMusicTrack8
*iface
,
226 IDirectMusicTrack
*pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
*pContext
, DWORD dwTrackGroup
,
227 IDirectMusicTrack
**ppResultTrack
)
229 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, TrackVtbl
, iface
);
230 FIXME("(%p, %p, %d, %p, %d, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
234 static const IDirectMusicTrack8Vtbl DirectMusicScriptTrack_Track_Vtbl
= {
235 IDirectMusicTrack8Impl_QueryInterface
,
236 IDirectMusicTrack8Impl_AddRef
,
237 IDirectMusicTrack8Impl_Release
,
238 IDirectMusicTrack8Impl_Init
,
239 IDirectMusicTrack8Impl_InitPlay
,
240 IDirectMusicTrack8Impl_EndPlay
,
241 IDirectMusicTrack8Impl_Play
,
242 IDirectMusicTrack8Impl_GetParam
,
243 IDirectMusicTrack8Impl_SetParam
,
244 IDirectMusicTrack8Impl_IsParamSupported
,
245 IDirectMusicTrack8Impl_AddNotificationType
,
246 IDirectMusicTrack8Impl_RemoveNotificationType
,
247 IDirectMusicTrack8Impl_Clone
,
248 IDirectMusicTrack8Impl_PlayEx
,
249 IDirectMusicTrack8Impl_GetParamEx
,
250 IDirectMusicTrack8Impl_SetParamEx
,
251 IDirectMusicTrack8Impl_Compose
,
252 IDirectMusicTrack8Impl_Join
255 /* IDirectMusicScriptTrack IPersistStream part: */
256 static HRESULT WINAPI
IPersistStreamImpl_QueryInterface(IPersistStream
*iface
, REFIID riid
,
259 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, PersistStreamVtbl
, iface
);
260 return IDirectMusicScriptTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
263 static ULONG WINAPI
IPersistStreamImpl_AddRef(IPersistStream
*iface
)
265 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, PersistStreamVtbl
, iface
);
266 return IDirectMusicScriptTrack_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
269 static ULONG WINAPI
IPersistStreamImpl_Release(IPersistStream
*iface
)
271 ICOM_THIS_MULTI(IDirectMusicScriptTrack
, PersistStreamVtbl
, iface
);
272 return IDirectMusicScriptTrack_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
275 static HRESULT WINAPI
IPersistStreamImpl_GetClassID(IPersistStream
*iface
, CLSID
*pClassID
)
280 static HRESULT WINAPI
IPersistStreamImpl_IsDirty(IPersistStream
*iface
)
285 static HRESULT WINAPI
IPersistStreamImpl_Load(IPersistStream
*iface
, IStream
*pStm
)
287 FIXME(": Loading not implemented yet\n");
291 static HRESULT WINAPI
IPersistStreamImpl_Save(IPersistStream
*iface
, IStream
*pStm
,
297 static HRESULT WINAPI
IPersistStreamImpl_GetSizeMax(IPersistStream
*iface
, ULARGE_INTEGER
*pcbSize
)
302 static const IPersistStreamVtbl DirectMusicScriptTrack_PersistStream_Vtbl
= {
303 IPersistStreamImpl_QueryInterface
,
304 IPersistStreamImpl_AddRef
,
305 IPersistStreamImpl_Release
,
306 IPersistStreamImpl_GetClassID
,
307 IPersistStreamImpl_IsDirty
,
308 IPersistStreamImpl_Load
,
309 IPersistStreamImpl_Save
,
310 IPersistStreamImpl_GetSizeMax
313 /* for ClassFactory */
314 HRESULT WINAPI
DMUSIC_CreateDirectMusicScriptTrack (LPCGUID lpcGUID
, LPVOID
*ppobj
, LPUNKNOWN pUnkOuter
) {
315 IDirectMusicScriptTrack
* track
;
317 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicScriptTrack
));
320 return E_OUTOFMEMORY
;
322 track
->UnknownVtbl
= &DirectMusicScriptTrack_Unknown_Vtbl
;
323 track
->TrackVtbl
= &DirectMusicScriptTrack_Track_Vtbl
;
324 track
->PersistStreamVtbl
= &DirectMusicScriptTrack_PersistStream_Vtbl
;
325 track
->pDesc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DMUS_OBJECTDESC
));
326 DM_STRUCT_INIT(track
->pDesc
);
327 track
->pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
328 track
->pDesc
->guidClass
= CLSID_DirectMusicScriptTrack
;
329 track
->ref
= 0; /* will be inited by QueryInterface */
331 return IDirectMusicScriptTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&track
->UnknownVtbl
, lpcGUID
, ppobj
);