1 /* IDirectMusicSong Implementation
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "wine/debug.h"
28 #include "dmime_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
32 /* IDirectMusicSong IUnknown part: */
33 HRESULT WINAPI
IDirectMusicSongImpl_QueryInterface (LPDIRECTMUSICSONG iface
, REFIID riid
, LPVOID
*ppobj
)
35 ICOM_THIS(IDirectMusicSongImpl
,iface
);
37 if (IsEqualIID (riid
, &IID_IUnknown
) ||
38 IsEqualIID (riid
, &IID_IDirectMusicSong
)) {
39 IDirectMusicSongImpl_AddRef(iface
);
44 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
48 ULONG WINAPI
IDirectMusicSongImpl_AddRef (LPDIRECTMUSICSONG iface
)
50 ICOM_THIS(IDirectMusicSongImpl
,iface
);
51 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
55 ULONG WINAPI
IDirectMusicSongImpl_Release (LPDIRECTMUSICSONG iface
)
57 ICOM_THIS(IDirectMusicSongImpl
,iface
);
58 ULONG ref
= --This
->ref
;
59 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
61 HeapFree(GetProcessHeap(), 0, This
);
66 /* IDirectMusicSong IDirectMusicSong part: */
67 HRESULT WINAPI
IDirectMusicSongImpl_Compose (LPDIRECTMUSICSONG iface
)
69 ICOM_THIS(IDirectMusicSongImpl
,iface
);
71 FIXME("(%p): stub\n", This
);
76 HRESULT WINAPI
IDirectMusicSongImpl_GetParam (LPDIRECTMUSICSONG iface
, REFGUID rguidType
, DWORD dwGroupBits
, DWORD dwIndex
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
)
78 ICOM_THIS(IDirectMusicSongImpl
,iface
);
80 FIXME("(%p, %s, %ld, %ld, %ld, %p, %p): stub\n", This
, debugstr_guid(rguidType
), dwGroupBits
, dwIndex
, mtTime
, pmtNext
, pParam
);
85 HRESULT WINAPI
IDirectMusicSongImpl_GetSegment (LPDIRECTMUSICSONG iface
, WCHAR
* pwzName
, IDirectMusicSegment
** ppSegment
)
87 ICOM_THIS(IDirectMusicSongImpl
,iface
);
89 FIXME("(%p, %p, %p): stub\n", This
, pwzName
, ppSegment
);
94 HRESULT WINAPI
IDirectMusicSongImpl_GetAudioPathConfig (LPDIRECTMUSICSONG iface
, IUnknown
** ppAudioPathConfig
)
96 ICOM_THIS(IDirectMusicSongImpl
,iface
);
98 FIXME("(%p, %p): stub\n", This
, ppAudioPathConfig
);
103 HRESULT WINAPI
IDirectMusicSongImpl_Download (LPDIRECTMUSICSONG iface
, IUnknown
* pAudioPath
)
105 ICOM_THIS(IDirectMusicSongImpl
,iface
);
107 FIXME("(%p, %p): stub\n", This
, pAudioPath
);
112 HRESULT WINAPI
IDirectMusicSongImpl_Unload (LPDIRECTMUSICSONG iface
, IUnknown
* pAudioPath
)
114 ICOM_THIS(IDirectMusicSongImpl
,iface
);
116 FIXME("(%p, %p): stub\n", This
, pAudioPath
);
121 HRESULT WINAPI
IDirectMusicSongImpl_EnumSegment (LPDIRECTMUSICSONG iface
, DWORD dwIndex
, IDirectMusicSegment
** ppSegment
)
123 ICOM_THIS(IDirectMusicSongImpl
,iface
);
125 FIXME("(%p, %ld, %p): stub\n", This
, dwIndex
, ppSegment
);
130 ICOM_VTABLE(IDirectMusicSong
) DirectMusicSong_Vtbl
=
132 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
133 IDirectMusicSongImpl_QueryInterface
,
134 IDirectMusicSongImpl_AddRef
,
135 IDirectMusicSongImpl_Release
,
136 IDirectMusicSongImpl_Compose
,
137 IDirectMusicSongImpl_GetParam
,
138 IDirectMusicSongImpl_GetSegment
,
139 IDirectMusicSongImpl_GetAudioPathConfig
,
140 IDirectMusicSongImpl_Download
,
141 IDirectMusicSongImpl_Unload
,
142 IDirectMusicSongImpl_EnumSegment
145 /* for ClassFactory */
146 HRESULT WINAPI
DMUSIC_CreateDirectMusicSong (LPCGUID lpcGUID
, LPDIRECTMUSICSONG
*ppDMSng
, LPUNKNOWN pUnkOuter
)
148 IDirectMusicSongImpl
* dmsong
;
150 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicSong
)) {
151 dmsong
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSongImpl
));
152 if (NULL
== dmsong
) {
153 *ppDMSng
= (LPDIRECTMUSICSONG
) NULL
;
154 return E_OUTOFMEMORY
;
156 dmsong
->lpVtbl
= &DirectMusicSong_Vtbl
;
158 *ppDMSng
= (LPDIRECTMUSICSONG
) dmsong
;
161 WARN("No interface found\n");
163 return E_NOINTERFACE
;
166 /*****************************************************************************
167 * IDirectMusicSongObject implementation
169 /* IDirectMusicSongObject IUnknown part: */
170 HRESULT WINAPI
IDirectMusicSongObject_QueryInterface (LPDIRECTMUSICOBJECT iface
, REFIID riid
, LPVOID
*ppobj
)
172 ICOM_THIS(IDirectMusicSongObject
,iface
);
174 if (IsEqualIID (riid
, &IID_IUnknown
)
175 || IsEqualIID (riid
, &IID_IDirectMusicObject
)) {
176 IDirectMusicSongObject_AddRef(iface
);
179 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
180 IPersistStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
181 *ppobj
= (LPPERSISTSTREAM
)This
->pStream
;
183 } else if (IsEqualIID (riid
, &IID_IDirectMusicSong
)) {
184 IDirectMusicSong_AddRef ((LPDIRECTMUSICSONG
)This
->pSong
);
185 *ppobj
= (LPDIRECTMUSICSONG
)This
->pSong
;
188 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
189 return E_NOINTERFACE
;
192 ULONG WINAPI
IDirectMusicSongObject_AddRef (LPDIRECTMUSICOBJECT iface
)
194 ICOM_THIS(IDirectMusicSongObject
,iface
);
195 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
196 return ++(This
->ref
);
199 ULONG WINAPI
IDirectMusicSongObject_Release (LPDIRECTMUSICOBJECT iface
)
201 ICOM_THIS(IDirectMusicSongObject
,iface
);
202 ULONG ref
= --This
->ref
;
203 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
205 HeapFree(GetProcessHeap(), 0, This
);
210 /* IDirectMusicSongObject IDirectMusicObject part: */
211 HRESULT WINAPI
IDirectMusicSongObject_GetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
)
213 ICOM_THIS(IDirectMusicSongObject
,iface
);
215 TRACE("(%p, %p)\n", This
, pDesc
);
221 HRESULT WINAPI
IDirectMusicSongObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
)
223 ICOM_THIS(IDirectMusicSongObject
,iface
);
225 TRACE("(%p, %p)\n", This
, pDesc
);
231 HRESULT WINAPI
IDirectMusicSongObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface
, LPSTREAM pStream
, LPDMUS_OBJECTDESC pDesc
)
233 ICOM_THIS(IDirectMusicSongObject
,iface
);
235 FIXME("(%p, %p, %p): stub\n", This
, pStream
, pDesc
);
240 ICOM_VTABLE(IDirectMusicObject
) DirectMusicSongObject_Vtbl
=
242 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
243 IDirectMusicSongObject_QueryInterface
,
244 IDirectMusicSongObject_AddRef
,
245 IDirectMusicSongObject_Release
,
246 IDirectMusicSongObject_GetDescriptor
,
247 IDirectMusicSongObject_SetDescriptor
,
248 IDirectMusicSongObject_ParseDescriptor
251 /* for ClassFactory */
252 HRESULT WINAPI
DMUSIC_CreateDirectMusicSongObject (LPCGUID lpcGUID
, LPDIRECTMUSICOBJECT
* ppObject
, LPUNKNOWN pUnkOuter
)
254 IDirectMusicSongObject
*obj
;
256 TRACE("(%p,%p,%p)\n", lpcGUID
, ppObject
, pUnkOuter
);
257 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicObject
)) {
258 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSongObject
));
260 *ppObject
= (LPDIRECTMUSICOBJECT
) NULL
;
261 return E_OUTOFMEMORY
;
263 obj
->lpVtbl
= &DirectMusicSongObject_Vtbl
;
265 /* prepare IPersistStream */
266 obj
->pStream
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicSongObjectStream
));
267 obj
->pStream
->lpVtbl
= &DirectMusicSongObjectStream_Vtbl
;
268 obj
->pStream
->ref
= 1;
269 obj
->pStream
->pParentObject
= obj
;
270 /* prepare IDirectMusicSong */
271 DMUSIC_CreateDirectMusicSong (&IID_IDirectMusicSong
, (LPDIRECTMUSICSONG
*)&obj
->pSong
, NULL
);
272 obj
->pSong
->pObject
= obj
;
273 *ppObject
= (LPDIRECTMUSICOBJECT
) obj
;
276 WARN("No interface found\n");
278 return E_NOINTERFACE
;
281 /*****************************************************************************
282 * IDirectMusicSongObjectStream implementation
284 /* IDirectMusicSongObjectStream IUnknown part: */
285 HRESULT WINAPI
IDirectMusicSongObjectStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
)
287 ICOM_THIS(IDirectMusicSongObjectStream
,iface
);
289 if (IsEqualIID (riid
, &IID_IUnknown
)
290 || IsEqualIID (riid
, &IID_IPersistStream
)) {
291 IDirectMusicSongObjectStream_AddRef(iface
);
295 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
296 return E_NOINTERFACE
;
299 ULONG WINAPI
IDirectMusicSongObjectStream_AddRef (LPPERSISTSTREAM iface
)
301 ICOM_THIS(IDirectMusicSongObjectStream
,iface
);
302 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
303 return ++(This
->ref
);
306 ULONG WINAPI
IDirectMusicSongObjectStream_Release (LPPERSISTSTREAM iface
)
308 ICOM_THIS(IDirectMusicSongObjectStream
,iface
);
309 ULONG ref
= --This
->ref
;
310 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
312 HeapFree(GetProcessHeap(), 0, This
);
317 /* IDirectMusicSongObjectStream IPersist part: */
318 HRESULT WINAPI
IDirectMusicSongObjectStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
323 /* IDirectMusicSongObjectStream IPersistStream part: */
324 HRESULT WINAPI
IDirectMusicSongObjectStream_IsDirty (LPPERSISTSTREAM iface
)
329 HRESULT WINAPI
IDirectMusicSongObjectStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
331 FIXME(": Loading not implemented yet\n");
335 HRESULT WINAPI
IDirectMusicSongObjectStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
340 HRESULT WINAPI
IDirectMusicSongObjectStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
345 ICOM_VTABLE(IPersistStream
) DirectMusicSongObjectStream_Vtbl
=
347 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
348 IDirectMusicSongObjectStream_QueryInterface
,
349 IDirectMusicSongObjectStream_AddRef
,
350 IDirectMusicSongObjectStream_Release
,
351 IDirectMusicSongObjectStream_GetClassID
,
352 IDirectMusicSongObjectStream_IsDirty
,
353 IDirectMusicSongObjectStream_Load
,
354 IDirectMusicSongObjectStream_Save
,
355 IDirectMusicSongObjectStream_GetSizeMax