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 typedef struct DirectMusicScriptTrack
{
29 IDirectMusicTrack8 IDirectMusicTrack8_iface
;
30 IPersistStream IPersistStream_iface
;
33 } DirectMusicScriptTrack
;
35 static inline DirectMusicScriptTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
37 return CONTAINING_RECORD(iface
, DirectMusicScriptTrack
, IDirectMusicTrack8_iface
);
40 static inline DirectMusicScriptTrack
*impl_from_IPersistStream(IPersistStream
*iface
)
42 return CONTAINING_RECORD(iface
, DirectMusicScriptTrack
, IPersistStream_iface
);
45 /* DirectMusicScriptTrack IDirectMusicTrack8 part: */
46 static HRESULT WINAPI
IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
49 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
51 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ret_iface
);
55 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicTrack
) ||
56 IsEqualIID(riid
, &IID_IDirectMusicTrack8
))
58 else if (IsEqualIID(riid
, &IID_IPersistStream
))
59 *ret_iface
= &This
->IPersistStream_iface
;
61 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ret_iface
);
65 IUnknown_AddRef((IUnknown
*)*ret_iface
);
69 static ULONG WINAPI
IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8
*iface
)
71 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
72 LONG ref
= InterlockedIncrement(&This
->ref
);
74 TRACE("(%p) ref=%d\n", This
, ref
);
79 static ULONG WINAPI
IDirectMusicTrack8Impl_Release(IDirectMusicTrack8
*iface
)
81 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
82 LONG ref
= InterlockedDecrement(&This
->ref
);
84 TRACE("(%p) ref=%d\n", This
, ref
);
87 HeapFree(GetProcessHeap(), 0, This
);
88 DMSCRIPT_UnlockModule();
94 static HRESULT WINAPI
IDirectMusicTrack8Impl_Init(IDirectMusicTrack8
*iface
,
95 IDirectMusicSegment
*pSegment
)
97 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
98 FIXME("(%p, %p): stub\n", This
, pSegment
);
102 static HRESULT WINAPI
IDirectMusicTrack8Impl_InitPlay(IDirectMusicTrack8
*iface
,
103 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
104 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
106 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
107 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
111 static HRESULT WINAPI
IDirectMusicTrack8Impl_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
113 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
114 FIXME("(%p, %p): stub\n", This
, pStateData
);
118 static HRESULT WINAPI
IDirectMusicTrack8Impl_Play(IDirectMusicTrack8
*iface
, void *pStateData
,
119 MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
,
120 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
122 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
123 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
127 static HRESULT WINAPI
IDirectMusicTrack8Impl_GetParam(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
128 MUSIC_TIME mtTime
, MUSIC_TIME
*pmtNext
, void *pParam
)
130 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
131 FIXME("(%p, %s, %d, %p, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pmtNext
, pParam
);
135 static HRESULT WINAPI
IDirectMusicTrack8Impl_SetParam(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
136 MUSIC_TIME mtTime
, void *pParam
)
138 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
139 FIXME("(%p, %s, %d, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pParam
);
143 static HRESULT WINAPI
IDirectMusicTrack8Impl_IsParamSupported(IDirectMusicTrack8
*iface
,
146 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
148 TRACE("(%p, %s)\n", This
, debugstr_dmguid(rguidType
));
149 /* didn't find any params */
150 TRACE("param unsupported\n");
151 return DMUS_E_TYPE_UNSUPPORTED
;
154 static HRESULT WINAPI
IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8
*iface
,
155 REFGUID rguidNotificationType
)
157 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
158 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
162 static HRESULT WINAPI
IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8
*iface
,
163 REFGUID rguidNotificationType
)
165 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
166 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
170 static HRESULT WINAPI
IDirectMusicTrack8Impl_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
171 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
173 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
174 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
178 static HRESULT WINAPI
IDirectMusicTrack8Impl_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
179 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
180 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
182 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
183 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
184 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
188 static HRESULT WINAPI
IDirectMusicTrack8Impl_GetParamEx(IDirectMusicTrack8
*iface
,
189 REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
*prtNext
, void *pParam
,
190 void *pStateData
, DWORD dwFlags
)
192 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
193 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
194 wine_dbgstr_longlong(rtTime
), prtNext
, pParam
, pStateData
, dwFlags
);
198 static HRESULT WINAPI
IDirectMusicTrack8Impl_SetParamEx(IDirectMusicTrack8
*iface
,
199 REFGUID rguidType
, REFERENCE_TIME rtTime
, void *pParam
, void *pStateData
, DWORD dwFlags
)
201 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
202 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
203 wine_dbgstr_longlong(rtTime
), pParam
, pStateData
, dwFlags
);
207 static HRESULT WINAPI
IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8
*iface
, IUnknown
*pContext
,
208 DWORD dwTrackGroup
, IDirectMusicTrack
**ppResultTrack
)
210 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
211 FIXME("(%p, %p, %d, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
215 static HRESULT WINAPI
IDirectMusicTrack8Impl_Join(IDirectMusicTrack8
*iface
,
216 IDirectMusicTrack
*pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
*pContext
, DWORD dwTrackGroup
,
217 IDirectMusicTrack
**ppResultTrack
)
219 DirectMusicScriptTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
220 FIXME("(%p, %p, %d, %p, %d, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
224 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl
= {
225 IDirectMusicTrack8Impl_QueryInterface
,
226 IDirectMusicTrack8Impl_AddRef
,
227 IDirectMusicTrack8Impl_Release
,
228 IDirectMusicTrack8Impl_Init
,
229 IDirectMusicTrack8Impl_InitPlay
,
230 IDirectMusicTrack8Impl_EndPlay
,
231 IDirectMusicTrack8Impl_Play
,
232 IDirectMusicTrack8Impl_GetParam
,
233 IDirectMusicTrack8Impl_SetParam
,
234 IDirectMusicTrack8Impl_IsParamSupported
,
235 IDirectMusicTrack8Impl_AddNotificationType
,
236 IDirectMusicTrack8Impl_RemoveNotificationType
,
237 IDirectMusicTrack8Impl_Clone
,
238 IDirectMusicTrack8Impl_PlayEx
,
239 IDirectMusicTrack8Impl_GetParamEx
,
240 IDirectMusicTrack8Impl_SetParamEx
,
241 IDirectMusicTrack8Impl_Compose
,
242 IDirectMusicTrack8Impl_Join
245 /* IDirectMusicScriptTrack IPersistStream part: */
246 static HRESULT WINAPI
IPersistStreamImpl_QueryInterface(IPersistStream
*iface
, REFIID riid
,
249 DirectMusicScriptTrack
*This
= impl_from_IPersistStream(iface
);
250 return IDirectMusicTrack8_QueryInterface(&This
->IDirectMusicTrack8_iface
, riid
, ret_iface
);
253 static ULONG WINAPI
IPersistStreamImpl_AddRef(IPersistStream
*iface
)
255 DirectMusicScriptTrack
*This
= impl_from_IPersistStream(iface
);
256 return IDirectMusicTrack8_AddRef(&This
->IDirectMusicTrack8_iface
);
259 static ULONG WINAPI
IPersistStreamImpl_Release(IPersistStream
*iface
)
261 DirectMusicScriptTrack
*This
= impl_from_IPersistStream(iface
);
262 return IDirectMusicTrack8_Release(&This
->IDirectMusicTrack8_iface
);
265 static HRESULT WINAPI
IPersistStreamImpl_GetClassID(IPersistStream
*iface
, CLSID
*pClassID
)
267 DirectMusicScriptTrack
*This
= impl_from_IPersistStream(iface
);
269 TRACE("(%p, %p)\n", This
, pClassID
);
274 *pClassID
= This
->desc
.guidClass
;
278 static HRESULT WINAPI
IPersistStreamImpl_IsDirty(IPersistStream
*iface
)
283 static HRESULT WINAPI
IPersistStreamImpl_Load(IPersistStream
*iface
, IStream
*pStm
)
285 FIXME(": Loading not implemented yet\n");
289 static HRESULT WINAPI
IPersistStreamImpl_Save(IPersistStream
*iface
, IStream
*pStm
,
295 static HRESULT WINAPI
IPersistStreamImpl_GetSizeMax(IPersistStream
*iface
, ULARGE_INTEGER
*pcbSize
)
300 static const IPersistStreamVtbl persist_vtbl
= {
301 IPersistStreamImpl_QueryInterface
,
302 IPersistStreamImpl_AddRef
,
303 IPersistStreamImpl_Release
,
304 IPersistStreamImpl_GetClassID
,
305 IPersistStreamImpl_IsDirty
,
306 IPersistStreamImpl_Load
,
307 IPersistStreamImpl_Save
,
308 IPersistStreamImpl_GetSizeMax
311 /* for ClassFactory */
312 HRESULT WINAPI
DMUSIC_CreateDirectMusicScriptTrack(REFIID riid
, void **ret_iface
,
315 DirectMusicScriptTrack
*track
;
321 return CLASS_E_NOAGGREGATION
;
323 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*track
));
325 return E_OUTOFMEMORY
;
327 track
->IDirectMusicTrack8_iface
.lpVtbl
= &dmtrack8_vtbl
;
328 track
->IPersistStream_iface
.lpVtbl
= &persist_vtbl
;
329 track
->desc
.dwSize
= sizeof(track
->desc
);
330 track
->desc
.dwValidData
= DMUS_OBJ_CLASS
;
331 track
->desc
.guidClass
= CLSID_DirectMusicScriptTrack
;
334 DMSCRIPT_LockModule();
335 hr
= IDirectMusicTrack8_QueryInterface(&track
->IDirectMusicTrack8_iface
, riid
, ret_iface
);
336 IDirectMusicTrack8_Release(&track
->IDirectMusicTrack8_iface
);