CreateCaptureBuffer returns E_INVALIDARG

CreateCaptureBuffer returns E_INVALIDARG

Post by QXVnaWUgYX » Thu, 05 May 2005 10:54:04

My CreateCaptureBuffer fails with E_INVALIDARG. Before I add AEC to the
DSCBUFFERDESC, it worked fine.
I am using windowsXP and DirectX 9.0 SDK.

Here's my code.

// Create the capture buffer
ZeroMemory( &dscbd, sizeof(dscbd) );
dscbd.dwSize = sizeof(dscbd);
dscbd.dwBufferBytes = m_dwCaptureBufferSize;
dscbd.lpwfxFormat = pwfxInput; // Set the format during creatation
DSCEFFECTDESC ds_effects[2];
ZeroMemory(&ds_effects, sizeof(DSCEFFECTDESC)*2);

ds_effects[0].dwSize = sizeof(DSCEFFECTDESC);
ds_effects[0].dwFlags = DSCFX_LOCSOFTWARE;
ds_effects[0].guidDSCFXClass = GUID_DSCFX_CLASS_AEC;
ds_effects[0].guidDSCFXInstance = GUID_DSCFX_SYSTEM_AEC;
ds_effects[1].dwSize = sizeof(DSCEFFECTDESC);
ds_effects[1].dwFlags = DSCFX_LOCSOFTWARE;
ds_effects[1].guidDSCFXClass = GUID_DSCFX_CLASS_NS;
ds_effects[1].guidDSCFXInstance = GUID_DSCFX_SYSTEM_NS;
dscbd.dwFlags = DSBCAPS_CTRLFX;
dscbd.dwFXCount = 2;
dscbd.lpDSCFXDesc = ds_effects ;//NULL; //;// ;

if( FAILED( hr = m_pDSCapture8->CreateCaptureBuffer( &dscbd,
NULL ) ) )
return DXTRACE_ERR_MSGBOX( TEXT("CreateCaptureBuffer"), hr );

CreateCaptureBuffer returns E_INVALIDARG

Post by QXVnaWUgYX » Thu, 05 May 2005 12:35:02

Currently, I think it is because I am using the DirectSoundCaptureCreate8
function instead of the DirectSoundFullDuplexCreate8.
As I know the AEC algorithm identifies the echo sound by comparing of the
rendering sound and that's why DirectSoundFullDuplexCreate8.
But my application has two or more sound outputs and all the outputs could
make echo sound (it is a voice conference system via network). I don't know
whether I can put multiful sound sources into one renderer without sound

Any good solutions?

Thank you.


CreateCaptureBuffer returns E_INVALIDARG

Post by Chris P. [ » Thu, 05 May 2005 21:24:35

I've only seen AEC work with a full-duplex buffer.

I would do the mixing myself. It's quite simple to do for basic mixing,
just a matter of adding sample values together one-for-one, and accounting
for short integer overflow.