makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / dmcompos / signposttrack.c
blobd07982975c9d928d88ae7f515cdd9dd5dbf383a5
1 /* IDirectMusicSignPostTrack 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 "dmcompos_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
25 /*****************************************************************************
26 * IDirectMusicSignPostTrack implementation
28 typedef struct IDirectMusicSignPostTrack {
29 IDirectMusicTrack8 IDirectMusicTrack8_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicSignPostTrack;
34 /* IDirectMusicSignPostTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicSignPostTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicSignPostTrack, IDirectMusicTrack8_iface);
40 static HRESULT WINAPI signpost_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
45 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
47 *ret_iface = NULL;
49 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) ||
50 IsEqualIID(riid, &IID_IDirectMusicTrack8))
51 *ret_iface = iface;
52 else if (IsEqualIID(riid, &IID_IPersistStream))
53 *ret_iface = &This->dmobj.IPersistStream_iface;
54 else {
55 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
56 return E_NOINTERFACE;
59 IUnknown_AddRef((IUnknown*)*ret_iface);
60 return S_OK;
63 static ULONG WINAPI signpost_track_AddRef(IDirectMusicTrack8 *iface)
65 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
66 LONG ref = InterlockedIncrement(&This->ref);
68 TRACE("(%p) ref=%d\n", This, ref);
70 return ref;
73 static ULONG WINAPI signpost_track_Release(IDirectMusicTrack8 *iface)
75 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
76 LONG ref = InterlockedDecrement(&This->ref);
78 TRACE("(%p) ref=%d\n", This, ref);
80 if (!ref) {
81 HeapFree(GetProcessHeap(), 0, This);
82 DMCOMPOS_UnlockModule();
85 return ref;
88 static HRESULT WINAPI signpost_track_Init(IDirectMusicTrack8 *iface, IDirectMusicSegment *pSegment)
90 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI signpost_track_InitPlay(IDirectMusicTrack8 *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
100 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
101 return S_OK;
104 static HRESULT WINAPI signpost_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
106 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI signpost_track_Play(IDirectMusicTrack8 *iface, void *pStateData,
112 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
113 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
115 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
116 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
117 return S_OK;
120 static HRESULT WINAPI signpost_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type,
121 MUSIC_TIME time, MUSIC_TIME *next, void *param)
123 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
125 TRACE("(%p, %s, %d, %p, %p): method not implemented\n", This, debugstr_dmguid(type), time,
126 next, param);
127 return E_NOTIMPL;
130 static HRESULT WINAPI signpost_track_SetParam(IDirectMusicTrack8 *iface, REFGUID type,
131 MUSIC_TIME time, void *param)
133 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
135 TRACE("(%p, %s, %d, %p): method not implemented\n", This, debugstr_dmguid(type), time, param);
136 return E_NOTIMPL;
139 static HRESULT WINAPI signpost_track_IsParamSupported(IDirectMusicTrack8 *iface, REFGUID type)
141 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
143 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(type));
144 return E_NOTIMPL;
147 static HRESULT WINAPI signpost_track_AddNotificationType(IDirectMusicTrack8 *iface,
148 REFGUID rguidNotificationType)
150 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
151 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
152 return S_OK;
155 static HRESULT WINAPI signpost_track_RemoveNotificationType(IDirectMusicTrack8 *iface,
156 REFGUID rguidNotificationType)
158 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
159 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
160 return S_OK;
163 static HRESULT WINAPI signpost_track_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
164 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
166 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
167 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
168 return S_OK;
171 static HRESULT WINAPI signpost_track_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
172 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
173 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
175 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
176 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
177 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
178 return S_OK;
181 static HRESULT WINAPI signpost_track_GetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
182 REFERENCE_TIME time, REFERENCE_TIME *next, void *param, void *state, DWORD flags)
184 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
186 TRACE("(%p, %s, %s, %p, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
187 wine_dbgstr_longlong(time), next, param, state, flags);
188 return E_NOTIMPL;
191 static HRESULT WINAPI signpost_track_SetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
192 REFERENCE_TIME time, void *param, void *state, DWORD flags)
194 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
196 TRACE("(%p, %s, %s, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
197 wine_dbgstr_longlong(time), param, state, flags);
198 return E_NOTIMPL;
201 static HRESULT WINAPI signpost_track_Compose(IDirectMusicTrack8 *iface, IUnknown *pContext,
202 DWORD dwTrackGroup, IDirectMusicTrack **ppResultTrack)
204 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
205 FIXME("(%p, %p, %d, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
206 return S_OK;
209 static HRESULT WINAPI signpost_track_Join(IDirectMusicTrack8 *iface, IDirectMusicTrack *pNewTrack,
210 MUSIC_TIME mtJoin, IUnknown *pContext, DWORD dwTrackGroup,
211 IDirectMusicTrack **ppResultTrack)
213 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
214 FIXME("(%p, %p, %d, %p, %d, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
215 return S_OK;
218 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
219 signpost_track_QueryInterface,
220 signpost_track_AddRef,
221 signpost_track_Release,
222 signpost_track_Init,
223 signpost_track_InitPlay,
224 signpost_track_EndPlay,
225 signpost_track_Play,
226 signpost_track_GetParam,
227 signpost_track_SetParam,
228 signpost_track_IsParamSupported,
229 signpost_track_AddNotificationType,
230 signpost_track_RemoveNotificationType,
231 signpost_track_Clone,
232 signpost_track_PlayEx,
233 signpost_track_GetParamEx,
234 signpost_track_SetParamEx,
235 signpost_track_Compose,
236 signpost_track_Join
239 static inline IDirectMusicSignPostTrack * impl_from_IPersistStream(IPersistStream *iface)
241 return CONTAINING_RECORD(iface, IDirectMusicSignPostTrack, dmobj.IPersistStream_iface);
244 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
246 IDirectMusicSignPostTrack *This = impl_from_IPersistStream(iface);
247 FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
248 return S_OK;
251 static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
252 BOOL cleardirty)
254 IDirectMusicSignPostTrack *This = impl_from_IPersistStream(iface);
256 FIXME("(%p, %p, %d): stub\n", This, stream, cleardirty);
258 if (!stream)
259 return E_POINTER;
261 return E_NOTIMPL;
264 static const IPersistStreamVtbl persiststream_vtbl = {
265 dmobj_IPersistStream_QueryInterface,
266 dmobj_IPersistStream_AddRef,
267 dmobj_IPersistStream_Release,
268 dmobj_IPersistStream_GetClassID,
269 unimpl_IPersistStream_IsDirty,
270 IPersistStreamImpl_Load,
271 IPersistStreamImpl_Save,
272 unimpl_IPersistStream_GetSizeMax
275 /* for ClassFactory */
276 HRESULT WINAPI create_dmsignposttrack(REFIID lpcGUID, void **ppobj)
278 IDirectMusicSignPostTrack *track;
279 HRESULT hr;
281 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
282 if (!track) {
283 *ppobj = NULL;
284 return E_OUTOFMEMORY;
286 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
287 track->ref = 1;
288 dmobject_init(&track->dmobj, &CLSID_DirectMusicSignPostTrack,
289 (IUnknown *)&track->IDirectMusicTrack8_iface);
290 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
292 DMCOMPOS_LockModule();
293 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
294 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
296 return hr;