private TypeCode GetSampleTypeCode()
{
// Determine sample data type based on bit size and audio format
switch (m_waveIn.WaveFormat.BitsPerSample)
{
case 8:
return TypeCode.Byte;
case 16:
return TypeCode.Int16;
case 24:
// .NET does not define an Int24 type code and since an Int24 will
// fit inside an Int32, the Int32 type code is returned.
return TypeCode.Int32;
case 32:
if (m_waveIn.WaveFormat.Encoding == WaveFormatEncoding.IeeeFloat)
return TypeCode.Single;
return TypeCode.Int32;
case 64:
if (m_waveIn.WaveFormat.Encoding == WaveFormatEncoding.IeeeFloat)
return TypeCode.Double;
return TypeCode.Int64;
default:
// Unable to determine proper type code, consumer may be using a special data format...
return TypeCode.Empty;
}
}