Encoding a GSM format using waveInOpen

G

Guest

Hello,

I'm capturing audio from the soundcard, using the waveInXXX calls. I'm
having no problem capturing a PCM stream. Yet, when I try to capture a GSM
compressed stream, I get a failure opening the device (32).

As far as I can tell, I'm doing everything according to Article ID : 153866
(http://support.microsoft.com/default.aspx?scid=kb;en-us;153866#kb2)

Here's the code (as it apperas in a similar question, asked years ago):

[ StructLayout( LayoutKind.Sequential)]
public struct GSM610WAVEFORMAT
{
public WAVEFORMATEX wfx;
public short wSamplesPerBlock;
}


[ StructLayout( LayoutKind.Sequential )]
public struct WAVEFORMATEX
{
public short wFormatTag;
public short nChannels;
public int nSamplesPerSec;
public int nAvgBytesPerSec;
public short nBlockAlign;
public short wBitsPerSample;
public short cbSize;
}


void Record()
{
GSM610WAVEFORMAT gsmwavefmt = new GSM610WAVEFORMAT();
gsmwavefmt.wfx.wFormatTag = 49;
gsmwavefmt.wfx.nChannels = 1;
gsmwavefmt.wfx.nSamplesPerSec = 8000;
gsmwavefmt.wfx.nAvgBytesPerSec = 1625;
gsmwavefmt.wfx.nBlockAlign = 65;
gsmwavefmt.wfx.wBitsPerSample = 0;
gsmwavefmt.wfx.cbSize = 2;
gsmwavefmt.wSamplesPerBlock = 320;

//returns 32
int ret = waveInOpen(ref pWaveIn, WAVE_MAPPER, ref
((WAVEFORMATEX) pgsmwavefmt.wfx), (IntPtr) 0, 0, 0);
}


I would greatly appreciate any help regarding that matter. I'm really
puzzled...

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top