Fix French translation.
[wine/multimedia.git] / dlls / dmime / audiopath.c
blobe6f1decde4f5e999276992ee601e2c408d85c4c1
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 <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
28 #include "dmime_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
32 /* IDirectMusicAudioPath IUnknown part: */
33 HRESULT WINAPI IDirectMusicAudioPathImpl_QueryInterface (LPDIRECTMUSICAUDIOPATH iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
37 if (IsEqualIID (riid, &IID_IUnknown) ||
38 IsEqualIID (riid, &IID_IDirectMusicAudioPath)) {
39 IDirectMusicAudioPathImpl_AddRef(iface);
40 *ppobj = This;
41 return S_OK;
44 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
45 return E_NOINTERFACE;
48 ULONG WINAPI IDirectMusicAudioPathImpl_AddRef (LPDIRECTMUSICAUDIOPATH iface)
50 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
51 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
52 return ++(This->ref);
55 ULONG WINAPI IDirectMusicAudioPathImpl_Release (LPDIRECTMUSICAUDIOPATH iface)
57 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
58 ULONG ref = --This->ref;
59 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60 if (ref == 0) {
61 HeapFree(GetProcessHeap(), 0, This);
63 return ref;
66 /* IDirectMusicAudioPath IDirectMusicAudioPath part: */
67 HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject)
69 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
71 FIXME("(%p, %ld, %ld, %ld, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_guid(guidObject), dwIndex, debugstr_guid(iidInterface), ppObject);
73 switch (dwStage) {
74 case DMUS_PATH_BUFFER:
76 if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) {
77 IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject);
78 TRACE("returning %p\n",*ppObject);
79 return S_OK;
80 } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) {
81 IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject);
82 TRACE("returning %p\n",*ppObject);
83 return S_OK;
84 } else {
85 FIXME("Bad iid\n");
88 break;
90 case DMUS_PATH_PRIMARY_BUFFER: {
91 if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) {
92 IDirectSoundBuffer8_QueryInterface (This->pPrimary, &IID_IDirectSound3DListener, ppObject);
93 return S_OK;
94 } else {
95 FIXME("bad iid...\n");
98 break;
100 case DMUS_PATH_AUDIOPATH_GRAPH:
102 if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) {
103 if (NULL == This->pToolGraph) {
104 IDirectMusicGraphImpl* pGraph;
105 pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
106 pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
107 pGraph->ref = 1;
108 This->pToolGraph = (IDirectMusicGraph*) pGraph;
110 *ppObject = (LPDIRECTMUSICGRAPH) This->pToolGraph;
111 IDirectMusicGraphImpl_AddRef((LPDIRECTMUSICGRAPH) *ppObject);
112 return S_OK;
115 break;
117 case DMUS_PATH_AUDIOPATH_TOOL:
119 /* TODO */
121 break;
123 case DMUS_PATH_PERFORMANCE:
125 /* TODO check wanted GUID */
126 *ppObject = (LPDIRECTMUSICPERFORMANCE8) This->pPerf;
127 IDirectMusicPerformance8Impl_AddRef((LPDIRECTMUSICPERFORMANCE8) *ppObject);
128 return S_OK;
130 break;
132 case DMUS_PATH_PERFORMANCE_GRAPH:
134 IDirectMusicGraph* pPerfoGraph = NULL;
135 IDirectMusicPerformance8Impl_GetGraph((LPDIRECTMUSICPERFORMANCE8) This->pPerf, &pPerfoGraph);
136 if (NULL == pPerfoGraph) {
137 IDirectMusicGraphImpl* pGraph = NULL;
138 pGraph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
139 pGraph->lpVtbl = &DirectMusicGraph_Vtbl;
140 pGraph->ref = 1;
141 IDirectMusicPerformance8Impl_SetGraph((LPDIRECTMUSICPERFORMANCE8) This->pPerf, (IDirectMusicGraph*) pGraph);
142 /* we need release as SetGraph do an AddRef */
143 IDirectMusicGraphImpl_Release((LPDIRECTMUSICGRAPH) pGraph);
144 pPerfoGraph = (LPDIRECTMUSICGRAPH) pGraph;
146 *ppObject = (LPDIRECTMUSICGRAPH) pPerfoGraph;
147 return S_OK;
149 break;
151 case DMUS_PATH_PERFORMANCE_TOOL:
152 default:
153 break;
156 *ppObject = NULL;
157 return E_INVALIDARG;
160 HRESULT WINAPI IDirectMusicAudioPathImpl_Activate (LPDIRECTMUSICAUDIOPATH iface, BOOL fActivate)
162 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
164 FIXME("(%p, %d): stub\n", This, fActivate);
166 return S_OK;
169 HRESULT WINAPI IDirectMusicAudioPathImpl_SetVolume (LPDIRECTMUSICAUDIOPATH iface, long lVolume, DWORD dwDuration)
171 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
173 FIXME("(%p, %li, %ld): stub\n", This, lVolume, dwDuration);
175 return S_OK;
178 HRESULT WINAPI IDirectMusicAudioPathImpl_ConvertPChannel (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannelIn, DWORD* pdwPChannelOut)
180 ICOM_THIS(IDirectMusicAudioPathImpl,iface);
182 FIXME("(%p, %ld, %p): stub\n", This, dwPChannelIn, pdwPChannelOut);
184 return S_OK;
187 ICOM_VTABLE(IDirectMusicAudioPath) DirectMusicAudioPath_Vtbl =
189 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
190 IDirectMusicAudioPathImpl_QueryInterface,
191 IDirectMusicAudioPathImpl_AddRef,
192 IDirectMusicAudioPathImpl_Release,
193 IDirectMusicAudioPathImpl_GetObjectInPath,
194 IDirectMusicAudioPathImpl_Activate,
195 IDirectMusicAudioPathImpl_SetVolume,
196 IDirectMusicAudioPathImpl_ConvertPChannel
199 /* for ClassFactory */
200 HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPath (LPCGUID lpcGUID, LPDIRECTMUSICAUDIOPATH* ppDMCAPath, LPUNKNOWN pUnkOuter)
202 IDirectMusicAudioPathImpl* path;
204 if (IsEqualIID (lpcGUID, &IID_IDirectMusicAudioPath)) {
205 path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl));
206 if (NULL == path) {
207 *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) NULL;
208 return E_OUTOFMEMORY;
210 path->lpVtbl = &DirectMusicAudioPath_Vtbl;
211 path->ref = 1;
212 *ppDMCAPath = (LPDIRECTMUSICAUDIOPATH) path;
213 return S_OK;
216 WARN("No interface found\n");
217 return E_NOINTERFACE;
220 /*****************************************************************************
221 * IDirectMusicAudioPathObject implementation
223 /* IDirectMusicAudioPathObject IUnknown part: */
224 HRESULT WINAPI IDirectMusicAudioPathObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
226 ICOM_THIS(IDirectMusicAudioPathObject,iface);
228 if (IsEqualIID (riid, &IID_IUnknown)
229 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
230 IDirectMusicAudioPathObject_AddRef(iface);
231 *ppobj = This;
232 return S_OK;
233 } else if (IsEqualIID (riid, &IID_IPersistStream)) {
234 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
235 *ppobj = (LPPERSISTSTREAM)This->pStream;
236 return S_OK;
237 } else if (IsEqualIID (riid, &IID_IDirectMusicAudioPath)) {
238 IDirectMusicAudioPath_AddRef ((LPDIRECTMUSICAUDIOPATH)This->pAudioPath);
239 *ppobj = (LPDIRECTMUSICAUDIOPATH)This->pAudioPath;
240 return S_OK;
243 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
244 return E_NOINTERFACE;
247 ULONG WINAPI IDirectMusicAudioPathObject_AddRef (LPDIRECTMUSICOBJECT iface)
249 ICOM_THIS(IDirectMusicAudioPathObject,iface);
250 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
251 return ++(This->ref);
254 ULONG WINAPI IDirectMusicAudioPathObject_Release (LPDIRECTMUSICOBJECT iface)
256 ICOM_THIS(IDirectMusicAudioPathObject,iface);
257 ULONG ref = --This->ref;
258 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
259 if (ref == 0) {
260 HeapFree(GetProcessHeap(), 0, This);
262 return ref;
265 /* IDirectMusicAudioPathObject IDirectMusicObject part: */
266 HRESULT WINAPI IDirectMusicAudioPathObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
268 ICOM_THIS(IDirectMusicAudioPathObject,iface);
270 TRACE("(%p, %p)\n", This, pDesc);
271 pDesc = This->pDesc;
273 return S_OK;
276 HRESULT WINAPI IDirectMusicAudioPathObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
278 ICOM_THIS(IDirectMusicAudioPathObject,iface);
280 TRACE("(%p, %p)\n", This, pDesc);
281 This->pDesc = pDesc;
283 return S_OK;
286 HRESULT WINAPI IDirectMusicAudioPathObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
288 ICOM_THIS(IDirectMusicAudioPathObject,iface);
290 FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
292 return S_OK;
295 ICOM_VTABLE(IDirectMusicObject) DirectMusicAudioPathObject_Vtbl =
297 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
298 IDirectMusicAudioPathObject_QueryInterface,
299 IDirectMusicAudioPathObject_AddRef,
300 IDirectMusicAudioPathObject_Release,
301 IDirectMusicAudioPathObject_GetDescriptor,
302 IDirectMusicAudioPathObject_SetDescriptor,
303 IDirectMusicAudioPathObject_ParseDescriptor
306 /* for ClassFactory */
307 HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
309 IDirectMusicAudioPathObject *obj;
311 TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
312 if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
313 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObject));
314 if (NULL == obj) {
315 *ppObject = (LPDIRECTMUSICOBJECT) NULL;
316 return E_OUTOFMEMORY;
318 obj->lpVtbl = &DirectMusicAudioPathObject_Vtbl;
319 obj->ref = 1;
320 /* prepare IPersistStream */
321 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathObjectStream));
322 obj->pStream->lpVtbl = &DirectMusicAudioPathObjectStream_Vtbl;
323 obj->pStream->ref = 1;
324 obj->pStream->pParentObject = obj;
325 /* prepare IDirectMusicAudioPath */
326 DMUSIC_CreateDirectMusicAudioPath (&IID_IDirectMusicAudioPath, (LPDIRECTMUSICAUDIOPATH*)&obj->pAudioPath, NULL);
327 obj->pAudioPath->pObject = obj;
328 *ppObject = (LPDIRECTMUSICOBJECT) obj;
329 return S_OK;
331 WARN("No interface found\n");
333 return E_NOINTERFACE;
336 /*****************************************************************************
337 * IDirectMusicAudioPathObjectStream implementation
339 /* IDirectMusicAudioPathObjectStream IUnknown part: */
340 HRESULT WINAPI IDirectMusicAudioPathObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
342 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
344 if (IsEqualIID (riid, &IID_IUnknown)
345 || IsEqualIID (riid, &IID_IPersistStream)) {
346 IDirectMusicAudioPathObjectStream_AddRef(iface);
347 *ppobj = This;
348 return S_OK;
351 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
352 return E_NOINTERFACE;
355 ULONG WINAPI IDirectMusicAudioPathObjectStream_AddRef (LPPERSISTSTREAM iface)
357 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
358 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
359 return ++(This->ref);
362 ULONG WINAPI IDirectMusicAudioPathObjectStream_Release (LPPERSISTSTREAM iface)
364 ICOM_THIS(IDirectMusicAudioPathObjectStream,iface);
365 ULONG ref = --This->ref;
366 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
367 if (ref == 0) {
368 HeapFree(GetProcessHeap(), 0, This);
370 return ref;
373 /* IDirectMusicAudioPathObjectStream IPersist part: */
374 HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
376 return E_NOTIMPL;
379 /* IDirectMusicAudioPathObjectStream IPersistStream part: */
380 HRESULT WINAPI IDirectMusicAudioPathObjectStream_IsDirty (LPPERSISTSTREAM iface)
382 return E_NOTIMPL;
385 HRESULT WINAPI IDirectMusicAudioPathObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
387 FIXME(": Loading not implemented yet\n");
388 return S_OK;
391 HRESULT WINAPI IDirectMusicAudioPathObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
393 return E_NOTIMPL;
396 HRESULT WINAPI IDirectMusicAudioPathObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
398 return E_NOTIMPL;
401 ICOM_VTABLE(IPersistStream) DirectMusicAudioPathObjectStream_Vtbl =
403 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
404 IDirectMusicAudioPathObjectStream_QueryInterface,
405 IDirectMusicAudioPathObjectStream_AddRef,
406 IDirectMusicAudioPathObjectStream_Release,
407 IDirectMusicAudioPathObjectStream_GetClassID,
408 IDirectMusicAudioPathObjectStream_IsDirty,
409 IDirectMusicAudioPathObjectStream_Load,
410 IDirectMusicAudioPathObjectStream_Save,
411 IDirectMusicAudioPathObjectStream_GetSizeMax