1 /* IDirectMusicSeqTrack 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"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
25 /*****************************************************************************
26 * IDirectMusicSeqTrack implementation
28 typedef struct IDirectMusicSeqTrack
{
29 IDirectMusicTrack8 IDirectMusicTrack8_iface
;
30 struct dmobject dmobj
; /* IPersistStream only */
32 } IDirectMusicSeqTrack
;
34 /* IDirectMusicSeqTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicSeqTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
37 return CONTAINING_RECORD(iface
, IDirectMusicSeqTrack
, IDirectMusicTrack8_iface
);
40 static HRESULT WINAPI
sequence_track_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
43 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
45 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ret_iface
);
49 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicTrack
) ||
50 IsEqualIID(riid
, &IID_IDirectMusicTrack8
))
52 else if (IsEqualIID(riid
, &IID_IPersistStream
))
53 *ret_iface
= &This
->dmobj
.IPersistStream_iface
;
55 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ret_iface
);
59 IUnknown_AddRef((IUnknown
*)*ret_iface
);
63 static ULONG WINAPI
sequence_track_AddRef(IDirectMusicTrack8
*iface
)
65 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
66 LONG ref
= InterlockedIncrement(&This
->ref
);
68 TRACE("(%p) ref=%d\n", This
, ref
);
73 static ULONG WINAPI
sequence_track_Release(IDirectMusicTrack8
*iface
)
75 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
76 LONG ref
= InterlockedDecrement(&This
->ref
);
78 TRACE("(%p) ref=%d\n", This
, ref
);
81 HeapFree(GetProcessHeap(), 0, This
);
88 static HRESULT WINAPI
sequence_track_Init(IDirectMusicTrack8
*iface
, IDirectMusicSegment
*pSegment
)
90 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
91 FIXME("(%p, %p): stub\n", This
, pSegment
);
95 static HRESULT WINAPI
sequence_track_InitPlay(IDirectMusicTrack8
*iface
,
96 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
97 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
99 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
100 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
104 static HRESULT WINAPI
sequence_track_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
106 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
107 FIXME("(%p, %p): stub\n", This
, pStateData
);
111 static HRESULT WINAPI
sequence_track_Play(IDirectMusicTrack8
*iface
, void *pStateData
,
112 MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
,
113 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
115 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
116 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
120 static HRESULT WINAPI
sequence_track_GetParam(IDirectMusicTrack8
*iface
, REFGUID type
,
121 MUSIC_TIME time
, MUSIC_TIME
*next
, void *param
)
123 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
125 TRACE("(%p, %s, %d, %p, %p): method not implemented\n", This
, debugstr_dmguid(type
), time
,
130 static HRESULT WINAPI
sequence_track_SetParam(IDirectMusicTrack8
*iface
, REFGUID type
,
131 MUSIC_TIME time
, void *param
)
133 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
135 TRACE("(%p, %s, %d, %p): method not implemented\n", This
, debugstr_dmguid(type
), time
, param
);
139 static HRESULT WINAPI
sequence_track_IsParamSupported(IDirectMusicTrack8
*iface
, REFGUID type
)
141 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
143 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(type
));
147 static HRESULT WINAPI
sequence_track_AddNotificationType(IDirectMusicTrack8
*iface
,
150 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
152 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
156 static HRESULT WINAPI
sequence_track_RemoveNotificationType(IDirectMusicTrack8
*iface
,
159 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
161 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
165 static HRESULT WINAPI
sequence_track_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
166 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
168 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
169 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
173 static HRESULT WINAPI
sequence_track_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
174 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
175 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
177 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
178 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
179 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
183 static HRESULT WINAPI
sequence_track_GetParamEx(IDirectMusicTrack8
*iface
, REFGUID type
,
184 REFERENCE_TIME time
, REFERENCE_TIME
*next
, void *param
, void *state
, DWORD flags
)
186 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
188 TRACE("(%p, %s, %s, %p, %p, %p, %x): method not implemented\n", This
, debugstr_dmguid(type
),
189 wine_dbgstr_longlong(time
), next
, param
, state
, flags
);
193 static HRESULT WINAPI
sequence_track_SetParamEx(IDirectMusicTrack8
*iface
, REFGUID type
,
194 REFERENCE_TIME time
, void *param
, void *state
, DWORD flags
)
196 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
198 TRACE("(%p, %s, %s, %p, %p, %x): method not implemented\n", This
, debugstr_dmguid(type
),
199 wine_dbgstr_longlong(time
), param
, state
, flags
);
203 static HRESULT WINAPI
sequence_track_Compose(IDirectMusicTrack8
*iface
, IUnknown
*context
,
204 DWORD trackgroup
, IDirectMusicTrack
**track
)
206 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
208 TRACE("(%p, %p, %d, %p): method not implemented\n", This
, context
, trackgroup
, track
);
212 static HRESULT WINAPI
sequence_track_Join(IDirectMusicTrack8
*iface
, IDirectMusicTrack
*newtrack
,
213 MUSIC_TIME join
, IUnknown
*context
, DWORD trackgroup
, IDirectMusicTrack
**resulttrack
)
215 IDirectMusicSeqTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
216 TRACE("(%p, %p, %d, %p, %d, %p): method not implemented\n", This
, newtrack
, join
, context
,
217 trackgroup
, resulttrack
);
221 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl
= {
222 sequence_track_QueryInterface
,
223 sequence_track_AddRef
,
224 sequence_track_Release
,
226 sequence_track_InitPlay
,
227 sequence_track_EndPlay
,
229 sequence_track_GetParam
,
230 sequence_track_SetParam
,
231 sequence_track_IsParamSupported
,
232 sequence_track_AddNotificationType
,
233 sequence_track_RemoveNotificationType
,
234 sequence_track_Clone
,
235 sequence_track_PlayEx
,
236 sequence_track_GetParamEx
,
237 sequence_track_SetParamEx
,
238 sequence_track_Compose
,
242 static HRESULT WINAPI
track_IPersistStream_Load(IPersistStream
*iface
, IStream
*stream
)
244 FIXME(": Loading not implemented yet\n");
248 static const IPersistStreamVtbl persiststream_vtbl
= {
249 dmobj_IPersistStream_QueryInterface
,
250 dmobj_IPersistStream_AddRef
,
251 dmobj_IPersistStream_Release
,
252 dmobj_IPersistStream_GetClassID
,
253 unimpl_IPersistStream_IsDirty
,
254 track_IPersistStream_Load
,
255 unimpl_IPersistStream_Save
,
256 unimpl_IPersistStream_GetSizeMax
259 /* for ClassFactory */
260 HRESULT WINAPI
create_dmseqtrack(REFIID lpcGUID
, void **ppobj
)
262 IDirectMusicSeqTrack
*track
;
265 track
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*track
));
268 return E_OUTOFMEMORY
;
270 track
->IDirectMusicTrack8_iface
.lpVtbl
= &dmtrack8_vtbl
;
272 dmobject_init(&track
->dmobj
, &CLSID_DirectMusicSeqTrack
,
273 (IUnknown
*)&track
->IDirectMusicTrack8_iface
);
274 track
->dmobj
.IPersistStream_iface
.lpVtbl
= &persiststream_vtbl
;
277 hr
= IDirectMusicTrack8_QueryInterface(&track
->IDirectMusicTrack8_iface
, lpcGUID
, ppobj
);
278 IDirectMusicTrack8_Release(&track
->IDirectMusicTrack8_iface
);