makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / dmime / sysextrack.c
blob81d60f2a29e2dad6d5fb6265c692e7a9233c8a43
1 /* IDirectMusicSysExTrack 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"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
25 /*****************************************************************************
26 * IDirectMusicSysExTrack implementation
28 typedef struct IDirectMusicSysExTrack {
29 IDirectMusicTrack8 IDirectMusicTrack8_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicSysExTrack;
34 /* IDirectMusicSysExTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicSysExTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicSysExTrack, IDirectMusicTrack8_iface);
40 static HRESULT WINAPI sysex_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicSysExTrack *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 sysex_track_AddRef(IDirectMusicTrack8 *iface)
65 IDirectMusicSysExTrack *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 sysex_track_Release(IDirectMusicTrack8 *iface)
75 IDirectMusicSysExTrack *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 DMIME_UnlockModule();
85 return ref;
88 static HRESULT WINAPI sysex_track_Init(IDirectMusicTrack8 *iface, IDirectMusicSegment *pSegment)
90 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI sysex_track_InitPlay(IDirectMusicTrack8 *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicSysExTrack *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 sysex_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
106 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI sysex_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 IDirectMusicSysExTrack *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 sysex_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
121 MUSIC_TIME *next, void *param)
123 IDirectMusicSysExTrack *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 sysex_track_SetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
131 void *param)
133 IDirectMusicSysExTrack *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 sysex_track_IsParamSupported(IDirectMusicTrack8 *iface, REFGUID type)
141 IDirectMusicSysExTrack *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 sysex_track_AddNotificationType(IDirectMusicTrack8 *iface, REFGUID notiftype)
149 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
151 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
152 return E_NOTIMPL;
155 static HRESULT WINAPI sysex_track_RemoveNotificationType(IDirectMusicTrack8 *iface,
156 REFGUID notiftype)
158 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
160 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
161 return E_NOTIMPL;
164 static HRESULT WINAPI sysex_track_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
165 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
167 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
168 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
169 return S_OK;
172 static HRESULT WINAPI sysex_track_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
173 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
174 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
176 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
177 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
178 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
179 return S_OK;
182 static HRESULT WINAPI sysex_track_GetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
183 REFERENCE_TIME time, REFERENCE_TIME *next, void *param, void *state, DWORD flags)
185 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
187 TRACE("(%p, %s, %s, %p, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
188 wine_dbgstr_longlong(time), next, param, state, flags);
189 return E_NOTIMPL;
192 static HRESULT WINAPI sysex_track_SetParamEx(IDirectMusicTrack8 *iface, REFGUID type,
193 REFERENCE_TIME time, void *param, void *state, DWORD flags)
195 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
197 TRACE("(%p, %s, %s, %p, %p, %x): method not implemented\n", This, debugstr_dmguid(type),
198 wine_dbgstr_longlong(time), param, state, flags);
199 return E_NOTIMPL;
202 static HRESULT WINAPI sysex_track_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
203 DWORD trackgroup, IDirectMusicTrack **track)
205 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
207 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
208 return E_NOTIMPL;
211 static HRESULT WINAPI sysex_track_Join(IDirectMusicTrack8 *iface, IDirectMusicTrack *newtrack,
212 MUSIC_TIME join, IUnknown *context, DWORD trackgroup, IDirectMusicTrack **resulttrack)
214 IDirectMusicSysExTrack *This = impl_from_IDirectMusicTrack8(iface);
215 TRACE("(%p, %p, %d, %p, %d, %p): method not implemented\n", This, newtrack, join, context,
216 trackgroup, resulttrack);
217 return E_NOTIMPL;
220 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
221 sysex_track_QueryInterface,
222 sysex_track_AddRef,
223 sysex_track_Release,
224 sysex_track_Init,
225 sysex_track_InitPlay,
226 sysex_track_EndPlay,
227 sysex_track_Play,
228 sysex_track_GetParam,
229 sysex_track_SetParam,
230 sysex_track_IsParamSupported,
231 sysex_track_AddNotificationType,
232 sysex_track_RemoveNotificationType,
233 sysex_track_Clone,
234 sysex_track_PlayEx,
235 sysex_track_GetParamEx,
236 sysex_track_SetParamEx,
237 sysex_track_Compose,
238 sysex_track_Join
241 static HRESULT WINAPI sys_IPersistStream_Load(IPersistStream *iface, IStream *stream)
243 FIXME(": Loading not implemented yet\n");
244 return S_OK;
247 static const IPersistStreamVtbl persiststream_vtbl = {
248 dmobj_IPersistStream_QueryInterface,
249 dmobj_IPersistStream_AddRef,
250 dmobj_IPersistStream_Release,
251 dmobj_IPersistStream_GetClassID,
252 unimpl_IPersistStream_IsDirty,
253 sys_IPersistStream_Load,
254 unimpl_IPersistStream_Save,
255 unimpl_IPersistStream_GetSizeMax
258 /* for ClassFactory */
259 HRESULT WINAPI create_dmsysextrack(REFIID lpcGUID, void **ppobj)
261 IDirectMusicSysExTrack *track;
262 HRESULT hr;
264 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
265 if (!track) {
266 *ppobj = NULL;
267 return E_OUTOFMEMORY;
269 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
270 track->ref = 1;
271 dmobject_init(&track->dmobj, &CLSID_DirectMusicSysExTrack,
272 (IUnknown *)&track->IDirectMusicTrack8_iface);
273 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
275 DMIME_LockModule();
276 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
277 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
279 return hr;