1 /* DirectSoundFullDuplex
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2001 TransGaming Technologies, Inc.
6 * Copyright 2005 Robert Reif
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Implement DirectSoundFullDuplex support.
29 #define NONAMELESSSTRUCT
30 #define NONAMELESSUNION
39 #include "wine/debug.h"
42 #include "dsound_private.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
47 IDirectSoundFullDuplexImpl_QueryInterface(
48 LPDIRECTSOUNDFULLDUPLEX iface,
52 IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
53 TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
56 WARN("invalid parameter\n");
65 IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface )
67 IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
68 ULONG ref = InterlockedIncrement(&(This->ref));
69 TRACE("(%p) ref was %ld\n", This, ref - 1);
74 IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface )
76 IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
77 ULONG ref = InterlockedDecrement(&(This->ref));
78 TRACE("(%p) ref was %ld\n", This, ref - 1);
81 HeapFree( GetProcessHeap(), 0, This );
82 TRACE("(%p) released\n", This);
88 IDirectSoundFullDuplexImpl_Initialize(
89 LPDIRECTSOUNDFULLDUPLEX iface,
91 LPCGUID pRendererGuid,
92 LPCDSCBUFFERDESC lpDscBufferDesc,
93 LPCDSBUFFERDESC lpDsBufferDesc,
96 LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8,
97 LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8 )
99 IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
100 IDirectSoundCaptureBufferImpl** ippdscb=(IDirectSoundCaptureBufferImpl**)lplpDirectSoundCaptureBuffer8;
101 IDirectSoundBufferImpl** ippdsc=(IDirectSoundBufferImpl**)lplpDirectSoundBuffer8;
103 FIXME( "(%p,%s,%s,%p,%p,%p,%lx,%p,%p) stub!\n", This, debugstr_guid(pCaptureGuid),
104 debugstr_guid(pRendererGuid), lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel,
110 static const IDirectSoundFullDuplexVtbl dsfdvt =
112 /* IUnknown methods */
113 IDirectSoundFullDuplexImpl_QueryInterface,
114 IDirectSoundFullDuplexImpl_AddRef,
115 IDirectSoundFullDuplexImpl_Release,
117 /* IDirectSoundFullDuplex methods */
118 IDirectSoundFullDuplexImpl_Initialize
121 /***************************************************************************
122 * DirectSoundFullDuplexCreate [DSOUND.10]
124 * Create and initialize a DirectSoundFullDuplex interface.
127 * pcGuidCaptureDevice [I] Address of sound capture device GUID.
128 * pcGuidRenderDevice [I] Address of sound render device GUID.
129 * pcDSCBufferDesc [I] Address of capture buffer description.
130 * pcDSBufferDesc [I] Address of render buffer description.
131 * hWnd [I] Handle to application window.
132 * dwLevel [I] Cooperative level.
133 * ppDSFD [O] Address where full duplex interface returned.
134 * ppDSCBuffer8 [0] Address where capture buffer interface returned.
135 * ppDSBuffer8 [0] Address where render buffer interface returned.
136 * pUnkOuter [I] Must be NULL.
140 * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
141 * DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
144 DirectSoundFullDuplexCreate(
145 LPCGUID pcGuidCaptureDevice,
146 LPCGUID pcGuidRenderDevice,
147 LPCDSCBUFFERDESC pcDSCBufferDesc,
148 LPCDSBUFFERDESC pcDSBufferDesc,
151 LPDIRECTSOUNDFULLDUPLEX *ppDSFD,
152 LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8,
153 LPDIRECTSOUNDBUFFER8 *ppDSBuffer8,
156 IDirectSoundFullDuplexImpl** ippDSFD=(IDirectSoundFullDuplexImpl**)ppDSFD;
157 TRACE("(%s,%s,%p,%p,%p,%lx,%p,%p,%p,%p)\n", debugstr_guid(pcGuidCaptureDevice),
158 debugstr_guid(pcGuidRenderDevice), pcDSCBufferDesc, pcDSBufferDesc,
159 hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter);
162 WARN("pUnkOuter != 0\n");
163 return DSERR_NOAGGREGATION;
166 *ippDSFD = HeapAlloc(GetProcessHeap(),
167 HEAP_ZERO_MEMORY, sizeof(IDirectSoundFullDuplexImpl));
169 if (*ippDSFD == NULL) {
170 WARN("out of memory\n");
171 return DSERR_OUTOFMEMORY;
174 IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)*ippDSFD;
177 This->lpVtbl = &dsfdvt;
179 hres = IDirectSoundFullDuplexImpl_Initialize( (LPDIRECTSOUNDFULLDUPLEX)This,
180 pcGuidCaptureDevice, pcGuidRenderDevice,
181 pcDSCBufferDesc, pcDSBufferDesc,
182 hWnd, dwLevel, ppDSCBuffer8, ppDSBuffer8);
184 WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
189 /*******************************************************************************
190 * DirectSoundFullDuplex ClassFactory
193 static HRESULT WINAPI
194 DSFDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
196 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
198 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
199 return E_NOINTERFACE;
203 DSFDCF_AddRef(LPCLASSFACTORY iface)
205 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
206 TRACE("(%p) ref was %ld\n", This, This->ref);
207 return InterlockedIncrement(&(This->ref));
211 DSFDCF_Release(LPCLASSFACTORY iface)
213 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
214 /* static class, won't be freed */
215 TRACE("(%p) ref was %ld\n", This, This->ref);
216 return InterlockedDecrement(&(This->ref));
219 static HRESULT WINAPI
220 DSFDCF_CreateInstance(
221 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj )
223 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
225 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
228 WARN("aggregation not supported\n");
229 return CLASS_E_NOAGGREGATION;
233 WARN("invalid parameter\n");
239 if ( IsEqualGUID( &IID_IDirectSoundFullDuplex, riid ) ) {
240 /* FIXME: how do we do this one ? */
241 FIXME("not implemented\n");
242 return E_NOINTERFACE;
245 WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
246 return E_NOINTERFACE;
249 static HRESULT WINAPI
250 DSFDCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
252 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
253 FIXME("(%p)->(%d),stub!\n",This,dolock);
257 static const IClassFactoryVtbl DSFDCF_Vtbl =
259 DSFDCF_QueryInterface,
262 DSFDCF_CreateInstance,
266 IClassFactoryImpl DSOUND_FULLDUPLEX_CF = { &DSFDCF_Vtbl, 1 };