oleaut32/tests: Add a bunch of new tests for typelib generation.
[wine.git] / dlls / dmcompos / signposttrack.c
blob1c77e4d148411254038d9d6a1f5fbfa0c5cdc2b1
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 IDirectMusicTrack8Impl_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 IDirectMusicTrack8Impl_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 IDirectMusicTrack8Impl_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 IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface,
89 IDirectMusicSegment *pSegment)
91 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
92 FIXME("(%p, %p): stub\n", This, pSegment);
93 return S_OK;
96 static HRESULT WINAPI IDirectMusicTrack8Impl_InitPlay(IDirectMusicTrack8 *iface,
97 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
98 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
100 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
101 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
102 return S_OK;
105 static HRESULT WINAPI IDirectMusicTrack8Impl_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
107 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
108 FIXME("(%p, %p): stub\n", This, pStateData);
109 return S_OK;
112 static HRESULT WINAPI IDirectMusicTrack8Impl_Play(IDirectMusicTrack8 *iface, void *pStateData,
113 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
114 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
116 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
117 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
118 return S_OK;
121 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParam(IDirectMusicTrack8 *iface, REFGUID type,
122 MUSIC_TIME time, MUSIC_TIME *next, void *param)
124 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
126 TRACE("(%p, %s, %d, %p, %p): method not implemented\n", This, debugstr_dmguid(type), time,
127 next, param);
128 return E_NOTIMPL;
131 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParam(IDirectMusicTrack8 *iface, REFGUID type,
132 MUSIC_TIME time, void *param)
134 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
136 TRACE("(%p, %s, %d, %p): method not implemented\n", This, debugstr_dmguid(type), time, param);
137 return E_NOTIMPL;
140 static HRESULT WINAPI IDirectMusicTrack8Impl_IsParamSupported(IDirectMusicTrack8 *iface,
141 REFGUID type)
143 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
145 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(type));
146 return E_NOTIMPL;
149 static HRESULT WINAPI IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8 *iface,
150 REFGUID rguidNotificationType)
152 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
153 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
154 return S_OK;
157 static HRESULT WINAPI IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8 *iface,
158 REFGUID rguidNotificationType)
160 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
161 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
162 return S_OK;
165 static HRESULT WINAPI IDirectMusicTrack8Impl_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
166 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
168 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
169 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
170 return S_OK;
173 static HRESULT WINAPI IDirectMusicTrack8Impl_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
174 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
175 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
177 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
178 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
179 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
180 return S_OK;
183 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
184 REFERENCE_TIME time, REFERENCE_TIME *next, void *param, void *state, DWORD flags)
186 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
188 TRACE("(%p, %s, %s, %p, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
189 wine_dbgstr_longlong(time), next, param, state, flags);
190 return E_NOTIMPL;
193 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
194 REFERENCE_TIME time, void *param, void *state, DWORD flags)
196 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
198 TRACE("(%p, %s, %s, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
199 wine_dbgstr_longlong(time), param, state, flags);
200 return E_NOTIMPL;
203 static HRESULT WINAPI IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8 *iface, IUnknown *pContext,
204 DWORD dwTrackGroup, IDirectMusicTrack **ppResultTrack)
206 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
207 FIXME("(%p, %p, %d, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
208 return S_OK;
211 static HRESULT WINAPI IDirectMusicTrack8Impl_Join(IDirectMusicTrack8 *iface,
212 IDirectMusicTrack *pNewTrack, MUSIC_TIME mtJoin, IUnknown *pContext, DWORD dwTrackGroup,
213 IDirectMusicTrack **ppResultTrack)
215 IDirectMusicSignPostTrack *This = impl_from_IDirectMusicTrack8(iface);
216 FIXME("(%p, %p, %d, %p, %d, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
217 return S_OK;
220 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
221 IDirectMusicTrack8Impl_QueryInterface,
222 IDirectMusicTrack8Impl_AddRef,
223 IDirectMusicTrack8Impl_Release,
224 IDirectMusicTrack8Impl_Init,
225 IDirectMusicTrack8Impl_InitPlay,
226 IDirectMusicTrack8Impl_EndPlay,
227 IDirectMusicTrack8Impl_Play,
228 IDirectMusicTrack8Impl_GetParam,
229 IDirectMusicTrack8Impl_SetParam,
230 IDirectMusicTrack8Impl_IsParamSupported,
231 IDirectMusicTrack8Impl_AddNotificationType,
232 IDirectMusicTrack8Impl_RemoveNotificationType,
233 IDirectMusicTrack8Impl_Clone,
234 IDirectMusicTrack8Impl_PlayEx,
235 IDirectMusicTrack8Impl_GetParamEx,
236 IDirectMusicTrack8Impl_SetParamEx,
237 IDirectMusicTrack8Impl_Compose,
238 IDirectMusicTrack8Impl_Join
241 static inline IDirectMusicSignPostTrack * impl_from_IPersistStream(IPersistStream *iface)
243 return CONTAINING_RECORD(iface, IDirectMusicSignPostTrack, dmobj.IPersistStream_iface);
246 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
248 IDirectMusicSignPostTrack *This = impl_from_IPersistStream(iface);
249 FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
250 return S_OK;
253 static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
254 BOOL cleardirty)
256 IDirectMusicSignPostTrack *This = impl_from_IPersistStream(iface);
258 FIXME("(%p, %p, %d): stub\n", This, stream, cleardirty);
260 if (!stream)
261 return E_POINTER;
263 return E_NOTIMPL;
266 static const IPersistStreamVtbl persiststream_vtbl = {
267 dmobj_IPersistStream_QueryInterface,
268 dmobj_IPersistStream_AddRef,
269 dmobj_IPersistStream_Release,
270 dmobj_IPersistStream_GetClassID,
271 unimpl_IPersistStream_IsDirty,
272 IPersistStreamImpl_Load,
273 IPersistStreamImpl_Save,
274 unimpl_IPersistStream_GetSizeMax
277 /* for ClassFactory */
278 HRESULT WINAPI create_dmsignposttrack(REFIID lpcGUID, void **ppobj)
280 IDirectMusicSignPostTrack *track;
281 HRESULT hr;
283 track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
284 if (!track) {
285 *ppobj = NULL;
286 return E_OUTOFMEMORY;
288 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
289 track->ref = 1;
290 dmobject_init(&track->dmobj, &CLSID_DirectMusicSignPostTrack,
291 (IUnknown *)&track->IDirectMusicTrack8_iface);
292 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
294 DMCOMPOS_LockModule();
295 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
296 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
298 return hr;