CreateCaptureBuffer returns error

CreateCaptureBuffer returns error

Post by UmFtZXN » Fri, 24 Jun 2005 20:59:01


hello!
i am having error when i call CreateCaptureBuffer. Before that i have called
DirectSoundCaptureCreate with default device. The default device i hane set
is modem #0 Line record. because i want to capture data from modem.

The code i have used is
HRESULT status = DirectSoundCaptureCreate(NULL, &m_lpDirectSoundCapture,
NULL);
if(status != DS_OK)
{
MessageBox(NULL,"error", "VoiceHandler: DirectSoundCaptureCreate
failed.",0);
return 0;
}

if(status == DS_OK)
{
memset(&dsrecBufDesc, 0, sizeof(DSCBUFFERDESC));
memset(&recFormat, 0, sizeof(WAVEFORMATEX));
recFormat.wFormatTag = WAVE_FORMAT_PCM;
recFormat.nChannels = 1;
recFormat.nSamplesPerSec = 8000;//SAMPLING_RATE;
recFormat.wBitsPerSample = SAMPLE_SIZE * 8;
recFormat.nBlockAlign = (recFormat.nChannels * recFormat.wBitsPerSample)/8;
recFormat.nAvgBytesPerSec = (recFormat.nSamplesPerSec *
recFormat.nBlockAlign);


dsrecBufDesc.dwSize = sizeof(DSCBUFFERDESC);
dsrecBufDesc.dwFlags = 0;
dsrecBufDesc.dwBufferBytes = REC_BUF_SIZE;
dsrecBufDesc.lpwfxFormat = &recFormat;
char buf[20];

status = m_lpDirectSoundCapture->CreateCaptureBuffer(&dsrecBufDesc, &
m_lpdsrecBuf, NULL);


Can anyone help me
 
 
 

CreateCaptureBuffer returns error

Post by UmFtZXN » Fri, 24 Jun 2005 21:01:01

hello!
i am having error when i call CreateCaptureBuffer. Before that i have called
DirectSoundCaptureCreate with default device. The default device i hane set
is modem #0 Line record. because i want to capture data from modem.

The code i have used is
HRESULT status = DirectSoundCaptureCreate(NULL, &m_lpDirectSoundCapture,
NULL);
if(status != DS_OK)
{
MessageBox(NULL,"error", "VoiceHandler: DirectSoundCaptureCreate
failed.",0);
return 0;
}

if(status == DS_OK)
{
memset(&dsrecBufDesc, 0, sizeof(DSCBUFFERDESC));
memset(&recFormat, 0, sizeof(WAVEFORMATEX));
recFormat.wFormatTag = WAVE_FORMAT_PCM;
recFormat.nChannels = 1;
recFormat.nSamplesPerSec = 8000;//SAMPLING_RATE;
recFormat.wBitsPerSample = SAMPLE_SIZE * 8;
recFormat.nBlockAlign = (recFormat.nChannels * recFormat.wBitsPerSample)/8;
recFormat.nAvgBytesPerSec = (recFormat.nSamplesPerSec *
recFormat.nBlockAlign);


dsrecBufDesc.dwSize = sizeof(DSCBUFFERDESC);
dsrecBufDesc.dwFlags = 0;
dsrecBufDesc.dwBufferBytes = REC_BUF_SIZE;
dsrecBufDesc.lpwfxFormat = &recFormat;
char buf[20];

status = m_lpDirectSoundCapture->CreateCaptureBuffer(&dsrecBufDesc, &
m_lpdsrecBuf, NULL);


Can anyone help me


By
Ramesh A

 
 
 

CreateCaptureBuffer returns error

Post by Chris P. [ » Fri, 24 Jun 2005 21:29:36


Because of the way voice modems connect in the audio driver stack, they may
not support DirectSound, and definitely don't support automatic resampling.
You should check that the format you are using (8kHz PCM mono) is
explicitly supported by the modem, and also test it using waveIn.
 
 
 

CreateCaptureBuffer returns error

Post by UmFtZXN » Fri, 24 Jun 2005 21:43:02

i can play audio through modem. but in different frequency. will hav any
problem coz of that
 
 
 

CreateCaptureBuffer returns error

Post by Chris P. [ » Fri, 24 Jun 2005 21:53:20


If it's at the same time yes. Most voice modems (except for an expensive
few) are only half duplex, meaning you can either record or playback but
not both at the same time. For the ones that are full duplex, usually the
input and output samplerate have to match.