1 /* IDirectMusicLyricsTrack 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 * IDirectMusicLyricsTrack implementation
27 typedef struct IDirectMusicLyricsTrack
{
28 const IUnknownVtbl
*UnknownVtbl
;
29 const IDirectMusicTrack8Vtbl
*TrackVtbl
;
30 const IPersistStreamVtbl
*PersistStreamVtbl
;
32 DMUS_OBJECTDESC
*pDesc
;
33 } IDirectMusicLyricsTrack
;
35 /* IDirectMusicLyricsTrack IUnknown part: */
36 static HRESULT WINAPI
IDirectMusicLyricsTrack_IUnknown_QueryInterface (LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppobj
) {
37 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, UnknownVtbl
, iface
);
38 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
40 if (IsEqualIID (riid
, &IID_IUnknown
)) {
41 *ppobj
= &This
->UnknownVtbl
;
42 IUnknown_AddRef (iface
);
44 } else if (IsEqualIID (riid
, &IID_IDirectMusicTrack
)
45 || IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
46 *ppobj
= (LPDIRECTMUSICTRACK8
)&This
->TrackVtbl
;
47 IUnknown_AddRef (iface
);
49 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
50 *ppobj
= &This
->PersistStreamVtbl
;
51 IUnknown_AddRef (iface
);
55 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
59 static ULONG WINAPI
IDirectMusicLyricsTrack_IUnknown_AddRef (LPUNKNOWN iface
) {
60 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, UnknownVtbl
, iface
);
61 ULONG ref
= InterlockedIncrement(&This
->ref
);
63 TRACE("(%p): AddRef from %d\n", This
, ref
- 1);
70 static ULONG WINAPI
IDirectMusicLyricsTrack_IUnknown_Release (LPUNKNOWN iface
) {
71 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, UnknownVtbl
, iface
);
72 ULONG ref
= InterlockedDecrement(&This
->ref
);
73 TRACE("(%p): ReleaseRef to %d\n", This
, ref
);
76 HeapFree(GetProcessHeap(), 0, This
);
84 static const IUnknownVtbl DirectMusicLyricsTrack_Unknown_Vtbl
= {
85 IDirectMusicLyricsTrack_IUnknown_QueryInterface
,
86 IDirectMusicLyricsTrack_IUnknown_AddRef
,
87 IDirectMusicLyricsTrack_IUnknown_Release
90 /* IDirectMusicLyricsTrack IDirectMusicTrack8 part: */
91 static inline IDirectMusicLyricsTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
93 return CONTAINING_RECORD(iface
, IDirectMusicLyricsTrack
, TrackVtbl
);
96 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface
, REFIID riid
, LPVOID
*ppobj
) {
97 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
98 return IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
101 static ULONG WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface
) {
102 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
103 return IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
106 static ULONG WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface
) {
107 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
108 return IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
111 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegment
* pSegment
)
113 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
114 FIXME("(%p, %p): stub\n", This
, pSegment
);
118 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegmentState
* pSegmentState
, IDirectMusicPerformance
* pPerformance
, void** ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
120 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
121 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
125 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface
, void* pStateData
)
127 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
128 FIXME("(%p, %p): stub\n", This
, pStateData
);
132 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface
, void* pStateData
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
, IDirectMusicPerformance
* pPerf
, IDirectMusicSegmentState
* pSegSt
, DWORD dwVirtualID
)
134 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
135 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
139 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
) {
140 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
141 FIXME("(%p, %s, %d, %p, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pmtNext
, pParam
);
145 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, void* pParam
) {
146 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
147 FIXME("(%p, %s, %d, %p): stub\n", This
, debugstr_dmguid(rguidType
), mtTime
, pParam
);
151 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
) {
152 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
154 TRACE("(%p, %s)\n", This
, debugstr_dmguid(rguidType
));
155 /* didn't find any params */
156 TRACE("param unsupported\n");
157 return DMUS_E_TYPE_UNSUPPORTED
;
160 static HRESULT WINAPI
IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8
*iface
,
163 IDirectMusicLyricsTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
165 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
169 static HRESULT WINAPI
IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8
*iface
,
172 IDirectMusicLyricsTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
174 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
178 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, IDirectMusicTrack
** ppTrack
) {
179 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
180 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
184 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface
, void* pStateData
, REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
, IDirectMusicPerformance
* pPerf
, IDirectMusicSegmentState
* pSegSt
, DWORD dwVirtualID
) {
185 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
186 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
187 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
191 static HRESULT WINAPI
IDirectMusicLyricsTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
* prtNext
, void* pParam
, void* pStateData
, DWORD dwFlags
) {
192 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, 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
IDirectMusicLyricsTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, void* pParam
, void* pStateData
, DWORD dwFlags
) {
199 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, TrackVtbl
, iface
);
200 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
201 wine_dbgstr_longlong(rtTime
), pParam
, pStateData
, dwFlags
);
205 static HRESULT WINAPI
IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8
*iface
, IUnknown
*context
,
206 DWORD trackgroup
, IDirectMusicTrack
**track
)
208 IDirectMusicLyricsTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
210 TRACE("(%p, %p, %d, %p): method not implemented\n", This
, context
, trackgroup
, track
);
214 static HRESULT WINAPI
IDirectMusicTrack8Impl_Join(IDirectMusicTrack8
*iface
,
215 IDirectMusicTrack
*newtrack
, MUSIC_TIME join
, IUnknown
*context
, DWORD trackgroup
,
216 IDirectMusicTrack
**resulttrack
)
218 IDirectMusicLyricsTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
219 TRACE("(%p, %p, %d, %p, %d, %p): stub\n", This
, newtrack
, join
, context
, trackgroup
,
224 static const IDirectMusicTrack8Vtbl DirectMusicLyricsTrack_Track_Vtbl
= {
225 IDirectMusicLyricsTrack_IDirectMusicTrack_QueryInterface
,
226 IDirectMusicLyricsTrack_IDirectMusicTrack_AddRef
,
227 IDirectMusicLyricsTrack_IDirectMusicTrack_Release
,
228 IDirectMusicLyricsTrack_IDirectMusicTrack_Init
,
229 IDirectMusicLyricsTrack_IDirectMusicTrack_InitPlay
,
230 IDirectMusicLyricsTrack_IDirectMusicTrack_EndPlay
,
231 IDirectMusicLyricsTrack_IDirectMusicTrack_Play
,
232 IDirectMusicLyricsTrack_IDirectMusicTrack_GetParam
,
233 IDirectMusicLyricsTrack_IDirectMusicTrack_SetParam
,
234 IDirectMusicLyricsTrack_IDirectMusicTrack_IsParamSupported
,
235 IDirectMusicTrack8Impl_AddNotificationType
,
236 IDirectMusicTrack8Impl_RemoveNotificationType
,
237 IDirectMusicLyricsTrack_IDirectMusicTrack_Clone
,
238 IDirectMusicLyricsTrack_IDirectMusicTrack_PlayEx
,
239 IDirectMusicLyricsTrack_IDirectMusicTrack_GetParamEx
,
240 IDirectMusicLyricsTrack_IDirectMusicTrack_SetParamEx
,
241 IDirectMusicTrack8Impl_Compose
,
242 IDirectMusicTrack8Impl_Join
245 /* IDirectMusicLyricsTrack IPersistStream part: */
246 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
) {
247 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, PersistStreamVtbl
, iface
);
248 return IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
251 static ULONG WINAPI
IDirectMusicLyricsTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface
) {
252 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, PersistStreamVtbl
, iface
);
253 return IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
256 static ULONG WINAPI
IDirectMusicLyricsTrack_IPersistStream_Release (LPPERSISTSTREAM iface
) {
257 ICOM_THIS_MULTI(IDirectMusicLyricsTrack
, PersistStreamVtbl
, iface
);
258 return IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
261 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
) {
265 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface
) {
269 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
) {
270 FIXME(": Loading not implemented yet\n");
274 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
) {
278 static HRESULT WINAPI
IDirectMusicLyricsTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
) {
282 static const IPersistStreamVtbl DirectMusicLyricsTrack_PersistStream_Vtbl
= {
283 IDirectMusicLyricsTrack_IPersistStream_QueryInterface
,
284 IDirectMusicLyricsTrack_IPersistStream_AddRef
,
285 IDirectMusicLyricsTrack_IPersistStream_Release
,
286 IDirectMusicLyricsTrack_IPersistStream_GetClassID
,
287 IDirectMusicLyricsTrack_IPersistStream_IsDirty
,
288 IDirectMusicLyricsTrack_IPersistStream_Load
,
289 IDirectMusicLyricsTrack_IPersistStream_Save
,
290 IDirectMusicLyricsTrack_IPersistStream_GetSizeMax
293 /* for ClassFactory */
294 HRESULT WINAPI
create_dmlyricstrack(REFIID lpcGUID
, void **ppobj
)
296 IDirectMusicLyricsTrack
* track
;
298 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicLyricsTrack
));
301 return E_OUTOFMEMORY
;
303 track
->UnknownVtbl
= &DirectMusicLyricsTrack_Unknown_Vtbl
;
304 track
->TrackVtbl
= &DirectMusicLyricsTrack_Track_Vtbl
;
305 track
->PersistStreamVtbl
= &DirectMusicLyricsTrack_PersistStream_Vtbl
;
306 track
->pDesc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DMUS_OBJECTDESC
));
307 DM_STRUCT_INIT(track
->pDesc
);
308 track
->pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
309 memcpy (&track
->pDesc
->guidClass
, &CLSID_DirectMusicLyricsTrack
, sizeof (CLSID
));
310 track
->ref
= 0; /* will be inited by QueryInterface */
312 return IDirectMusicLyricsTrack_IUnknown_QueryInterface ((LPUNKNOWN
)&track
->UnknownVtbl
, lpcGUID
, ppobj
);