1 /* IDirectMusicMotifTrack 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 "dmstyle_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle
);
25 /*****************************************************************************
26 * IDirectMusicMotifTrack implementation
28 typedef struct IDirectMusicMotifTrack
{
29 IDirectMusicTrack8 IDirectMusicTrack8_iface
;
30 struct dmobject dmobj
; /* IPersistStream only */
32 } IDirectMusicMotifTrack
;
34 /* IDirectMusicMotifTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicMotifTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
37 return CONTAINING_RECORD(iface
, IDirectMusicMotifTrack
, IDirectMusicTrack8_iface
);
40 static HRESULT WINAPI
motif_track_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
43 IDirectMusicMotifTrack
*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
motif_track_AddRef(IDirectMusicTrack8
*iface
)
65 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
66 LONG ref
= InterlockedIncrement(&This
->ref
);
68 TRACE("(%p) ref=%d\n", This
, ref
);
73 static ULONG WINAPI
motif_track_Release(IDirectMusicTrack8
*iface
)
75 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
76 LONG ref
= InterlockedDecrement(&This
->ref
);
78 TRACE("(%p) ref=%d\n", This
, ref
);
81 HeapFree(GetProcessHeap(), 0, This
);
82 DMSTYLE_UnlockModule();
88 static HRESULT WINAPI
motif_track_Init(IDirectMusicTrack8
*iface
, IDirectMusicSegment
*pSegment
)
90 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
91 FIXME("(%p, %p): stub\n", This
, pSegment
);
95 static HRESULT WINAPI
motif_track_InitPlay(IDirectMusicTrack8
*iface
,
96 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
97 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
99 IDirectMusicMotifTrack
*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
motif_track_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
106 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
107 FIXME("(%p, %p): stub\n", This
, pStateData
);
111 static HRESULT WINAPI
motif_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 IDirectMusicMotifTrack
*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
motif_track_GetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
121 MUSIC_TIME
*next
, void *param
)
123 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
125 TRACE("(%p, %s, %d, %p, %p):\n", This
, debugstr_dmguid(type
), time
, next
, param
);
129 if (!IsEqualGUID(type
, &GUID_Valid_Start_Time
))
130 return DMUS_E_GET_UNSUPPORTED
;
132 FIXME("GUID_Valid_Start_Time not handled yet\n");
137 static HRESULT WINAPI
motif_track_SetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
140 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
142 TRACE("(%p, %s, %d, %p)\n", This
, debugstr_dmguid(type
), time
, param
);
147 if (IsEqualGUID(type
, &GUID_DisableTimeSig
)) {
148 FIXME("GUID_DisableTimeSig not handled yet\n");
150 } else if (IsEqualGUID(type
, &GUID_EnableTimeSig
)) {
151 FIXME("GUID_EnableTimeSig not handled yet\n");
153 } else if (IsEqualGUID(type
, &GUID_SeedVariations
)) {
154 FIXME("GUID_SeedVariations not handled yet\n");
158 return DMUS_E_SET_UNSUPPORTED
;
161 static HRESULT WINAPI
motif_track_IsParamSupported(IDirectMusicTrack8
*iface
, REFGUID rguidType
)
163 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
165 TRACE("(%p, %s)\n", This
, debugstr_dmguid(rguidType
));
170 if (IsEqualGUID (rguidType
, &GUID_DisableTimeSig
)
171 || IsEqualGUID (rguidType
, &GUID_EnableTimeSig
)
172 || IsEqualGUID (rguidType
, &GUID_SeedVariations
)
173 || IsEqualGUID (rguidType
, &GUID_Valid_Start_Time
)) {
174 TRACE("param supported\n");
177 TRACE("param unsupported\n");
178 return DMUS_E_TYPE_UNSUPPORTED
;
181 static HRESULT WINAPI
motif_track_AddNotificationType(IDirectMusicTrack8
*iface
,
182 REFGUID rguidNotificationType
)
184 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
185 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
189 static HRESULT WINAPI
motif_track_RemoveNotificationType(IDirectMusicTrack8
*iface
,
190 REFGUID rguidNotificationType
)
192 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
193 FIXME("(%p, %s): stub\n", This
, debugstr_dmguid(rguidNotificationType
));
197 static HRESULT WINAPI
motif_track_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
198 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
200 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
201 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
205 static HRESULT WINAPI
motif_track_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
206 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
207 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
209 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
210 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
211 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
215 static HRESULT WINAPI
motif_track_GetParamEx(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
216 REFERENCE_TIME rtTime
, REFERENCE_TIME
*prtNext
, void *pParam
, void *pStateData
,
219 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
220 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
221 wine_dbgstr_longlong(rtTime
), prtNext
, pParam
, pStateData
, dwFlags
);
225 static HRESULT WINAPI
motif_track_SetParamEx(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
226 REFERENCE_TIME rtTime
, void *pParam
, void *pStateData
, DWORD dwFlags
)
228 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
229 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
230 wine_dbgstr_longlong(rtTime
), pParam
, pStateData
, dwFlags
);
234 static HRESULT WINAPI
motif_track_Compose(IDirectMusicTrack8
*iface
, IUnknown
*context
,
235 DWORD trackgroup
, IDirectMusicTrack
**track
)
237 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
239 TRACE("(%p, %p, %d, %p): method not implemented\n", This
, context
, trackgroup
, track
);
243 static HRESULT WINAPI
motif_track_Join(IDirectMusicTrack8
*iface
, IDirectMusicTrack
*newtrack
,
244 MUSIC_TIME join
, IUnknown
*context
, DWORD trackgroup
, IDirectMusicTrack
**resulttrack
)
246 IDirectMusicMotifTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
247 TRACE("(%p, %p, %d, %p, %d, %p): stub\n", This
, newtrack
, join
, context
, trackgroup
,
252 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl
= {
253 motif_track_QueryInterface
,
257 motif_track_InitPlay
,
260 motif_track_GetParam
,
261 motif_track_SetParam
,
262 motif_track_IsParamSupported
,
263 motif_track_AddNotificationType
,
264 motif_track_RemoveNotificationType
,
267 motif_track_GetParamEx
,
268 motif_track_SetParamEx
,
273 static HRESULT WINAPI
IPersistStreamImpl_Load(IPersistStream
*iface
, IStream
*stream
)
275 FIXME(": Loading not implemented yet\n");
279 static const IPersistStreamVtbl persiststream_vtbl
= {
280 dmobj_IPersistStream_QueryInterface
,
281 dmobj_IPersistStream_AddRef
,
282 dmobj_IPersistStream_Release
,
283 dmobj_IPersistStream_GetClassID
,
284 unimpl_IPersistStream_IsDirty
,
285 IPersistStreamImpl_Load
,
286 unimpl_IPersistStream_Save
,
287 unimpl_IPersistStream_GetSizeMax
290 /* for ClassFactory */
291 HRESULT WINAPI
create_dmmotiftrack(REFIID lpcGUID
, void **ppobj
)
293 IDirectMusicMotifTrack
*track
;
296 track
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*track
));
299 return E_OUTOFMEMORY
;
301 track
->IDirectMusicTrack8_iface
.lpVtbl
= &dmtrack8_vtbl
;
303 dmobject_init(&track
->dmobj
, &CLSID_DirectMusicMotifTrack
,
304 (IUnknown
*)&track
->IDirectMusicTrack8_iface
);
305 track
->dmobj
.IPersistStream_iface
.lpVtbl
= &persiststream_vtbl
;
307 DMSTYLE_LockModule();
308 hr
= IDirectMusicTrack8_QueryInterface(&track
->IDirectMusicTrack8_iface
, lpcGUID
, ppobj
);
309 IDirectMusicTrack8_Release(&track
->IDirectMusicTrack8_iface
);