C# wav转mp3,网上下的MP3Compressor,老是格式不通过,请教下有没有知道原因的或做过的?谢谢
现在抛出Unsupported sample rate异常//public byte[] btReserved;//[255-4*sizeof(DWORD) - sizeof( WORD )];
public LHV1(WaveFormat format, uint MpeBitRate)
{
if ( format.wFormatTag != (short)WaveFormats.Pcm )
{
throw new ArgumentOutOfRangeException("format", "Only PCM format supported");
}
if ( format.wBitsPerSample != 16)
{
throw new ArgumentOutOfRangeException("format", "Only 16 bits samples supported");
}
dwStructVersion = 1;
dwStructSize = (uint)Marshal.SizeOf(typeof(BE_CONFIG));
switch (format.nSamplesPerSec)
{
case 16000 :
case 22050 :
case 24000 :
dwMpegVersion = MPEG2;
break;
case 32000 :
case 44100 :
case 48000 :
dwMpegVersion = MPEG1;
break;
default:
throw new ArgumentOutOfRangeException("format", "Unsupported sample rate");
}
现在抛出Unsupported sample rate异常//public byte[] btReserved;//[255-4*sizeof(DWORD) - sizeof( WORD )];
public LHV1(WaveFormat format, uint MpeBitRate)
{
if ( format.wFormatTag != (short)WaveFormats.Pcm )
{
throw new ArgumentOutOfRangeException("format", "Only PCM format supported");
}
if ( format.wBitsPerSample != 16)
{
throw new ArgumentOutOfRangeException("format", "Only 16 bits samples supported");
}
dwStructVersion = 1;
dwStructSize = (uint)Marshal.SizeOf(typeof(BE_CONFIG));
switch (format.nSamplesPerSec)
{
case 16000 :
case 22050 :
case 24000 :
dwMpegVersion = MPEG2;
break;
case 32000 :
case 44100 :
case 48000 :
dwMpegVersion = MPEG1;
break;
default:
throw new ArgumentOutOfRangeException("format", "Unsupported sample rate");
}
我看微软的msdn上不止你列的那些。
http://msdn.microsoft.com/en-us/library/aa908934.aspx