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.
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
);
42 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
46 ULONG WINAPI
IDirectMusicAudioPathImpl_AddRef (LPDIRECTMUSICAUDIOPATH iface
)
48 ICOM_THIS(IDirectMusicAudioPathImpl
,iface
);
49 TRACE("(%p) : AddRef from %ld\n", This
, 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
);
59 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
78 } else if (IsEqualIID (iidInterface
, &IID_IDirectSound3DBuffer
)) {
79 IDirectSoundBuffer8_QueryInterface (This
->pDSBuffer
, &IID_IDirectSound3DBuffer
, ppObject
);
80 TRACE("returning %p\n",*ppObject
);
88 case DMUS_PATH_PRIMARY_BUFFER
: {
89 if (IsEqualIID (iidInterface
, &IID_IDirectSound3DListener
)) {
90 IDirectSoundBuffer8_QueryInterface (This
->pPrimary
, &IID_IDirectSound3DListener
, ppObject
);
93 FIXME("bad iid...\n");
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
;
106 This
->pToolGraph
= (IDirectMusicGraph
*) pGraph
;
108 *ppObject
= (LPDIRECTMUSICGRAPH
) This
->pToolGraph
;
109 IDirectMusicGraphImpl_AddRef((LPDIRECTMUSICGRAPH
) *ppObject
);
115 case DMUS_PATH_AUDIOPATH_TOOL
:
121 case DMUS_PATH_PERFORMANCE
:
123 /* TODO check wanted GUID */
124 *ppObject
= (LPDIRECTMUSICPERFORMANCE8
) This
->pPerf
;
125 IDirectMusicPerformance8Impl_AddRef((LPDIRECTMUSICPERFORMANCE8
) *ppObject
);
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
;
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
;
149 case DMUS_PATH_PERFORMANCE_TOOL
:
158 HRESULT WINAPI
IDirectMusicAudioPathImpl_Activate (LPDIRECTMUSICAUDIOPATH iface
, BOOL fActivate
)
160 ICOM_THIS(IDirectMusicAudioPathImpl
,iface
);
162 FIXME("(%p, %d): stub\n", This
, fActivate
);
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
);
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
);
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
));
205 *ppDMCAPath
= (LPDIRECTMUSICAUDIOPATH
) NULL
;
206 return E_OUTOFMEMORY
;
208 path
->lpVtbl
= &DirectMusicAudioPath_Vtbl
;
210 *ppDMCAPath
= (LPDIRECTMUSICAUDIOPATH
) path
;
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
);
231 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
232 IPersistStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
233 *ppobj
= (LPPERSISTSTREAM
)This
->pStream
;
235 } else if (IsEqualIID (riid
, &IID_IDirectMusicAudioPath
)) {
236 IDirectMusicAudioPath_AddRef ((LPDIRECTMUSICAUDIOPATH
)This
->pAudioPath
);
237 *ppobj
= (LPDIRECTMUSICAUDIOPATH
)This
->pAudioPath
;
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
);
258 HeapFree(GetProcessHeap(), 0, This
);
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
);
274 HRESULT WINAPI
IDirectMusicAudioPathObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
)
276 ICOM_THIS(IDirectMusicAudioPathObject
,iface
);
278 TRACE("(%p, %p)\n", This
, pDesc
);
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
);
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
));
313 *ppObject
= (LPDIRECTMUSICOBJECT
) NULL
;
314 return E_OUTOFMEMORY
;
316 obj
->lpVtbl
= &DirectMusicAudioPathObject_Vtbl
;
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
;
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
);
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
);
366 HeapFree(GetProcessHeap(), 0, This
);
371 /* IDirectMusicAudioPathObjectStream IPersist part: */
372 HRESULT WINAPI
IDirectMusicAudioPathObjectStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
377 /* IDirectMusicAudioPathObjectStream IPersistStream part: */
378 HRESULT WINAPI
IDirectMusicAudioPathObjectStream_IsDirty (LPPERSISTSTREAM iface
)
383 HRESULT WINAPI
IDirectMusicAudioPathObjectStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
385 FIXME(": Loading not implemented yet\n");
389 HRESULT WINAPI
IDirectMusicAudioPathObjectStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
394 HRESULT WINAPI
IDirectMusicAudioPathObjectStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
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