2005-06-02 12:28:34 +02:00
|
|
|
/* DirectSoundFullDuplex
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998 Rob Riggs
|
|
|
|
* Copyright 2000-2001 TransGaming Technologies, Inc.
|
|
|
|
* Copyright 2005 Robert Reif
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-06-02 12:28:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2009-11-24 14:22:29 +01:00
|
|
|
#define COBJMACROS
|
2005-06-02 12:28:34 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2005-10-17 11:24:50 +02:00
|
|
|
#include "winuser.h"
|
2005-06-02 12:28:34 +02:00
|
|
|
#include "mmsystem.h"
|
|
|
|
#include "mmddk.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "dsound.h"
|
|
|
|
#include "dsound_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
|
|
|
|
2009-11-14 14:55:58 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundFullDuplex implementation structure
|
|
|
|
*/
|
|
|
|
typedef struct IDirectSoundFullDuplexImpl
|
|
|
|
{
|
2012-08-16 01:43:25 +02:00
|
|
|
IUnknown IUnknown_iface;
|
2012-08-16 01:31:52 +02:00
|
|
|
IDirectSoundFullDuplex IDirectSoundFullDuplex_iface;
|
2012-08-16 01:43:25 +02:00
|
|
|
LONG ref, refdsfd, numIfaces;
|
2012-08-16 01:47:44 +02:00
|
|
|
IUnknown *ds8_unk; /* Aggregated IDirectSound8 */
|
2012-08-16 01:50:27 +02:00
|
|
|
IUnknown *dsc8_unk; /* Aggregated IDirectSoundCapture8 */
|
2009-11-14 14:55:58 +01:00
|
|
|
} IDirectSoundFullDuplexImpl;
|
|
|
|
|
2012-08-16 01:40:59 +02:00
|
|
|
static void fullduplex_destroy(IDirectSoundFullDuplexImpl *This)
|
|
|
|
{
|
2012-08-16 01:47:44 +02:00
|
|
|
IDirectSound8 *ds8;
|
2012-08-16 01:50:27 +02:00
|
|
|
IDirectSoundCapture8 *dsc8;
|
2012-08-16 01:47:44 +02:00
|
|
|
|
|
|
|
if (This->ds8_unk) {
|
|
|
|
IUnknown_QueryInterface(This->ds8_unk, &IID_IDirectSound8, (void**)&ds8);
|
|
|
|
while(IDirectSound8_Release(ds8) > 0);
|
|
|
|
IUnknown_Release(This->ds8_unk);
|
|
|
|
}
|
2012-08-16 01:50:27 +02:00
|
|
|
if (This->dsc8_unk) {
|
|
|
|
IUnknown_QueryInterface(This->dsc8_unk, &IID_IDirectSoundCapture8, (void**)&dsc8);
|
|
|
|
while(IDirectSoundCapture_Release(dsc8) > 0);
|
|
|
|
IUnknown_Release(This->dsc8_unk);
|
|
|
|
}
|
2012-08-16 01:40:59 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
TRACE("(%p) released\n", This);
|
|
|
|
}
|
|
|
|
|
2006-01-17 16:13:58 +01:00
|
|
|
/*******************************************************************************
|
2015-12-02 01:42:31 +01:00
|
|
|
* IUnknown implementation for DirectSoundFullDuplex
|
2006-01-17 16:13:58 +01:00
|
|
|
*/
|
2012-08-16 01:43:25 +02:00
|
|
|
static inline IDirectSoundFullDuplexImpl *impl_from_IUnknown(IUnknown *iface)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:43:25 +02:00
|
|
|
return CONTAINING_RECORD(iface, IDirectSoundFullDuplexImpl, IUnknown_iface);
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:43:25 +02:00
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IUnknown(iface);
|
2012-08-16 01:52:16 +02:00
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
|
2012-08-16 01:52:16 +02:00
|
|
|
|
|
|
|
if (!ppv) {
|
|
|
|
WARN("invalid parameter\n");
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
IUnknown_AddRef(&This->IUnknown_iface);
|
|
|
|
*ppv = &This->IUnknown_iface;
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
|
|
|
|
IDirectSoundFullDuplex_AddRef(&This->IDirectSoundFullDuplex_iface);
|
|
|
|
*ppv = &This->IDirectSoundFullDuplex_iface;
|
|
|
|
return S_OK;
|
|
|
|
} else if (This->ds8_unk && (IsEqualIID(riid, &IID_IDirectSound) ||
|
|
|
|
IsEqualIID(riid, &IID_IDirectSound8)))
|
|
|
|
return IUnknown_QueryInterface(This->ds8_unk, riid, ppv);
|
|
|
|
else if (This->dsc8_unk && IsEqualIID(riid, &IID_IDirectSoundCapture))
|
|
|
|
return IUnknown_QueryInterface(This->dsc8_unk, riid, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
static ULONG WINAPI IUnknownImpl_AddRef(IUnknown *iface)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:43:25 +02:00
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IUnknown(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2012-08-16 01:43:25 +02:00
|
|
|
|
|
|
|
if(ref == 1)
|
|
|
|
InterlockedIncrement(&This->numIfaces);
|
2006-01-17 16:13:58 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
static ULONG WINAPI IUnknownImpl_Release(IUnknown *iface)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:43:25 +02:00
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IUnknown(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
|
|
|
fullduplex_destroy(This);
|
|
|
|
return ref;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
static const IUnknownVtbl unk_vtbl =
|
|
|
|
{
|
|
|
|
IUnknownImpl_QueryInterface,
|
|
|
|
IUnknownImpl_AddRef,
|
|
|
|
IUnknownImpl_Release
|
|
|
|
};
|
|
|
|
|
2006-01-17 16:13:58 +01:00
|
|
|
/***************************************************************************
|
2012-08-16 01:31:52 +02:00
|
|
|
* IDirectSoundFullDuplex implementation
|
2006-01-17 16:13:58 +01:00
|
|
|
*/
|
2012-08-16 01:31:52 +02:00
|
|
|
static inline IDirectSoundFullDuplexImpl *impl_from_IDirectSoundFullDuplex(IDirectSoundFullDuplex *iface)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:31:52 +02:00
|
|
|
return CONTAINING_RECORD(iface, IDirectSoundFullDuplexImpl, IDirectSoundFullDuplex_iface);
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:52:16 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundFullDuplexImpl_QueryInterface(IDirectSoundFullDuplex *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
|
|
|
|
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return IUnknown_QueryInterface(&This->IUnknown_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:31:52 +02:00
|
|
|
static ULONG WINAPI IDirectSoundFullDuplexImpl_AddRef(IDirectSoundFullDuplex *iface)
|
|
|
|
{
|
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
|
2012-08-16 01:43:25 +02:00
|
|
|
ULONG ref = InterlockedIncrement(&This->refdsfd);
|
2012-08-16 01:40:59 +02:00
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2012-08-16 01:40:59 +02:00
|
|
|
|
|
|
|
if(ref == 1)
|
|
|
|
InterlockedIncrement(&This->numIfaces);
|
2006-01-17 16:13:58 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:31:52 +02:00
|
|
|
static ULONG WINAPI IDirectSoundFullDuplexImpl_Release(IDirectSoundFullDuplex *iface)
|
2005-10-27 12:18:51 +02:00
|
|
|
{
|
2012-08-16 01:31:52 +02:00
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
|
2012-08-16 01:43:25 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&This->refdsfd);
|
2005-10-27 12:18:51 +02:00
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2012-08-16 01:40:59 +02:00
|
|
|
|
|
|
|
if (!ref && !InterlockedDecrement(&This->numIfaces))
|
|
|
|
fullduplex_destroy(This);
|
2005-10-27 12:18:51 +02:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:30:16 +02:00
|
|
|
static HRESULT WINAPI IDirectSoundFullDuplexImpl_Initialize(IDirectSoundFullDuplex *iface,
|
|
|
|
const GUID *capture_dev, const GUID *render_dev, const DSCBUFFERDESC *cbufdesc,
|
|
|
|
const DSBUFFERDESC *bufdesc, HWND hwnd, DWORD level, IDirectSoundCaptureBuffer8 **dscb8,
|
|
|
|
IDirectSoundBuffer8 **dsb8)
|
2005-10-27 12:18:51 +02:00
|
|
|
{
|
2012-08-16 01:31:52 +02:00
|
|
|
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
|
2012-08-16 01:47:44 +02:00
|
|
|
IDirectSound8 *ds8 = NULL;
|
2012-08-16 01:50:27 +02:00
|
|
|
IDirectSoundCapture8 *dsc8 = NULL;
|
2006-01-17 16:13:58 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%p,%s,%s,%p,%p,%p,%lx,%p,%p)\n", This, debugstr_guid(capture_dev),
|
2012-08-16 01:30:16 +02:00
|
|
|
debugstr_guid(render_dev), cbufdesc, bufdesc, hwnd, level, dscb8, dsb8);
|
|
|
|
|
|
|
|
if (!dscb8 || !dsb8)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*dscb8 = NULL;
|
|
|
|
*dsb8 = NULL;
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:50:27 +02:00
|
|
|
if (This->ds8_unk || This->dsc8_unk) {
|
2006-01-17 16:13:58 +01:00
|
|
|
WARN("already initialized\n");
|
|
|
|
return DSERR_ALREADYINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:47:44 +02:00
|
|
|
hr = IDirectSoundImpl_Create(&This->IUnknown_iface, &IID_IUnknown, (void**)&This->ds8_unk,
|
|
|
|
TRUE);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
IUnknown_QueryInterface(This->ds8_unk, &IID_IDirectSound8, (void**)&ds8);
|
2018-03-30 06:04:48 +02:00
|
|
|
hr = IDirectSound8_Initialize(ds8, render_dev);
|
2012-08-16 01:47:44 +02:00
|
|
|
}
|
2006-01-17 16:13:58 +01:00
|
|
|
if (hr != DS_OK) {
|
2012-08-16 01:47:44 +02:00
|
|
|
WARN("Creating/initializing IDirectSound8 failed\n");
|
2012-08-16 01:30:16 +02:00
|
|
|
goto error;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
2005-06-02 12:28:34 +02:00
|
|
|
|
2012-08-16 01:47:44 +02:00
|
|
|
IDirectSound8_SetCooperativeLevel(ds8, hwnd, level);
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:47:44 +02:00
|
|
|
hr = IDirectSound8_CreateSoundBuffer(ds8, bufdesc, (IDirectSoundBuffer**)dsb8, NULL);
|
2006-01-17 16:13:58 +01:00
|
|
|
if (hr != DS_OK) {
|
2012-08-16 01:47:44 +02:00
|
|
|
WARN("IDirectSoundBuffer_Create() failed\n");
|
2012-08-16 01:30:16 +02:00
|
|
|
goto error;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
2005-10-27 12:18:51 +02:00
|
|
|
|
2012-08-16 01:50:27 +02:00
|
|
|
hr = IDirectSoundCaptureImpl_Create(&This->IUnknown_iface, &IID_IUnknown,
|
|
|
|
(void**)&This->dsc8_unk, TRUE);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
IUnknown_QueryInterface(This->dsc8_unk, &IID_IDirectSoundCapture8, (void**)&dsc8);
|
|
|
|
hr = IDirectSoundCapture_Initialize(dsc8, capture_dev);
|
|
|
|
}
|
2006-01-17 16:13:58 +01:00
|
|
|
if (hr != DS_OK) {
|
2012-08-16 01:50:27 +02:00
|
|
|
WARN("Creating/initializing IDirectSoundCapture8 failed\n");
|
2012-08-16 01:30:16 +02:00
|
|
|
goto error;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:50:27 +02:00
|
|
|
hr = IDirectSoundCapture_CreateCaptureBuffer(dsc8, cbufdesc,
|
2012-08-16 01:30:16 +02:00
|
|
|
(IDirectSoundCaptureBuffer**)dscb8, NULL);
|
2006-01-17 16:13:58 +01:00
|
|
|
if (hr != DS_OK) {
|
2012-08-16 01:50:27 +02:00
|
|
|
WARN("IDirectSoundCapture_CreateCaptureBuffer() failed\n");
|
2012-08-16 01:30:16 +02:00
|
|
|
goto error;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:47:44 +02:00
|
|
|
IDirectSound8_Release(ds8);
|
2012-08-16 01:50:27 +02:00
|
|
|
IDirectSoundCapture_Release(dsc8);
|
2012-08-16 01:30:16 +02:00
|
|
|
return DS_OK;
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (*dsb8) {
|
|
|
|
IDirectSoundBuffer8_Release(*dsb8);
|
|
|
|
*dsb8 = NULL;
|
|
|
|
}
|
2012-08-16 01:47:44 +02:00
|
|
|
if (ds8)
|
|
|
|
IDirectSound8_Release(ds8);
|
|
|
|
if (This->ds8_unk) {
|
|
|
|
IUnknown_Release(This->ds8_unk);
|
|
|
|
This->ds8_unk = NULL;
|
2012-08-16 01:30:16 +02:00
|
|
|
}
|
|
|
|
if (*dscb8) {
|
|
|
|
IDirectSoundCaptureBuffer8_Release(*dscb8);
|
|
|
|
*dscb8 = NULL;
|
|
|
|
}
|
2012-08-16 01:50:27 +02:00
|
|
|
if (dsc8)
|
|
|
|
IDirectSoundCapture_Release(dsc8);
|
|
|
|
if (This->dsc8_unk) {
|
|
|
|
IUnknown_Release(This->dsc8_unk);
|
|
|
|
This->dsc8_unk = NULL;
|
2012-08-16 01:30:16 +02:00
|
|
|
}
|
2006-01-17 16:13:58 +01:00
|
|
|
return hr;
|
2005-10-27 12:18:51 +02:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:31:52 +02:00
|
|
|
static const IDirectSoundFullDuplexVtbl dsfd_vtbl =
|
2005-10-27 12:18:51 +02:00
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
IDirectSoundFullDuplexImpl_QueryInterface,
|
|
|
|
IDirectSoundFullDuplexImpl_AddRef,
|
|
|
|
IDirectSoundFullDuplexImpl_Release,
|
|
|
|
|
|
|
|
/* IDirectSoundFullDuplex methods */
|
|
|
|
IDirectSoundFullDuplexImpl_Initialize
|
|
|
|
};
|
2005-06-02 12:28:34 +02:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppv)
|
2006-01-17 16:13:58 +01:00
|
|
|
{
|
2012-08-16 01:27:12 +02:00
|
|
|
IDirectSoundFullDuplexImpl *obj;
|
|
|
|
HRESULT hr;
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
|
|
|
if (!obj) {
|
2006-01-17 16:13:58 +01:00
|
|
|
WARN("out of memory\n");
|
|
|
|
return DSERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
setup_dsound_options();
|
|
|
|
|
2012-08-16 01:31:52 +02:00
|
|
|
obj->IDirectSoundFullDuplex_iface.lpVtbl = &dsfd_vtbl;
|
2012-08-16 01:43:25 +02:00
|
|
|
obj->IUnknown_iface.lpVtbl = &unk_vtbl;
|
2012-08-16 01:27:12 +02:00
|
|
|
obj->ref = 1;
|
2012-08-16 01:43:25 +02:00
|
|
|
obj->refdsfd = 0;
|
2012-08-16 01:40:59 +02:00
|
|
|
obj->numIfaces = 1;
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:43:25 +02:00
|
|
|
hr = IUnknown_QueryInterface(&obj->IUnknown_iface, riid, ppv);
|
|
|
|
IUnknown_Release(&obj->IUnknown_iface);
|
2006-02-27 13:34:01 +01:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
return hr;
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2005-06-02 12:28:34 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* DirectSoundFullDuplexCreate [DSOUND.10]
|
|
|
|
*
|
|
|
|
* Create and initialize a DirectSoundFullDuplex interface.
|
|
|
|
*
|
|
|
|
* PARAMS
|
2012-08-16 01:27:12 +02:00
|
|
|
* capture_dev [I] Address of sound capture device GUID.
|
|
|
|
* render_dev [I] Address of sound render device GUID.
|
|
|
|
* cbufdesc [I] Address of capture buffer description.
|
|
|
|
* bufdesc [I] Address of render buffer description.
|
|
|
|
* hwnd [I] Handle to application window.
|
|
|
|
* level [I] Cooperative level.
|
|
|
|
* dsfd [O] Address where full duplex interface returned.
|
|
|
|
* dscb8 [0] Address where capture buffer interface returned.
|
|
|
|
* dsb8 [0] Address where render buffer interface returned.
|
|
|
|
* outer_unk [I] Must be NULL.
|
2005-06-02 12:28:34 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: DS_OK
|
|
|
|
* Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
|
|
|
|
* DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
|
|
|
|
*/
|
2012-08-16 01:27:12 +02:00
|
|
|
HRESULT WINAPI DirectSoundFullDuplexCreate(const GUID *capture_dev, const GUID *render_dev,
|
|
|
|
const DSCBUFFERDESC *cbufdesc, const DSBUFFERDESC *bufdesc, HWND hwnd, DWORD level,
|
|
|
|
IDirectSoundFullDuplex **dsfd, IDirectSoundCaptureBuffer8 **dscb8,
|
|
|
|
IDirectSoundBuffer8 **dsb8, IUnknown *outer_unk)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2005-06-02 12:28:34 +02:00
|
|
|
|
2022-02-10 08:41:37 +01:00
|
|
|
TRACE("(%s,%s,%p,%p,%p,%lx,%p,%p,%p,%p)\n", debugstr_guid(capture_dev),
|
2012-08-16 01:27:12 +02:00
|
|
|
debugstr_guid(render_dev), cbufdesc, bufdesc, hwnd, level, dsfd, dscb8, dsb8,
|
|
|
|
outer_unk);
|
2005-06-02 12:28:34 +02:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
if (!dsfd)
|
2006-01-17 16:13:58 +01:00
|
|
|
return DSERR_INVALIDPARAM;
|
2012-08-16 01:27:12 +02:00
|
|
|
if (outer_unk) {
|
|
|
|
*dsfd = NULL;
|
|
|
|
return DSERR_NOAGGREGATION;
|
2005-06-02 12:28:34 +02:00
|
|
|
}
|
2006-01-17 16:13:58 +01:00
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
hr = DSOUND_FullDuplexCreate(&IID_IDirectSoundFullDuplex, (void**)dsfd);
|
|
|
|
if (hr == DS_OK) {
|
|
|
|
hr = IDirectSoundFullDuplex_Initialize(*dsfd, capture_dev, render_dev, cbufdesc, bufdesc,
|
|
|
|
hwnd, level, dscb8, dsb8);
|
|
|
|
if (hr != DS_OK) {
|
|
|
|
IDirectSoundFullDuplex_Release(*dsfd);
|
|
|
|
*dsfd = NULL;
|
|
|
|
WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
|
|
|
|
}
|
2006-01-17 16:13:58 +01:00
|
|
|
}
|
|
|
|
|
2012-08-16 01:27:12 +02:00
|
|
|
return hr;
|
2005-06-02 12:28:34 +02:00
|
|
|
}
|