Help, error C2227 on CreateCaptureBuffer

Help, error C2227 on CreateCaptureBuffer

Post by yaronk » Sun, 03 Oct 2004 06:25:36


I get an error C2227 on CreateCaptureBuffer - what am I doing wrong?

Please help.

LPDIRECTSOUNDCAPTURE8 *pDSC8 = NULL;
LPUNKNOWN pUnkOuter = NULL;
HRESULT hResult = DirectSoundCaptureCreate8(NULL, pDSC8, pUnkOuter);
if( DS_OK != hResult )
{
LogIt(DEVICEPROVIDER_APP_ID,LOG_ERROR,"CMicDx::InternalOpen -
DirectSoundCaptureCreate8 failed hResult=0x%x",hResult);
return RC_FAIL;
}

WAVEFORMATEX waveFormat;
waveFormat.wFormatTag = WAVE_FORMAT_ALAW;
waveFormat.nChannels = 1;
waveFormat.nSamplesPerSec = 8000;
waveFormat.nAvgBytesPerSec = 8000;
waveFormat.nBlockAlign = 1;
waveFormat.wBitsPerSample = 8;
waveFormat.cbSize = 0;
LPWAVEFORMATEX wavePtr=(LPWAVEFORMATEX)&waveFormat;

DSCBUFFERDESC dscBufferDesc;
dscBufferDesc.dwBufferBytes = waveFormat.nAvgBytesPerSec;
dscBufferDesc.dwReserved = 0;
dscBufferDesc.dwFlags = 0;
dscBufferDesc.dwSize = sizeof(DSCBUFFERDESC);
dscBufferDesc.lpwfxFormat = wavePtr;

LPDIRECTSOUNDCAPTUREBUFFER pDSCB = NULL;

hResult = pDSC8->CreateCaptureBuffer(&dscBufferDesc, &pDSCB, NULL);
 
 
 

Help, error C2227 on CreateCaptureBuffer

Post by Chris P. [ » Wed, 06 Oct 2004 04:06:49


...
...

Because you can't do that?

Wait a minute did you get a compile error or a DS error?
C2227 is compile error left of '->identifier' must point to
class/struct/union.

You should have got the error DSERR_BADFORMAT. The specified wave format is
not supported.

DirectSound doesn't support anything other than PCM, you must do the
conversion on the fly using the ACM.