[Speex-dev] Speex and DS

Rafał Bielec rafal at dial.net.pl
Thu Jun 23 01:58:51 PDT 2005


Hello everyone
I've a following problem with the speex codec. I'm developing application 
that is supposed to read
sounds from the microphone with DirectSoundCapture. Unfortunately when I 
want to compress and decompress
the sound buffer from DirectSound I only have jitter. Maybe you have some 
code samples how to compress
standard DS buffers:
LPDIRECTSOUND8 lpDS = NULL;
LPDIRECTSOUNDCAPTURE8 lpDSC = NULL;
LPDIRECTSOUNDBUFFER8 lpBuf1 = NULL;
LPDIRECTSOUNDCAPTUREBUFFER8 lpBufCap1 = NULL;
copying memory and playing without compression works :
CopyMemory( pDSOutputLockedBuffer,
pDSCaptureLockedBuffer,
dwDSOutputLockedBufferSize );
but anything related to Speex just makes jitter :[.
Please respond, because I'm really stuck on this one :[. I've read the 
sample code in the manual
but and even done a bridge binary file to write buffer to disc drive and to 
reread it like in the manual.
I know the DSound buffers are *void but its a sequence of bytes that should 
be possible to compress.
I use standard 8Khz,16 bit, 1 channel recording.

#define FRAME_SIZE 160

short in[FRAME_SIZE];
int size = dwDSOutputLockedBufferSize;
char* buffer = new char[size];
CopyMemory(   //copying the buffer to an array of bytes
buffer,
pDSCaptureLockedBuffer,
size );


/*Read a 16 bits/sample audio frame*/
memcpy(in,pbuffer,FRAME_SIZE*sizeof(short));
pbuffer+=FRAME_SIZE*sizeof(short);


Thank you for any help
Rafal 




More information about the Speex-dev mailing list