1 /* IDirectMusicMelodyFormulationTrack 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 "dmstyle_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle
);
31 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
33 /*****************************************************************************
34 * IDirectMusicMelodyFormulationTrack implementation
36 /* IDirectMusicMelodyFormulationTrack IUnknown part: */
37 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface
, REFIID riid
, LPVOID
*ppobj
)
39 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
41 if (IsEqualIID (riid
, &IID_IUnknown
) ||
42 IsEqualIID (riid
, &IID_IDirectMusicTrack
) ||
43 IsEqualIID (riid
, &IID_IDirectMusicTrack8
)) {
44 IDirectMusicMelodyFormulationTrack_AddRef(iface
);
47 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
48 IDirectMusicMelodyFormulationTrackStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
49 *ppobj
= This
->pStream
;
53 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
57 ULONG WINAPI
IDirectMusicMelodyFormulationTrack_AddRef (LPDIRECTMUSICTRACK8 iface
)
59 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
60 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
64 ULONG WINAPI
IDirectMusicMelodyFormulationTrack_Release (LPDIRECTMUSICTRACK8 iface
)
66 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
67 ULONG ref
= --This
->ref
;
68 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
70 HeapFree(GetProcessHeap(), 0, This
);
75 /* IDirectMusicMelodyFormulationTrack IDirectMusicTrack part: */
76 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_Init (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegment
* pSegment
)
78 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
80 FIXME("(%p, %p): stub\n", This
, pSegment
);
85 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_InitPlay (LPDIRECTMUSICTRACK8 iface
, IDirectMusicSegmentState
* pSegmentState
, IDirectMusicPerformance
* pPerformance
, void** ppStateData
, DWORD dwVirtualTrack8ID
, DWORD dwFlags
)
87 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
89 FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This
, pSegmentState
, pPerformance
, ppStateData
, dwVirtualTrack8ID
, dwFlags
);
94 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_EndPlay (LPDIRECTMUSICTRACK8 iface
, void* pStateData
)
96 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
98 FIXME("(%p, %p): stub\n", This
, pStateData
);
103 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_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(IDirectMusicMelodyFormulationTrack
,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
IDirectMusicMelodyFormulationTrack_GetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, MUSIC_TIME
* pmtNext
, void* pParam
)
114 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
116 FIXME("(%p, %s, %ld, %p, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pmtNext
, pParam
);
121 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_SetParam (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, MUSIC_TIME mtTime
, void* pParam
)
123 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
125 FIXME("(%p, %s, %ld, %p): stub\n", This
, debugstr_guid(rguidType
), mtTime
, pParam
);
130 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
)
132 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
134 TRACE("(%p, %s): ", This
, debugstr_guid(rguidType
));
135 if (IsEqualGUID (rguidType
, &GUID_BandParam
)
136 || IsEqualGUID (rguidType
, &GUID_Clear_All_MelodyFragments
)
137 || IsEqualGUID (rguidType
, &GUID_MelodyFragment
)) {
138 TRACE("param supported\n");
142 TRACE("param unsupported\n");
143 return DMUS_E_TYPE_UNSUPPORTED
;
146 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
148 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
150 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
155 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidNotificationType
)
157 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
159 FIXME("(%p, %s): stub\n", This
, debugstr_guid(rguidNotificationType
));
164 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_Clone (LPDIRECTMUSICTRACK8 iface
, MUSIC_TIME mtStart
, MUSIC_TIME mtEnd
, IDirectMusicTrack
** ppTrack
)
166 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
168 FIXME("(%p, %ld, %ld, %p): stub\n", This
, mtStart
, mtEnd
, ppTrack
);
173 /* IDirectMusicMelodyFormulationTrack IDirectMusicTrack8 part: */
174 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_PlayEx (LPDIRECTMUSICTRACK8 iface
, void* pStateData
, REFERENCE_TIME rtStart
, REFERENCE_TIME rtEnd
, REFERENCE_TIME rtOffset
, DWORD dwFlags
, IDirectMusicPerformance
* pPerf
, IDirectMusicSegmentState
* pSegSt
, DWORD dwVirtualID
)
176 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
178 FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This
, pStateData
, rtStart
, rtEnd
, rtOffset
, dwFlags
, pPerf
, pSegSt
, dwVirtualID
);
183 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, REFERENCE_TIME
* prtNext
, void* pParam
, void* pStateData
, DWORD dwFlags
)
185 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
187 FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, prtNext
, pParam
, pStateData
, dwFlags
);
192 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface
, REFGUID rguidType
, REFERENCE_TIME rtTime
, void* pParam
, void* pStateData
, DWORD dwFlags
)
194 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
196 FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This
, debugstr_guid(rguidType
), rtTime
, pParam
, pStateData
, dwFlags
);
201 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_Compose (LPDIRECTMUSICTRACK8 iface
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
203 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
205 FIXME("(%p, %p, %ld, %p): stub\n", This
, pContext
, dwTrackGroup
, ppResultTrack
);
210 HRESULT WINAPI
IDirectMusicMelodyFormulationTrack_Join (LPDIRECTMUSICTRACK8 iface
, IDirectMusicTrack
* pNewTrack
, MUSIC_TIME mtJoin
, IUnknown
* pContext
, DWORD dwTrackGroup
, IDirectMusicTrack
** ppResultTrack
)
212 ICOM_THIS(IDirectMusicMelodyFormulationTrack
,iface
);
214 FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This
, pNewTrack
, mtJoin
, pContext
, dwTrackGroup
, ppResultTrack
);
219 ICOM_VTABLE(IDirectMusicTrack8
) DirectMusicMelodyFormulationTrack_Vtbl
=
221 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
222 IDirectMusicMelodyFormulationTrack_QueryInterface
,
223 IDirectMusicMelodyFormulationTrack_AddRef
,
224 IDirectMusicMelodyFormulationTrack_Release
,
225 IDirectMusicMelodyFormulationTrack_Init
,
226 IDirectMusicMelodyFormulationTrack_InitPlay
,
227 IDirectMusicMelodyFormulationTrack_EndPlay
,
228 IDirectMusicMelodyFormulationTrack_Play
,
229 IDirectMusicMelodyFormulationTrack_GetParam
,
230 IDirectMusicMelodyFormulationTrack_SetParam
,
231 IDirectMusicMelodyFormulationTrack_IsParamSupported
,
232 IDirectMusicMelodyFormulationTrack_AddNotificationType
,
233 IDirectMusicMelodyFormulationTrack_RemoveNotificationType
,
234 IDirectMusicMelodyFormulationTrack_Clone
,
235 IDirectMusicMelodyFormulationTrack_PlayEx
,
236 IDirectMusicMelodyFormulationTrack_GetParamEx
,
237 IDirectMusicMelodyFormulationTrack_SetParamEx
,
238 IDirectMusicMelodyFormulationTrack_Compose
,
239 IDirectMusicMelodyFormulationTrack_Join
242 /* for ClassFactory */
243 HRESULT WINAPI
DMUSIC_CreateDirectMusicMelodyFormulationTrack (LPCGUID lpcGUID
, LPDIRECTMUSICTRACK8
*ppTrack
, LPUNKNOWN pUnkOuter
)
245 IDirectMusicMelodyFormulationTrack
* track
;
247 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack
)
248 || IsEqualIID (lpcGUID
, &IID_IDirectMusicTrack8
)) {
249 track
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicMelodyFormulationTrack
));
251 *ppTrack
= (LPDIRECTMUSICTRACK8
) NULL
;
252 return E_OUTOFMEMORY
;
254 track
->lpVtbl
= &DirectMusicMelodyFormulationTrack_Vtbl
;
256 track
->pStream
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicMelodyFormulationTrackStream
));
257 track
->pStream
->lpVtbl
= &DirectMusicMelodyFormulationTrackStream_Vtbl
;
258 track
->pStream
->ref
= 1;
259 track
->pStream
->pParentTrack
= track
;
260 *ppTrack
= (LPDIRECTMUSICTRACK8
) track
;
264 WARN("No interface found\n");
265 return E_NOINTERFACE
;
269 /*****************************************************************************
270 * IDirectMusicMelodyFormulationTrackStream implementation
272 /* IDirectMusicMelodyFormulationTrackStream IUnknown part follow: */
273 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
)
275 ICOM_THIS(IDirectMusicMelodyFormulationTrackStream
,iface
);
277 if (IsEqualIID(riid
, &IID_IUnknown
)
278 || IsEqualIID(riid
, &IID_IPersistStream
)) {
279 IDirectMusicMelodyFormulationTrackStream_AddRef(iface
);
284 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
285 return E_NOINTERFACE
;
288 ULONG WINAPI
IDirectMusicMelodyFormulationTrackStream_AddRef (LPPERSISTSTREAM iface
)
290 ICOM_THIS(IDirectMusicMelodyFormulationTrackStream
,iface
);
291 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
292 return ++(This
->ref
);
295 ULONG WINAPI
IDirectMusicMelodyFormulationTrackStream_Release (LPPERSISTSTREAM iface
)
297 ICOM_THIS(IDirectMusicMelodyFormulationTrackStream
,iface
);
298 ULONG ref
= --This
->ref
;
299 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
301 HeapFree(GetProcessHeap(), 0, This
);
306 /* IDirectMusicMelodyFormulationTrackStream IPersist part: */
307 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
312 /* IDirectMusicMelodyFormulationTrackStream IPersistStream part: */
313 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_IsDirty (LPPERSISTSTREAM iface
)
318 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
320 FIXME(": Loading not implemented yet\n");
324 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
329 HRESULT WINAPI
IDirectMusicMelodyFormulationTrackStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
334 ICOM_VTABLE(IPersistStream
) DirectMusicMelodyFormulationTrackStream_Vtbl
=
336 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
337 IDirectMusicMelodyFormulationTrackStream_QueryInterface
,
338 IDirectMusicMelodyFormulationTrackStream_AddRef
,
339 IDirectMusicMelodyFormulationTrackStream_Release
,
340 IDirectMusicMelodyFormulationTrackStream_GetClassID
,
341 IDirectMusicMelodyFormulationTrackStream_IsDirty
,
342 IDirectMusicMelodyFormulationTrackStream_Load
,
343 IDirectMusicMelodyFormulationTrackStream_Save
,
344 IDirectMusicMelodyFormulationTrackStream_GetSizeMax