1 /* IDirectMusicWaveTrack 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"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime
);
25 /*****************************************************************************
26 * IDirectMusicWaveTrack implementation
28 /*****************************************************************************
29 * IDirectMusicChordMapTrack implementation
31 typedef struct IDirectMusicWaveTrack
{
32 IDirectMusicTrack8 IDirectMusicTrack8_iface
;
33 struct dmobject dmobj
; /* IPersistStream only */
35 } IDirectMusicWaveTrack
;
37 /* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
38 static inline IDirectMusicWaveTrack
*impl_from_IDirectMusicTrack8(IDirectMusicTrack8
*iface
)
40 return CONTAINING_RECORD(iface
, IDirectMusicWaveTrack
, IDirectMusicTrack8_iface
);
43 static HRESULT WINAPI
wave_track_QueryInterface(IDirectMusicTrack8
*iface
, REFIID riid
,
46 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
48 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ret_iface
);
52 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicTrack
) ||
53 IsEqualIID(riid
, &IID_IDirectMusicTrack8
))
55 else if (IsEqualIID(riid
, &IID_IPersistStream
))
56 *ret_iface
= &This
->dmobj
.IPersistStream_iface
;
58 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ret_iface
);
62 IUnknown_AddRef((IUnknown
*)*ret_iface
);
66 static ULONG WINAPI
wave_track_AddRef(IDirectMusicTrack8
*iface
)
68 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
69 LONG ref
= InterlockedIncrement(&This
->ref
);
71 TRACE("(%p) ref=%d\n", This
, ref
);
76 static ULONG WINAPI
wave_track_Release(IDirectMusicTrack8
*iface
)
78 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
79 LONG ref
= InterlockedDecrement(&This
->ref
);
81 TRACE("(%p) ref=%d\n", This
, ref
);
84 HeapFree(GetProcessHeap(), 0, This
);
91 static HRESULT WINAPI
wave_track_Init(IDirectMusicTrack8
*iface
, IDirectMusicSegment
*pSegment
)
93 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
94 FIXME("(%p, %p): stub\n", This
, pSegment
);
98 static HRESULT WINAPI
wave_track_InitPlay(IDirectMusicTrack8
*iface
,
99 IDirectMusicSegmentState
*pSegmentState
, IDirectMusicPerformance
*pPerformance
,
100 void **ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
102 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
103 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
107 static HRESULT WINAPI
wave_track_EndPlay(IDirectMusicTrack8
*iface
, void *pStateData
)
109 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
110 FIXME("(%p, %p): stub\n", This
, pStateData
);
114 static HRESULT WINAPI
wave_track_Play(IDirectMusicTrack8
*iface
, void *pStateData
,
115 MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, MUSIC_TIME mtOffset
, DWORD dwFlags
,
116 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
118 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
119 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This
, pStateData
, mtStart
, mtEnd
, mtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
123 static HRESULT WINAPI
wave_track_GetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
124 MUSIC_TIME
*next
, void *param
)
126 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
128 TRACE("(%p, %s, %d, %p, %p): not supported\n", This
, debugstr_dmguid(type
), time
, next
, param
);
129 return DMUS_E_GET_UNSUPPORTED
;
132 static HRESULT WINAPI
wave_track_SetParam(IDirectMusicTrack8
*iface
, REFGUID type
, MUSIC_TIME time
,
135 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
137 TRACE("(%p, %s, %d, %p)\n", This
, debugstr_dmguid(type
), time
, param
);
139 if (IsEqualGUID(type
, &GUID_Disable_Auto_Download
)) {
140 FIXME("GUID_Disable_Auto_Download not handled yet\n");
143 if (IsEqualGUID(type
, &GUID_Download
)) {
144 FIXME("GUID_Download not handled yet\n");
147 if (IsEqualGUID(type
, &GUID_DownloadToAudioPath
)) {
148 FIXME("GUID_DownloadToAudioPath not handled yet\n");
151 if (IsEqualGUID(type
, &GUID_Enable_Auto_Download
)) {
152 FIXME("GUID_Enable_Auto_Download not handled yet\n");
155 if (IsEqualGUID(type
, &GUID_Unload
)) {
156 FIXME("GUID_Unload not handled yet\n");
159 if (IsEqualGUID(type
, &GUID_UnloadFromAudioPath
)) {
160 FIXME("GUID_UnloadFromAudioPath not handled yet\n");
164 return DMUS_E_TYPE_UNSUPPORTED
;
167 static HRESULT WINAPI
wave_track_IsParamSupported(IDirectMusicTrack8
*iface
, REFGUID type
)
169 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
170 static const GUID
*valid
[] = {
171 &GUID_Disable_Auto_Download
,
173 &GUID_DownloadToAudioPath
,
174 &GUID_Enable_Auto_Download
,
176 &GUID_UnloadFromAudioPath
180 TRACE("(%p, %s)\n", This
, debugstr_dmguid(type
));
182 for (i
= 0; i
< ARRAY_SIZE(valid
); i
++)
183 if (IsEqualGUID(type
, valid
[i
]))
186 TRACE("param unsupported\n");
187 return DMUS_E_TYPE_UNSUPPORTED
;
190 static HRESULT WINAPI
wave_track_AddNotificationType(IDirectMusicTrack8
*iface
, REFGUID notiftype
)
192 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
194 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
198 static HRESULT WINAPI
wave_track_RemoveNotificationType(IDirectMusicTrack8
*iface
,
201 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
203 TRACE("(%p, %s): method not implemented\n", This
, debugstr_dmguid(notiftype
));
207 static HRESULT WINAPI
wave_track_Clone(IDirectMusicTrack8
*iface
, MUSIC_TIME mtStart
,
208 MUSIC_TIME mtEnd
, IDirectMusicTrack
**ppTrack
)
210 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
211 FIXME("(%p, %d, %d, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
215 static HRESULT WINAPI
wave_track_PlayEx(IDirectMusicTrack8
*iface
, void *pStateData
,
216 REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
,
217 IDirectMusicPerformance
*pPerf
, IDirectMusicSegmentState
*pSegSt
, DWORD dwVirtualID
)
219 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
220 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This
, pStateData
, wine_dbgstr_longlong(rtStart
),
221 wine_dbgstr_longlong(rtEnd
), wine_dbgstr_longlong(rtOffset
), dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
225 static HRESULT WINAPI
wave_track_GetParamEx(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
226 REFERENCE_TIME rtTime
, REFERENCE_TIME
*prtNext
, void *pParam
, void *pStateData
,
229 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
230 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
231 wine_dbgstr_longlong(rtTime
), prtNext
, pParam
, pStateData
, dwFlags
);
235 static HRESULT WINAPI
wave_track_SetParamEx(IDirectMusicTrack8
*iface
, REFGUID rguidType
,
236 REFERENCE_TIME rtTime
, void *pParam
, void *pStateData
, DWORD dwFlags
)
238 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
239 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This
, debugstr_dmguid(rguidType
),
240 wine_dbgstr_longlong(rtTime
), pParam
, pStateData
, dwFlags
);
244 static HRESULT WINAPI
wave_track_Compose(IDirectMusicTrack8
*iface
, IUnknown
*context
,
245 DWORD trackgroup
, IDirectMusicTrack
**track
)
247 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
249 TRACE("(%p, %p, %d, %p): method not implemented\n", This
, context
, trackgroup
, track
);
253 static HRESULT WINAPI
wave_track_Join(IDirectMusicTrack8
*iface
, IDirectMusicTrack
*newtrack
,
254 MUSIC_TIME join
, IUnknown
*context
, DWORD trackgroup
, IDirectMusicTrack
**resulttrack
)
256 IDirectMusicWaveTrack
*This
= impl_from_IDirectMusicTrack8(iface
);
257 TRACE("(%p, %p, %d, %p, %d, %p): method not implemented\n", This
, newtrack
, join
, context
,
258 trackgroup
, resulttrack
);
262 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl
= {
263 wave_track_QueryInterface
,
272 wave_track_IsParamSupported
,
273 wave_track_AddNotificationType
,
274 wave_track_RemoveNotificationType
,
277 wave_track_GetParamEx
,
278 wave_track_SetParamEx
,
283 static HRESULT WINAPI
wave_IPersistStream_Load(IPersistStream
*iface
, IStream
*stream
)
285 FIXME(": Loading not implemented yet\n");
289 static const IPersistStreamVtbl persiststream_vtbl
= {
290 dmobj_IPersistStream_QueryInterface
,
291 dmobj_IPersistStream_AddRef
,
292 dmobj_IPersistStream_Release
,
293 dmobj_IPersistStream_GetClassID
,
294 unimpl_IPersistStream_IsDirty
,
295 wave_IPersistStream_Load
,
296 unimpl_IPersistStream_Save
,
297 unimpl_IPersistStream_GetSizeMax
300 /* for ClassFactory */
301 HRESULT WINAPI
create_dmwavetrack(REFIID lpcGUID
, void **ppobj
)
303 IDirectMusicWaveTrack
*track
;
306 track
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*track
));
309 return E_OUTOFMEMORY
;
311 track
->IDirectMusicTrack8_iface
.lpVtbl
= &dmtrack8_vtbl
;
313 dmobject_init(&track
->dmobj
, &CLSID_DirectMusicWaveTrack
,
314 (IUnknown
*)&track
->IDirectMusicTrack8_iface
);
315 track
->dmobj
.IPersistStream_iface
.lpVtbl
= &persiststream_vtbl
;
318 hr
= IDirectMusicTrack8_QueryInterface(&track
->IDirectMusicTrack8_iface
, lpcGUID
, ppobj
);
319 IDirectMusicTrack8_Release(&track
->IDirectMusicTrack8_iface
);