widl: Strip last separator in append_namespaces if suffix is NULL.
[wine.git] / dlls / dmstyle / mutetrack.c
blobdeba4966a9e452a5c4f5289b0fb85e6c8081bb24
1 /* IDirectMusicMuteTrack 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 "dmstyle_private.h"
21 #include "dmobject.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
25 /*****************************************************************************
26 * IDirectMusicMuteTrack implementation
28 typedef struct IDirectMusicMuteTrack {
29 IDirectMusicTrack8 IDirectMusicTrack8_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicMuteTrack;
34 /* IDirectMusicMuteTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicMuteTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicMuteTrack, IDirectMusicTrack8_iface);
40 static HRESULT WINAPI mute_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicMuteTrack *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 mute_track_AddRef(IDirectMusicTrack8 *iface)
65 IDirectMusicMuteTrack *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 mute_track_Release(IDirectMusicTrack8 *iface)
75 IDirectMusicMuteTrack *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 DMSTYLE_UnlockModule();
85 return ref;
88 static HRESULT WINAPI mute_track_Init(IDirectMusicTrack8 *iface, IDirectMusicSegment *pSegment)
90 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI mute_track_InitPlay(IDirectMusicTrack8 *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicMuteTrack *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 mute_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
106 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI mute_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 IDirectMusicMuteTrack *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 mute_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
121 MUSIC_TIME *next, void *param)
123 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
125 TRACE("(%p, %s, %d, %p, %p):\n", This, debugstr_dmguid(type), time, next, param);
127 if (!type)
128 return E_POINTER;
129 if (!IsEqualGUID(type, &GUID_MuteParam))
130 return DMUS_E_TYPE_UNSUPPORTED;
132 FIXME("GUID_MuteParam not handled yet\n");
134 return S_OK;
137 static HRESULT WINAPI mute_track_SetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
138 void *param)
140 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
142 TRACE("(%p, %s, %d, %p)\n", This, debugstr_dmguid(type), time, param);
144 if (!type)
145 return E_POINTER;
146 if (!IsEqualGUID(type, &GUID_MuteParam))
147 return DMUS_E_TYPE_UNSUPPORTED;
149 FIXME("GUID_MuteParam not handled yet\n");
151 return S_OK;
154 static HRESULT WINAPI mute_track_IsParamSupported(IDirectMusicTrack8 *iface, REFGUID rguidType)
156 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
158 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
160 if (!rguidType)
161 return E_POINTER;
163 if (IsEqualGUID (rguidType, &GUID_MuteParam)) {
164 TRACE("param supported\n");
165 return S_OK;
167 TRACE("param unsupported\n");
168 return DMUS_E_TYPE_UNSUPPORTED;
171 static HRESULT WINAPI mute_track_AddNotificationType(IDirectMusicTrack8 *iface, REFGUID notiftype)
173 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
175 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
176 return E_NOTIMPL;
179 static HRESULT WINAPI mute_track_RemoveNotificationType(IDirectMusicTrack8 *iface,
180 REFGUID notiftype)
182 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
184 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
185 return E_NOTIMPL;
188 static HRESULT WINAPI mute_track_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
189 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
191 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
192 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
193 return S_OK;
196 static HRESULT WINAPI mute_track_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
197 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
198 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
200 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
201 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
202 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
203 return S_OK;
206 static HRESULT WINAPI mute_track_GetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
207 REFERENCE_TIME rtTime, REFERENCE_TIME *prtNext, void *pParam, void *pStateData,
208 DWORD dwFlags)
210 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
211 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
212 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
213 return S_OK;
216 static HRESULT WINAPI mute_track_SetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
217 REFERENCE_TIME rtTime, void *pParam, void *pStateData, DWORD dwFlags)
219 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
220 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
221 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
222 return S_OK;
225 static HRESULT WINAPI mute_track_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
226 DWORD trackgroup, IDirectMusicTrack **track)
228 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
230 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
231 return E_NOTIMPL;
234 static HRESULT WINAPI mute_track_Join(IDirectMusicTrack8 *iface, IDirectMusicTrack *newtrack,
235 MUSIC_TIME join, IUnknown *context, DWORD trackgroup, IDirectMusicTrack **resulttrack)
237 IDirectMusicMuteTrack *This = impl_from_IDirectMusicTrack8(iface);
238 TRACE("(%p, %p, %d, %p, %d, %p): stub\n", This, newtrack, join, context, trackgroup,
239 resulttrack);
240 return E_NOTIMPL;
243 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
244 mute_track_QueryInterface,
245 mute_track_AddRef,
246 mute_track_Release,
247 mute_track_Init,
248 mute_track_InitPlay,
249 mute_track_EndPlay,
250 mute_track_Play,
251 mute_track_GetParam,
252 mute_track_SetParam,
253 mute_track_IsParamSupported,
254 mute_track_AddNotificationType,
255 mute_track_RemoveNotificationType,
256 mute_track_Clone,
257 mute_track_PlayEx,
258 mute_track_GetParamEx,
259 mute_track_SetParamEx,
260 mute_track_Compose,
261 mute_track_Join
264 static inline IDirectMusicMuteTrack * impl_from_IPersistStream(IPersistStream *iface)
266 return CONTAINING_RECORD(iface, IDirectMusicMuteTrack, dmobj.IPersistStream_iface);
269 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
271 FIXME(": Loading not implemented yet\n");
272 return S_OK;
275 static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
276 BOOL cleardirty)
278 IDirectMusicMuteTrack *This = impl_from_IPersistStream(iface);
280 FIXME("(%p, %p, %d): stub\n", This, stream, cleardirty);
282 if (!stream)
283 return E_POINTER;
285 return E_NOTIMPL;
288 static const IPersistStreamVtbl persiststream_vtbl = {
289 dmobj_IPersistStream_QueryInterface,
290 dmobj_IPersistStream_AddRef,
291 dmobj_IPersistStream_Release,
292 dmobj_IPersistStream_GetClassID,
293 unimpl_IPersistStream_IsDirty,
294 IPersistStreamImpl_Load,
295 IPersistStreamImpl_Save,
296 unimpl_IPersistStream_GetSizeMax
299 /* for ClassFactory */
300 HRESULT WINAPI create_dmmutetrack(REFIID lpcGUID, void **ppobj)
302 IDirectMusicMuteTrack *track;
303 HRESULT hr;
305 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
306 if (!track) {
307 *ppobj = NULL;
308 return E_OUTOFMEMORY;
310 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
311 track->ref = 1;
312 dmobject_init(&track->dmobj, &CLSID_DirectMusicMuteTrack,
313 (IUnknown *)&track->IDirectMusicTrack8_iface);
314 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
316 DMSTYLE_LockModule();
317 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
318 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
320 return hr;