/// <summary> /// Create a Mp3Writer with specific MP3 format /// </summary> /// <param name="Output">Stream that will hold the MP3 resulting data</param> /// <param name="InputDataFormat">PCM format of input data</param> /// <param name="Mp3Config">Desired MP3 config</param> public Mp3Writer(Stream Output, WaveFormat InputDataFormat, BE_CONFIG Mp3Config) : base(Output, InputDataFormat) { try { m_Mp3Config = Mp3Config; uint LameResult = Lame_encDll.beInitStream(m_Mp3Config, ref m_InputSamples, ref m_OutBufferSize, ref m_hLameStream); if ( LameResult != Lame_encDll.BE_ERR_SUCCESSFUL) { throw new ApplicationException(string.Format("Lame_encDll.beInitStream failed with the error code {0}", LameResult)); } m_InBuffer = new byte[m_InputSamples*2]; //Input buffer is expected as short[] m_OutBuffer = new byte[m_OutBufferSize]; } catch { base.Close(); throw; } }
protected Mp3WriterConfig(SerializationInfo info, StreamingContext context) : base(info, context) { m_BeConfig = (BE_CONFIG)info.GetValue("BE_CONFIG", typeof(BE_CONFIG)); }
public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);
public Mp3WriterConfig(WaveFormat InFormat, BE_CONFIG beconfig) : base(InFormat) { m_BeConfig = beconfig; }