1 /* IDirectMusicSysExTrack 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"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
24 /*****************************************************************************
25 * IDirectMusicSysExTrack implementation
27 typedef struct IDirectMusicSysExTrack
{
28 IDirectMusicTrack8 IDirectMusicTrack8_iface
;
29 struct dmobject dmobj
; /* IPersistStream only */
31 } IDirectMusicSysExTrack
;
33 /* IDirectMusicSysExTrack IDirectMusicTrack8 part: */
34 static inline IDirectMusicSysExTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
36 return CONTAINING_RECORD(iface
, IDirectMusicSysExTrack
, IDirectMusicTrack8_iface
);
39 static HRESULT WINAPI
sysex_track_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
42 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
44 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ret_iface
);
48 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicTrack
) ||
49 IsEqualIID(riid
, &IID_IDirectMusicTrack8
))
51 else if (IsEqualIID(riid
, &IID_IPersistStream
))
52 *ret_iface
= &This
->dmobj
.IPersistStream_iface
;
54 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ret_iface
);
58 IUnknown_AddRef((IUnknown
*)*ret_iface
);
62 static ULONG WINAPI
sysex_track_AddRef(IDirectMusicTrack8
*iface
)
64 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
65 LONG ref
= InterlockedIncrement(&This
->ref
);
67 TRACE("(%p) ref=%ld\n", This
, ref
);
72 static ULONG WINAPI
sysex_track_Release(IDirectMusicTrack8
*iface
)
74 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
75 LONG ref
= InterlockedDecrement(&This
->ref
);
77 TRACE("(%p) ref=%ld\n", This
, ref
);
86 static HRESULT WINAPI
sysex_track_Init(IDirectMusicTrack8
*iface
, IDirectMusicSegment
*pSegment
)
88 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
89 FIXME("(%p, %p): stub\n", This
, pSegment
);
93 static HRESULT WINAPI
sysex_track_InitPlay(IDirectMusicTrack8
*iface
,
94 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
95 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
97 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
98 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
102 static HRESULT WINAPI
sysex_track_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
104 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
105 FIXME("(%p, %p): stub\n", This
, pStateData
);
109 static HRESULT WINAPI
sysex_track_Play(IDirectMusicTrack8
*iface
, void *pStateData
,
110 MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
,
111 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
113 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
114 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
118 static HRESULT WINAPI
sysex_track_GetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
119 MUSIC_TIME
*next
, void *param
)
121 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
123 TRACE("(%p, %s, %ld, %p, %p): method not implemented\n", This
, debugstr_dmguid(type
), time
,
128 static HRESULT WINAPI
sysex_track_SetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
131 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
133 TRACE("(%p, %s, %ld, %p): method not implemented\n", This
, debugstr_dmguid(type
), time
, param
);
137 static HRESULT WINAPI
sysex_track_IsParamSupported(IDirectMusicTrack8
*iface
, REFGUID type
)
139 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
141 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(type
));
145 static HRESULT WINAPI
sysex_track_AddNotificationType(IDirectMusicTrack8
*iface
, REFGUID notiftype
)
147 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
149 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
153 static HRESULT WINAPI
sysex_track_RemoveNotificationType(IDirectMusicTrack8
*iface
,
156 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
158 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
162 static HRESULT WINAPI
sysex_track_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
163 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
165 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
166 FIXME("(%p, %ld, %ld, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
170 static HRESULT WINAPI
sysex_track_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
171 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
172 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
174 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
175 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %ld, %p, %p, %ld): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
176 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
180 static HRESULT WINAPI
sysex_track_GetParamEx(IDirectMusicTrack8
*iface
, REFGUID type
,
181 REFERENCE_TIME time
, REFERENCE_TIME
*next
, void *param
, void *state
, DWORD flags
)
183 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
185 TRACE("(%p, %s, %s, %p, %p, %p, %lx): method not implemented\n", This
, debugstr_dmguid(type
),
186 wine_dbgstr_longlong(time
), next
, param
, state
, flags
);
190 static HRESULT WINAPI
sysex_track_SetParamEx(IDirectMusicTrack8
*iface
, REFGUID type
,
191 REFERENCE_TIME time
, void *param
, void *state
, DWORD flags
)
193 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
195 TRACE("(%p, %s, %s, %p, %p, %lx): method not implemented\n", This
, debugstr_dmguid(type
),
196 wine_dbgstr_longlong(time
), param
, state
, flags
);
200 static HRESULT WINAPI
sysex_track_Compose(IDirectMusicTrack8
*iface
, IUnknown
*context
,
201 DWORD trackgroup
, IDirectMusicTrack
**track
)
203 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
205 TRACE("(%p, %p, %ld, %p): method not implemented\n", This
, context
, trackgroup
, track
);
209 static HRESULT WINAPI
sysex_track_Join(IDirectMusicTrack8
*iface
, IDirectMusicTrack
*newtrack
,
210 MUSIC_TIME join
, IUnknown
*context
, DWORD trackgroup
, IDirectMusicTrack
**resulttrack
)
212 IDirectMusicSysExTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
213 TRACE("(%p, %p, %ld, %p, %ld, %p): method not implemented\n", This
, newtrack
, join
, context
,
214 trackgroup
, resulttrack
);
218 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl
= {
219 sysex_track_QueryInterface
,
223 sysex_track_InitPlay
,
226 sysex_track_GetParam
,
227 sysex_track_SetParam
,
228 sysex_track_IsParamSupported
,
229 sysex_track_AddNotificationType
,
230 sysex_track_RemoveNotificationType
,
233 sysex_track_GetParamEx
,
234 sysex_track_SetParamEx
,
239 static HRESULT WINAPI
sys_IPersistStream_Load(IPersistStream
*iface
, IStream
*stream
)
241 FIXME(": Loading not implemented yet\n");
245 static const IPersistStreamVtbl persiststream_vtbl
= {
246 dmobj_IPersistStream_QueryInterface
,
247 dmobj_IPersistStream_AddRef
,
248 dmobj_IPersistStream_Release
,
249 dmobj_IPersistStream_GetClassID
,
250 unimpl_IPersistStream_IsDirty
,
251 sys_IPersistStream_Load
,
252 unimpl_IPersistStream_Save
,
253 unimpl_IPersistStream_GetSizeMax
256 /* for ClassFactory */
257 HRESULT
create_dmsysextrack(REFIID lpcGUID
, void **ppobj
)
259 IDirectMusicSysExTrack
*track
;
263 if (!(track
= calloc(1, sizeof(*track
)))) return E_OUTOFMEMORY
;
264 track
->IDirectMusicTrack8_iface
.lpVtbl
= &dmtrack8_vtbl
;
266 dmobject_init(&track
->dmobj
, &CLSID_DirectMusicSysExTrack
,
267 (IUnknown
*)&track
->IDirectMusicTrack8_iface
);
268 track
->dmobj
.IPersistStream_iface
.lpVtbl
= &persiststream_vtbl
;
270 hr
= IDirectMusicTrack8_QueryInterface(&track
->IDirectMusicTrack8_iface
, lpcGUID
, ppobj
);
271 IDirectMusicTrack8_Release(&track
->IDirectMusicTrack8_iface
);