cmd: Fix subdirectory prefix in for loops.
[wine.git] / dlls / dmime / wavetrack.c
blobc849f4c280f10a63db12f6e1cfdae548370f9c21
1 /* IDirectMusicWaveTrack 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 * IDirectMusicWaveTrack implementation
28 /*****************************************************************************
29 * IDirectMusicChordMapTrack implementation
31 typedef struct IDirectMusicWaveTrack {
32 IDirectMusicTrack8 IDirectMusicTrack8_iface;
33 struct dmobject dmobj; /* IPersistStream only */
34 LONG ref;
35 } IDirectMusicWaveTrack;
37 /* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
38 static inline IDirectMusicWaveTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
40 return CONTAINING_RECORD(iface, IDirectMusicWaveTrack, IDirectMusicTrack8_iface);
43 static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
44 void **ret_iface)
46 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
48 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface);
50 *ret_iface = NULL;
52 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) ||
53 IsEqualIID(riid, &IID_IDirectMusicTrack8))
54 *ret_iface = iface;
55 else if (IsEqualIID(riid, &IID_IPersistStream))
56 *ret_iface = &This->dmobj.IPersistStream_iface;
57 else {
58 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ret_iface);
63 return S_OK;
66 static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface)
68 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
69 LONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) ref=%d\n", This, ref);
73 return ref;
76 static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface)
78 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 if (!ref) {
84 HeapFree(GetProcessHeap(), 0, This);
85 DMIME_UnlockModule();
88 return ref;
91 static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface,
92 IDirectMusicSegment *pSegment)
94 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
95 FIXME("(%p, %p): stub\n", This, pSegment);
96 return S_OK;
99 static HRESULT WINAPI IDirectMusicTrack8Impl_InitPlay(IDirectMusicTrack8 *iface,
100 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
101 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
103 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
104 FIXME("(%p, %p, %p, %p, %d, %d): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
105 return S_OK;
108 static HRESULT WINAPI IDirectMusicTrack8Impl_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
110 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
111 FIXME("(%p, %p): stub\n", This, pStateData);
112 return S_OK;
115 static HRESULT WINAPI IDirectMusicTrack8Impl_Play(IDirectMusicTrack8 *iface, void *pStateData,
116 MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags,
117 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
119 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
120 FIXME("(%p, %p, %d, %d, %d, %d, %p, %p, %d): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
121 return S_OK;
124 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParam(IDirectMusicTrack8 *iface, REFGUID rguidType,
125 MUSIC_TIME mtTime, MUSIC_TIME *pmtNext, void *pParam)
127 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
128 FIXME("(%p, %s, %d, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
129 return S_OK;
132 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParam(IDirectMusicTrack8 *iface, REFGUID rguidType,
133 MUSIC_TIME mtTime, void *pParam)
135 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
136 FIXME("(%p, %s, %d, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
137 return S_OK;
140 static HRESULT WINAPI IDirectMusicTrack8Impl_IsParamSupported(IDirectMusicTrack8 *iface,
141 REFGUID rguidType)
143 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
145 TRACE("(%p, %s)\n", This, debugstr_dmguid(rguidType));
146 if (IsEqualGUID (rguidType, &GUID_Disable_Auto_Download)
147 || IsEqualGUID (rguidType, &GUID_Download)
148 || IsEqualGUID (rguidType, &GUID_DownloadToAudioPath)
149 || IsEqualGUID (rguidType, &GUID_Enable_Auto_Download)) {
150 TRACE("param supported\n");
151 return S_OK;
153 TRACE("param unsupported\n");
154 return DMUS_E_TYPE_UNSUPPORTED;
157 static HRESULT WINAPI IDirectMusicTrack8Impl_AddNotificationType(IDirectMusicTrack8 *iface,
158 REFGUID notiftype)
160 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
162 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
163 return E_NOTIMPL;
166 static HRESULT WINAPI IDirectMusicTrack8Impl_RemoveNotificationType(IDirectMusicTrack8 *iface,
167 REFGUID notiftype)
169 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
171 TRACE("(%p, %s): method not implemented\n", This, debugstr_dmguid(notiftype));
172 return E_NOTIMPL;
175 static HRESULT WINAPI IDirectMusicTrack8Impl_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
176 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
178 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
179 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
180 return S_OK;
183 static HRESULT WINAPI IDirectMusicTrack8Impl_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
184 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
185 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
187 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
188 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
189 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
190 return S_OK;
193 static HRESULT WINAPI IDirectMusicTrack8Impl_GetParamEx(IDirectMusicTrack8 *iface,
194 REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME *prtNext, void *pParam,
195 void *pStateData, DWORD dwFlags)
197 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
198 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
199 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
200 return S_OK;
203 static HRESULT WINAPI IDirectMusicTrack8Impl_SetParamEx(IDirectMusicTrack8 *iface,
204 REFGUID rguidType, REFERENCE_TIME rtTime, void *pParam, void *pStateData, DWORD dwFlags)
206 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
207 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
208 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
209 return S_OK;
212 static HRESULT WINAPI IDirectMusicTrack8Impl_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
213 DWORD trackgroup, IDirectMusicTrack **track)
215 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
217 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
218 return E_NOTIMPL;
221 static HRESULT WINAPI IDirectMusicTrack8Impl_Join(IDirectMusicTrack8 *iface,
222 IDirectMusicTrack *newtrack, MUSIC_TIME join, IUnknown *context, DWORD trackgroup,
223 IDirectMusicTrack **resulttrack)
225 IDirectMusicWaveTrack *This = impl_from_IDirectMusicTrack8(iface);
226 TRACE("(%p, %p, %d, %p, %d, %p): method not implemented\n", This, newtrack, join, context,
227 trackgroup, resulttrack);
228 return E_NOTIMPL;
231 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
232 IDirectMusicTrack8Impl_QueryInterface,
233 IDirectMusicTrack8Impl_AddRef,
234 IDirectMusicTrack8Impl_Release,
235 IDirectMusicTrack8Impl_Init,
236 IDirectMusicTrack8Impl_InitPlay,
237 IDirectMusicTrack8Impl_EndPlay,
238 IDirectMusicTrack8Impl_Play,
239 IDirectMusicTrack8Impl_GetParam,
240 IDirectMusicTrack8Impl_SetParam,
241 IDirectMusicTrack8Impl_IsParamSupported,
242 IDirectMusicTrack8Impl_AddNotificationType,
243 IDirectMusicTrack8Impl_RemoveNotificationType,
244 IDirectMusicTrack8Impl_Clone,
245 IDirectMusicTrack8Impl_PlayEx,
246 IDirectMusicTrack8Impl_GetParamEx,
247 IDirectMusicTrack8Impl_SetParamEx,
248 IDirectMusicTrack8Impl_Compose,
249 IDirectMusicTrack8Impl_Join
252 static HRESULT WINAPI wave_IPersistStream_Load(IPersistStream *iface, IStream *stream)
254 FIXME(": Loading not implemented yet\n");
255 return S_OK;
258 static const IPersistStreamVtbl persiststream_vtbl = {
259 dmobj_IPersistStream_QueryInterface,
260 dmobj_IPersistStream_AddRef,
261 dmobj_IPersistStream_Release,
262 dmobj_IPersistStream_GetClassID,
263 unimpl_IPersistStream_IsDirty,
264 wave_IPersistStream_Load,
265 unimpl_IPersistStream_Save,
266 unimpl_IPersistStream_GetSizeMax
269 /* for ClassFactory */
270 HRESULT WINAPI create_dmwavetrack(REFIID lpcGUID, void **ppobj)
272 IDirectMusicWaveTrack *track;
273 HRESULT hr;
275 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
276 if (!track) {
277 *ppobj = NULL;
278 return E_OUTOFMEMORY;
280 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
281 track->ref = 1;
282 dmobject_init(&track->dmobj, &CLSID_DirectMusicWaveTrack,
283 (IUnknown *)&track->IDirectMusicTrack8_iface);
284 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
286 DMIME_LockModule();
287 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
288 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
290 return hr;