Recording Wave



I am using iMX31 PDK board and using Windows CE6.0. I am working on wave
recording. The is a demo recoding executable file (waverec.exe). When I am
trying to run this exe , WaveInOpen() returns 0x00000020 which indicates
bad wave format.

Settings are given below (it was already provided in the source waverec.cpp
located in ..\WINCE600\PUBLIC\COMMON\SDK\SAMPLES\WAVEREC\waverec.cpp)

DWORD dwChannels = 1; // default to mono
DWORD dwBitsPerSample = 16; // default to 16-bit samples
DWORD dwSampleRate = 11025; // default to 11.025KHz sample rate
DWORD dwDeviceId = WAVE_MAPPER;

WAVEFORMATEX wfx;
wfx.cbSize = 0;
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.wBitsPerSample = (WORD) dwBitsPerSample;
wfx.nSamplesPerSec = dwSampleRate;
wfx.nChannels = (WORD) dwChannels;
wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8;
wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;



Please help me.


.