makefiles: Install PE files in an architecture-specific directory.
[wine.git] / dlls / dmstyle / auditiontrack.c
blobececce9728ff98bd8d936add8ae17474c038489d
1 /* IDirectMusicAuditionTrack 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 * IDirectMusicAuditionTrack implementation
28 typedef struct IDirectMusicAuditionTrack {
29 IDirectMusicTrack8 IDirectMusicTrack8_iface;
30 struct dmobject dmobj; /* IPersistStream only */
31 LONG ref;
32 } IDirectMusicAuditionTrack;
34 /* IDirectMusicAuditionTrack IDirectMusicTrack8 part: */
35 static inline IDirectMusicAuditionTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface)
37 return CONTAINING_RECORD(iface, IDirectMusicAuditionTrack, IDirectMusicTrack8_iface);
40 static HRESULT WINAPI audition_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicAuditionTrack *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 audition_track_AddRef(IDirectMusicTrack8 *iface)
65 IDirectMusicAuditionTrack *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 audition_track_Release(IDirectMusicTrack8 *iface)
75 IDirectMusicAuditionTrack *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 audition_track_Init(IDirectMusicTrack8 *iface, IDirectMusicSegment *pSegment)
90 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
91 FIXME("(%p, %p): stub\n", This, pSegment);
92 return S_OK;
95 static HRESULT WINAPI audition_track_InitPlay(IDirectMusicTrack8 *iface,
96 IDirectMusicSegmentState *pSegmentState, IDirectMusicPerformance *pPerformance,
97 void **ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
99 IDirectMusicAuditionTrack *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 audition_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData)
106 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
107 FIXME("(%p, %p): stub\n", This, pStateData);
108 return S_OK;
111 static HRESULT WINAPI audition_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 IDirectMusicAuditionTrack *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 audition_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type,
121 MUSIC_TIME time, MUSIC_TIME *next, void *param)
123 IDirectMusicAuditionTrack *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;
130 if (IsEqualGUID(type, &GUID_Valid_Start_Time)) {
131 FIXME("GUID_Valid_Start_Time not handled yet\n");
132 return S_OK;
133 } else if (IsEqualGUID(type, &GUID_Variations)) {
134 FIXME("GUID_Variations not handled yet\n");
135 return S_OK;
138 return DMUS_E_GET_UNSUPPORTED;
141 static HRESULT WINAPI audition_track_SetParam(IDirectMusicTrack8 *iface, REFGUID type,
142 MUSIC_TIME time, void *param)
144 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
146 TRACE("(%p, %s, %d, %p)\n", This, debugstr_dmguid(type), time, param);
148 if (!type)
149 return E_POINTER;
151 if (IsEqualGUID(type, &GUID_DisableTimeSig)) {
152 FIXME("GUID_DisableTimeSig not handled yet\n");
153 return S_OK;
154 } else if (IsEqualGUID(type, &GUID_EnableTimeSig)) {
155 FIXME("GUID_EnableTimeSig not handled yet\n");
156 return S_OK;
157 } else if (IsEqualGUID(type, &GUID_SeedVariations)) {
158 FIXME("GUID_SeedVariations not handled yet\n");
159 return S_OK;
162 return DMUS_E_SET_UNSUPPORTED;
165 static HRESULT WINAPI audition_track_IsParamSupported(IDirectMusicTrack8 *iface, REFGUID type)
167 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
168 static const GUID *valid[] = {
169 &GUID_DisableTimeSig,
170 &GUID_EnableTimeSig,
171 &GUID_SeedVariations,
172 &GUID_Valid_Start_Time,
173 &GUID_Variations
175 unsigned int i;
178 TRACE("(%p, %s)\n", This, debugstr_dmguid(type));
180 if (!type)
181 return E_POINTER;
183 for (i = 0; i < ARRAY_SIZE(valid); i++)
184 if (IsEqualGUID(type, valid[i]))
185 return S_OK;
187 TRACE("param unsupported\n");
188 return DMUS_E_TYPE_UNSUPPORTED;
191 static HRESULT WINAPI audition_track_AddNotificationType(IDirectMusicTrack8 *iface,
192 REFGUID rguidNotificationType)
194 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
195 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
196 return S_OK;
199 static HRESULT WINAPI audition_track_RemoveNotificationType(IDirectMusicTrack8 *iface,
200 REFGUID rguidNotificationType)
202 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
203 FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
204 return S_OK;
207 static HRESULT WINAPI audition_track_Clone(IDirectMusicTrack8 *iface, MUSIC_TIME mtStart,
208 MUSIC_TIME mtEnd, IDirectMusicTrack **ppTrack)
210 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
211 FIXME("(%p, %d, %d, %p): stub\n", This, mtStart, mtEnd, ppTrack);
212 return S_OK;
215 static HRESULT WINAPI audition_track_PlayEx(IDirectMusicTrack8 *iface, void *pStateData,
216 REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags,
217 IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualID)
219 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
220 FIXME("(%p, %p, 0x%s, 0x%s, 0x%s, %d, %p, %p, %d): stub\n", This, pStateData, wine_dbgstr_longlong(rtStart),
221 wine_dbgstr_longlong(rtEnd), wine_dbgstr_longlong(rtOffset), dwFlags, pPerf, pSegSt, dwVirtualID);
222 return S_OK;
225 static HRESULT WINAPI audition_track_GetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
226 REFERENCE_TIME rtTime, REFERENCE_TIME *prtNext, void *pParam, void *pStateData,
227 DWORD dwFlags)
229 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
230 FIXME("(%p, %s, 0x%s, %p, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
231 wine_dbgstr_longlong(rtTime), prtNext, pParam, pStateData, dwFlags);
232 return S_OK;
235 static HRESULT WINAPI audition_track_SetParamEx(IDirectMusicTrack8 *iface, REFGUID rguidType,
236 REFERENCE_TIME rtTime, void *pParam, void *pStateData, DWORD dwFlags)
238 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
239 FIXME("(%p, %s, 0x%s, %p, %p, %d): stub\n", This, debugstr_dmguid(rguidType),
240 wine_dbgstr_longlong(rtTime), pParam, pStateData, dwFlags);
241 return S_OK;
244 static HRESULT WINAPI audition_track_Compose(IDirectMusicTrack8 *iface, IUnknown *context,
245 DWORD trackgroup, IDirectMusicTrack **track)
247 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
249 TRACE("(%p, %p, %d, %p): method not implemented\n", This, context, trackgroup, track);
250 return E_NOTIMPL;
253 static HRESULT WINAPI audition_track_Join(IDirectMusicTrack8 *iface, IDirectMusicTrack *newtrack,
254 MUSIC_TIME join, IUnknown *context, DWORD trackgroup, IDirectMusicTrack **resulttrack)
256 IDirectMusicAuditionTrack *This = impl_from_IDirectMusicTrack8(iface);
257 TRACE("(%p, %p, %d, %p, %d, %p): stub\n", This, newtrack, join, context, trackgroup,
258 resulttrack);
259 return E_NOTIMPL;
262 static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
263 audition_track_QueryInterface,
264 audition_track_AddRef,
265 audition_track_Release,
266 audition_track_Init,
267 audition_track_InitPlay,
268 audition_track_EndPlay,
269 audition_track_Play,
270 audition_track_GetParam,
271 audition_track_SetParam,
272 audition_track_IsParamSupported,
273 audition_track_AddNotificationType,
274 audition_track_RemoveNotificationType,
275 audition_track_Clone,
276 audition_track_PlayEx,
277 audition_track_GetParamEx,
278 audition_track_SetParamEx,
279 audition_track_Compose,
280 audition_track_Join
283 static inline IDirectMusicAuditionTrack * impl_from_IPersistStream(IPersistStream *iface)
285 return CONTAINING_RECORD(iface, IDirectMusicAuditionTrack, dmobj.IPersistStream_iface);
288 static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
290 FIXME(": Loading not implemented yet\n");
291 return S_OK;
294 static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
295 BOOL cleardirty)
297 IDirectMusicAuditionTrack *This = impl_from_IPersistStream(iface);
299 FIXME("(%p, %p, %d): stub\n", This, stream, cleardirty);
301 if (!stream)
302 return E_POINTER;
304 return E_NOTIMPL;
307 static const IPersistStreamVtbl persiststream_vtbl = {
308 dmobj_IPersistStream_QueryInterface,
309 dmobj_IPersistStream_AddRef,
310 dmobj_IPersistStream_Release,
311 dmobj_IPersistStream_GetClassID,
312 unimpl_IPersistStream_IsDirty,
313 IPersistStreamImpl_Load,
314 IPersistStreamImpl_Save,
315 unimpl_IPersistStream_GetSizeMax
318 /* for ClassFactory */
319 HRESULT WINAPI create_dmauditiontrack(REFIID lpcGUID, void **ppobj)
321 IDirectMusicAuditionTrack *track;
322 HRESULT hr;
324 track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
325 if (!track) {
326 *ppobj = NULL;
327 return E_OUTOFMEMORY;
329 track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
330 track->ref = 1;
331 dmobject_init(&track->dmobj, &CLSID_DirectMusicAuditionTrack,
332 (IUnknown *)&track->IDirectMusicTrack8_iface);
333 track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
335 DMSTYLE_LockModule();
336 hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
337 IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface);
339 return hr;