Well, after banging my head against the wall for days, I finally cracked it.
I ended up breaking the OpenNetCF code for all other uncompressed audio
formats, but I didn't need them. Anyway, if you are interested in using
this GSM6.10 format you'll have to get the OpenNetCF 2.0 source code and
make the following changes. I'll probably miss some details, so if you are
interested in the code, email me.
In WaveFormat2.cs
Add the property:
public Int16 SamplesPerBlock;
Add this line to GetBytes
BitConverter.GetBytes(SamplesPerBlock).CopyTo(data, 18);
In Chunks.cs
Change occurances of "18" to "20"
In Recorder.cs
Set the following properties:
m_recformat.Channels = 1;
m_recformat.SamplesPerSec = 8000;
m_recformat.BitsPerSample = 0;
m_recformat.FormatTag = WAVE_FORMAT_GSM610;
m_recformat.BlockAlign = 65;
m_recformat.AvgBytesPerSec = 1625;
m_recformat.Size = 2;
m_recformat.SamplesPerBlock = 320;
comment out:
//CheckWaveError(NativeMethods.waveInOpen(out m_hWaveIn, WAVE_MAPPER,
m_recformat, IntPtr.Zero, 0, WAVE_FORMAT_QUERY));
And add the WAVE_MAPPED flag here - this one was the ticket:
CheckWaveError(NativeMethods.waveInOpen(out m_hWaveIn, (uint)m_deviceID,
m_recformat, m_recmw.Hwnd, 0, CALLBACK_WINDOW | WAVE_MAPPED));
comment out: (not sure the original purpose of this)
//for ( int i = 0; i < 2; i ++ )
In Audio.cs
Add the SoundFormat:
Mono8bit8kHzGSM = 0x1000
And add the constants:
internal const int WAVE_FORMAT_GSM610 = 0x0031;
internal const int WAVE_MAPPED = 0x0004;
In Player.cs
Change this line to add the WAVE_MAPPED flag:
CheckWaveError(NativeMethods.waveOutOpen(out m_hWaveOut, m_deviceID,
m_format, ((SoundMessageWindow)m_mwArray).Hwnd, 0, CALLBACK_WINDOW |
WAVE_MAPPED));
If you want to record to a memory stream instead of a file stream, you'll
have to comment out:
m_streamRecord.Close();
In Recorder.cs or check what kind of stream it is before closing.
I'm not sure what else this will break - I only tested recording and
playing.
Enjoy,
Dave