1 /* IDirectMusicWaveTrack 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
);
31 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
33 /*****************************************************************************
34 * IDirectMusicWaveTrack implementation
36 /* IDirectMusicWaveTrack IUnknown part: */
37 HRESULT WINAPI
IDirectMusicWaveTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface
, REFIID riid
, LPVOID
*ppobj
)
39 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
41 if (IsEqualIID (riid
, &IID_IUnknown
) ||
42 IsEqualIID (riid
, &IID_IDirectMusicTrack
) ||
43 IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
44 IDirectMusicWaveTrack_AddRef(iface
);
47 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
48 IDirectMusicWaveTrackStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
49 *ppobj
= This
->pStream
;
53 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
57 ULONG WINAPI
IDirectMusicWaveTrack_AddRef (LPDIRECTMUSICTRACK8 iface
)
59 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
60 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
64 ULONG WINAPI
IDirectMusicWaveTrack_Release (LPDIRECTMUSICTRACK8 iface
)
66 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
67 ULONG ref
= --This
->ref
;
68 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
70 HeapFree(GetProcessHeap(), 0, This
);
75 /* IDirectMusicWaveTrack IDirectMusicTrack part: */
76 HRESULT WINAPI
IDirectMusicWaveTrack_Init (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegment
* pSegment
)
78 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
80 FIXME("(%p, %p): stub\n", This
, pSegment
);
85 HRESULT WINAPI
IDirectMusicWaveTrack_InitPlay (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegmentState
* pSegmentState
, IDirectMusicPerformance
* pPerformance
, void** ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
87 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
89 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
94 HRESULT WINAPI
IDirectMusicWaveTrack_EndPlay (LPDIRECTMUSICTRACK8 iface
, void* pStateData
)
96 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
98 FIXME("(%p, %p): stub\n", This
, pStateData
);
103 HRESULT WINAPI
IDirectMusicWaveTrack_Play (LPDIRECTMUSICTRACK8 iface
, void* pStateData
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
, IDirectMusicPerformance
* pPerf
, IDirectMusicSegmentState
* pSegSt
, DWORD dwVirtualID
)
105 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
107 FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
112 HRESULT WINAPI
IDirectMusicWaveTrack_GetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
)
114 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
116 FIXME("(%p, %s, %ld, %p, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pmtNext
, pParam
);
121 HRESULT WINAPI
IDirectMusicWaveTrack_SetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, void* pParam
)
123 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
125 FIXME("(%p, %s, %ld, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pParam
);
130 HRESULT WINAPI
IDirectMusicWaveTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
)
132 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
134 TRACE("(%p, %s): ", This
, debugstr_guid(rguidType
));
135 if (IsEqualGUID (rguidType
, &GUID_Disable_Auto_Download
)
136 || IsEqualGUID (rguidType
, &GUID_Download
)
137 || IsEqualGUID (rguidType
, &GUID_DownloadToAudioPath
)
138 || IsEqualGUID (rguidType
, &GUID_Enable_Auto_Download
)) {
139 TRACE("param supported\n");
143 TRACE("param unsupported\n");
144 return DMUS_E_TYPE_UNSUPPORTED
;
147 HRESULT WINAPI
IDirectMusicWaveTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
149 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
151 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
156 HRESULT WINAPI
IDirectMusicWaveTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
158 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
160 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
165 HRESULT WINAPI
IDirectMusicWaveTrack_Clone (LPDIRECTMUSICTRACK8 iface
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, IDirectMusicTrack
** ppTrack
)
167 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
169 FIXME("(%p, %ld, %ld, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
174 /* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
175 HRESULT WINAPI
IDirectMusicWaveTrack_PlayEx (LPDIRECTMUSICTRACK8 iface
, void* pStateData
, REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
, IDirectMusicPerformance
* pPerf
, IDirectMusicSegmentState
* pSegSt
, DWORD dwVirtualID
)
177 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
179 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This
, pStateData
, rtStart
, rtEnd
, rtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
184 HRESULT WINAPI
IDirectMusicWaveTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
* prtNext
, void* pParam
, void* pStateData
, DWORD dwFlags
)
186 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
188 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, prtNext
, pParam
, pStateData
, dwFlags
);
193 HRESULT WINAPI
IDirectMusicWaveTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, void* pParam
, void* pStateData
, DWORD dwFlags
)
195 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
197 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, pParam
, pStateData
, dwFlags
);
202 HRESULT WINAPI
IDirectMusicWaveTrack_Compose (LPDIRECTMUSICTRACK8 iface
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
204 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
206 FIXME("(%p, %p, %ld, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
211 HRESULT WINAPI
IDirectMusicWaveTrack_Join (LPDIRECTMUSICTRACK8 iface
, IDirectMusicTrack
* pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
213 ICOM_THIS(IDirectMusicWaveTrack
,iface
);
215 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
220 ICOM_VTABLE(IDirectMusicTrack8
) DirectMusicWaveTrack_Vtbl
=
222 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
223 IDirectMusicWaveTrack_QueryInterface
,
224 IDirectMusicWaveTrack_AddRef
,
225 IDirectMusicWaveTrack_Release
,
226 IDirectMusicWaveTrack_Init
,
227 IDirectMusicWaveTrack_InitPlay
,
228 IDirectMusicWaveTrack_EndPlay
,
229 IDirectMusicWaveTrack_Play
,
230 IDirectMusicWaveTrack_GetParam
,
231 IDirectMusicWaveTrack_SetParam
,
232 IDirectMusicWaveTrack_IsParamSupported
,
233 IDirectMusicWaveTrack_AddNotificationType
,
234 IDirectMusicWaveTrack_RemoveNotificationType
,
235 IDirectMusicWaveTrack_Clone
,
236 IDirectMusicWaveTrack_PlayEx
,
237 IDirectMusicWaveTrack_GetParamEx
,
238 IDirectMusicWaveTrack_SetParamEx
,
239 IDirectMusicWaveTrack_Compose
,
240 IDirectMusicWaveTrack_Join
243 /* for ClassFactory */
244 HRESULT WINAPI
DMUSIC_CreateDirectMusicWaveTrack (LPCGUID lpcGUID
, LPDIRECTMUSICTRACK8
*ppTrack
, LPUNKNOWN pUnkOuter
)
246 IDirectMusicWaveTrack
* track
;
248 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack
)
249 || IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack8
)) {
250 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicWaveTrack
));
252 *ppTrack
= (LPDIRECTMUSICTRACK8
) NULL
;
253 return E_OUTOFMEMORY
;
255 track
->lpVtbl
= &DirectMusicWaveTrack_Vtbl
;
257 track
->pStream
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicWaveTrackStream
));
258 track
->pStream
->lpVtbl
= &DirectMusicWaveTrackStream_Vtbl
;
259 track
->pStream
->ref
= 1;
260 track
->pStream
->pParentTrack
= track
;
261 *ppTrack
= (LPDIRECTMUSICTRACK8
) track
;
264 WARN("No interface found\n");
266 return E_NOINTERFACE
;
270 /*****************************************************************************
271 * IDirectMusicWaveTrackStream implementation
273 /* IDirectMusicWaveTrackStream IUnknown part follow: */
274 HRESULT WINAPI
IDirectMusicWaveTrackStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
)
276 ICOM_THIS(IDirectMusicWaveTrackStream
,iface
);
278 if (IsEqualIID (riid
, &IID_IUnknown
)
279 || IsEqualIID (riid
, &IID_IPersistStream
)) {
280 IDirectMusicWaveTrackStream_AddRef(iface
);
284 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
285 return E_NOINTERFACE
;
288 ULONG WINAPI
IDirectMusicWaveTrackStream_AddRef (LPPERSISTSTREAM iface
)
290 ICOM_THIS(IDirectMusicWaveTrackStream
,iface
);
291 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
292 return ++(This
->ref
);
295 ULONG WINAPI
IDirectMusicWaveTrackStream_Release (LPPERSISTSTREAM iface
)
297 ICOM_THIS(IDirectMusicWaveTrackStream
,iface
);
298 ULONG ref
= --This
->ref
;
299 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
301 HeapFree(GetProcessHeap(), 0, This
);
306 /* IDirectMusicWaveTrackStream IPersist part: */
307 HRESULT WINAPI
IDirectMusicWaveTrackStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
312 /* IDirectMusicWaveTrackStream IPersistStream part: */
313 HRESULT WINAPI
IDirectMusicWaveTrackStream_IsDirty (LPPERSISTSTREAM iface
)
318 HRESULT WINAPI
IDirectMusicWaveTrackStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
320 FIXME(": Loading not implemented yet\n");
324 HRESULT WINAPI
IDirectMusicWaveTrackStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
329 HRESULT WINAPI
IDirectMusicWaveTrackStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
334 ICOM_VTABLE(IPersistStream
) DirectMusicWaveTrackStream_Vtbl
=
336 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
337 IDirectMusicWaveTrackStream_QueryInterface
,
338 IDirectMusicWaveTrackStream_AddRef
,
339 IDirectMusicWaveTrackStream_Release
,
340 IDirectMusicWaveTrackStream_GetClassID
,
341 IDirectMusicWaveTrackStream_IsDirty
,
342 IDirectMusicWaveTrackStream_Load
,
343 IDirectMusicWaveTrackStream_Save
,
344 IDirectMusicWaveTrackStream_GetSizeMax