Removed non-standard header includes.
[wine/multimedia.git] / dlls / dmime / audiopath.c
blobc7356b37b5e52930a3eab237469bda9c9847bce6
1 /* IDirectMusicAudioPath Implementation
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "windef.h"
21 #include "winbase.h"
22 #include "winuser.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
26 #include "dmime_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
30 /* IDirectMusicAudioPath IUnknown part: */
31 HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface (LPDIRECTMUSICAUDIOPATH iface, REFIID riid, LPVOID *ppobj)
33 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
35 if (IsEqualIID (riid, &IID_IUnknown) ||
36 IsEqualIID (riid, &IID_IDirectMusicAudioPath)) {
37 IDirectMusicAudioPathImpl_AddRef(iface);
38 *ppobj = This;
39 return S_OK;
42 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
43 return E_NOINTERFACE;
46 ULONG WINAPI IDirectMusicAudioPathImpl_AddRef (LPDIRECTMUSICAUDIOPATH iface)
48 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
49 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50 return ++(This->ref);
53 ULONG WINAPI IDirectMusicAudioPathImpl_Release (LPDIRECTMUSICAUDIOPATH iface)
55 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
56 ULONG ref = --This->ref;
57 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58 if (ref == 0) {
59 HeapFree(GetProcessHeap(), 0, This);
61 return ref;
64 /* IDirectMusicAudioPath IDirectMusicAudioPath part: */
65 HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject)
67 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
69 FIXME("(%p, %ld, %ld, %ld, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_guid(guidObject), dwIndex, debugstr_guid(iidInterface), ppObject);
71 switch (dwStage) {
72 case DMUS_PATH_BUFFER:
74 if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) {
75 IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject);
76 TRACE("returning %p\n",*ppObject);
77 return S_OK;
78 } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) {
79 IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject);
80 TRACE("returning %p\n",*ppObject);
81 return S_OK;
82 } else {
83 FIXME("Bad iid\n");
86 break;
88 case DMUS_PATH_PRIMARY_BUFFER: {
89 if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) {
90 IDirectSoundBuffer8_QueryInterface (This->pPrimary, &IID_IDirectSound3DListener, ppObject);
91 return S_OK;
92 } else {
93 FIXME("bad iid...\n");
96 break;
98 case DMUS_PATH_AUDIOPATH_GRAPH:
100 if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) {
101 if (NULL == This->pToolGraph) {
102 IDirectMusicGraphImpl* pGraph;
103 pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
104 pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
105 pGraph->ref = 1;
106 This->pToolGraph = (IDirectMusicGraph*) pGraph;
108 *ppObject = (LPDIRECTMUSICGRAPH) This->pToolGraph;
109 IDirectMusicGraphImpl_AddRef((LPDIRECTMUSICGRAPH) *ppObject);
110 return S_OK;
113 break;
115 case DMUS_PATH_AUDIOPATH_TOOL:
117 /* TODO */
119 break;
121 case DMUS_PATH_PERFORMANCE:
123 /* TODO check wanted GUID */
124 *ppObject = (LPDIRECTMUSICPERFORMANCE8) This->pPerf;
125 IDirectMusicPerformance8Impl_AddRef((LPDIRECTMUSICPERFORMANCE8) *ppObject);
126 return S_OK;
128 break;
130 case DMUS_PATH_PERFORMANCE_GRAPH:
132 IDirectMusicGraph* pPerfoGraph = NULL;
133 IDirectMusicPerformance8Impl_GetGraph((LPDIRECTMUSICPERFORMANCE8) This->pPerf, &pPerfoGraph);
134 if (NULL == pPerfoGraph) {
135 IDirectMusicGraphImpl* pGraph = NULL;
136 pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
137 pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
138 pGraph->ref = 1;
139 IDirectMusicPerformance8Impl_SetGraph((LPDIRECTMUSICPERFORMANCE8) This->pPerf, (IDirectMusicGraph*) pGraph);
140 /* we need release as SetGraph do an AddRef */
141 IDirectMusicGraphImpl_Release((LPDIRECTMUSICGRAPH) pGraph);
142 pPerfoGraph = (LPDIRECTMUSICGRAPH) pGraph;
144 *ppObject = (LPDIRECTMUSICGRAPH) pPerfoGraph;
145 return S_OK;
147 break;
149 case DMUS_PATH_PERFORMANCE_TOOL:
150 default:
151 break;
154 *ppObject = NULL;
155 return E_INVALIDARG;
158 HRESULT WINAPI IDirectMusicAudioPathImpl_Activate (LPDIRECTMUSICAUDIOPATH iface, BOOL fActivate)
160 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
162 FIXME("(%p, %d): stub\n", This, fActivate);
164 return S_OK;
167 HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume (LPDIRECTMUSICAUDIOPATH iface, long lVolume, DWORD dwDuration)
169 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
171 FIXME("(%p, %li, %ld): stub\n", This, lVolume, dwDuration);
173 return S_OK;
176 HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannelIn, DWORD* pdwPChannelOut)
178 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
180 FIXME("(%p, %ld, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
182 return S_OK;
185 ICOM_VTABLE(IDirectMusicAudioPath) DirectMusicAudioPath_Vtbl =
187 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
188 IDirectMusicAudioPathImpl_QueryInterface,
189 IDirectMusicAudioPathImpl_AddRef,
190 IDirectMusicAudioPathImpl_Release,
191 IDirectMusicAudioPathImpl_GetObjectInPath,
192 IDirectMusicAudioPathImpl_Activate,
193 IDirectMusicAudioPathImpl_SetVolume,
194 IDirectMusicAudioPathImpl_ConvertPChannel
197 /* for ClassFactory */
198 HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPath (LPCGUID lpcGUID, LPDIRECTMUSICAUDIOPATH* ppDMCAPath, LPUNKNOWN pUnkOuter)
200 IDirectMusicAudioPathImpl* path;
202 if (IsEqualIID (lpcGUID, &IID_IDirectMusicAudioPath)) {
203 path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl));
204 if (NULL == path) {
205 *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) NULL;
206 return E_OUTOFMEMORY;
208 path->lpVtbl = &DirectMusicAudioPath_Vtbl;
209 path->ref = 1;
210 *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) path;
211 return S_OK;
214 WARN("No interface found\n");
215 return E_NOINTERFACE;
218 /*****************************************************************************
219 * IDirectMusicAudioPathObject implementation
221 /* IDirectMusicAudioPathObject IUnknown part: */
222 HRESULT WINAPI IDirectMusicAudioPathObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
224 ICOM_THIS(IDirectMusicAudioPathObject,iface);
226 if (IsEqualIID (riid, &IID_IUnknown)
227 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
228 IDirectMusicAudioPathObject_AddRef(iface);
229 *ppobj = This;
230 return S_OK;
231 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
232 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
233 *ppobj = (LPPERSISTSTREAM)This->pStream;
234 return S_OK;
235 } else if (IsEqualIID (riid, &IID_IDirectMusicAudioPath)) {
236 IDirectMusicAudioPath_AddRef ((LPDIRECTMUSICAUDIOPATH)This->pAudioPath);
237 *ppobj = (LPDIRECTMUSICAUDIOPATH)This->pAudioPath;
238 return S_OK;
241 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
242 return E_NOINTERFACE;
245 ULONG WINAPI IDirectMusicAudioPathObject_AddRef (LPDIRECTMUSICOBJECT iface)
247 ICOM_THIS(IDirectMusicAudioPathObject,iface);
248 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
249 return ++(This->ref);
252 ULONG WINAPI IDirectMusicAudioPathObject_Release (LPDIRECTMUSICOBJECT iface)
254 ICOM_THIS(IDirectMusicAudioPathObject,iface);
255 ULONG ref = --This->ref;
256 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
257 if (ref == 0) {
258 HeapFree(GetProcessHeap(), 0, This);
260 return ref;
263 /* IDirectMusicAudioPathObject IDirectMusicObject part: */
264 HRESULT WINAPI IDirectMusicAudioPathObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
266 ICOM_THIS(IDirectMusicAudioPathObject,iface);
268 TRACE("(%p, %p)\n", This, pDesc);
269 pDesc = This->pDesc;
271 return S_OK;
274 HRESULT WINAPI IDirectMusicAudioPathObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
276 ICOM_THIS(IDirectMusicAudioPathObject,iface);
278 TRACE("(%p, %p)\n", This, pDesc);
279 This->pDesc = pDesc;
281 return S_OK;
284 HRESULT WINAPI IDirectMusicAudioPathObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
286 ICOM_THIS(IDirectMusicAudioPathObject,iface);
288 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
290 return S_OK;
293 ICOM_VTABLE(IDirectMusicObject) DirectMusicAudioPathObject_Vtbl =
295 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
296 IDirectMusicAudioPathObject_QueryInterface,
297 IDirectMusicAudioPathObject_AddRef,
298 IDirectMusicAudioPathObject_Release,
299 IDirectMusicAudioPathObject_GetDescriptor,
300 IDirectMusicAudioPathObject_SetDescriptor,
301 IDirectMusicAudioPathObject_ParseDescriptor
304 /* for ClassFactory */
305 HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
307 IDirectMusicAudioPathObject *obj;
309 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
310 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
311 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObject));
312 if (NULL == obj) {
313 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
314 return E_OUTOFMEMORY;
316 obj->lpVtbl = &DirectMusicAudioPathObject_Vtbl;
317 obj->ref = 1;
318 /* prepare IPersistStream */
319 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObjectStream));
320 obj->pStream->lpVtbl = &DirectMusicAudioPathObjectStream_Vtbl;
321 obj->pStream->ref = 1;
322 obj->pStream->pParentObject = obj;
323 /* prepare IDirectMusicAudioPath */
324 DMUSIC_CreateDirectMusicAudioPath (&IID_IDirectMusicAudioPath, (LPDIRECTMUSICAUDIOPATH*)&obj->pAudioPath, NULL);
325 obj->pAudioPath->pObject = obj;
326 *ppObject = (LPDIRECTMUSICOBJECT) obj;
327 return S_OK;
329 WARN("No interface found\n");
331 return E_NOINTERFACE;
334 /*****************************************************************************
335 * IDirectMusicAudioPathObjectStream implementation
337 /* IDirectMusicAudioPathObjectStream IUnknown part: */
338 HRESULT WINAPI IDirectMusicAudioPathObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
340 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
342 if (IsEqualIID (riid, &IID_IUnknown)
343 || IsEqualIID (riid, &IID_IPersistStream)) {
344 IDirectMusicAudioPathObjectStream_AddRef(iface);
345 *ppobj = This;
346 return S_OK;
349 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
350 return E_NOINTERFACE;
353 ULONG WINAPI IDirectMusicAudioPathObjectStream_AddRef (LPPERSISTSTREAM iface)
355 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
356 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
357 return ++(This->ref);
360 ULONG WINAPI IDirectMusicAudioPathObjectStream_Release (LPPERSISTSTREAM iface)
362 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
363 ULONG ref = --This->ref;
364 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
365 if (ref == 0) {
366 HeapFree(GetProcessHeap(), 0, This);
368 return ref;
371 /* IDirectMusicAudioPathObjectStream IPersist part: */
372 HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
374 return E_NOTIMPL;
377 /* IDirectMusicAudioPathObjectStream IPersistStream part: */
378 HRESULT WINAPI IDirectMusicAudioPathObjectStream_IsDirty (LPPERSISTSTREAM iface)
380 return E_NOTIMPL;
383 HRESULT WINAPI IDirectMusicAudioPathObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
385 FIXME(": Loading not implemented yet\n");
386 return S_OK;
389 HRESULT WINAPI IDirectMusicAudioPathObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
391 return E_NOTIMPL;
394 HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
396 return E_NOTIMPL;
399 ICOM_VTABLE(IPersistStream) DirectMusicAudioPathObjectStream_Vtbl =
401 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
402 IDirectMusicAudioPathObjectStream_QueryInterface,
403 IDirectMusicAudioPathObjectStream_AddRef,
404 IDirectMusicAudioPathObjectStream_Release,
405 IDirectMusicAudioPathObjectStream_GetClassID,
406 IDirectMusicAudioPathObjectStream_IsDirty,
407 IDirectMusicAudioPathObjectStream_Load,
408 IDirectMusicAudioPathObjectStream_Save,
409 IDirectMusicAudioPathObjectStream_GetSizeMax