/// <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 = LameEnc.beInitStream(m_Mp3Config, ref m_InputSamples, ref m_OutBufferSize, ref m_hLameStream); if (lameResult != LameEnc.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; } }
/// <summary> /// This function is the first to call before starting an encoding stream. /// </summary> /// <param name="pbeConfig">Encoder settings</param> /// <param name="dwSamples">Receives the number of samples (not bytes, each sample is a SHORT) to send to each beEncodeChunk() on return.</param> /// <param name="dwBufferSize">Receives the minimun number of bytes that must have the output(result) buffer</param> /// <param name="phbeStream">Receives the stream handle on return</param> /// <returns>On success: BE_ERR_SUCCESSFUL</returns> public static uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream) { return CPU.Is32Bit ? Lame86.beInitStream(pbeConfig, ref dwSamples, ref dwBufferSize, ref phbeStream) : Lame64.beInitStream(pbeConfig, ref dwSamples, ref dwBufferSize, ref phbeStream); }
public EditMp3Writer() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); m_Config = new BE_CONFIG(editFormat1.Format); DoSetInitialValues(); }
internal static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);
/// <summary> /// This function is the first to call before starting an encoding stream. /// </summary> /// <param name="pbeConfig">Encoder settings</param> /// <param name="dwSamples">Receives the number of samples (not bytes, each sample is a SHORT) to send to each beEncodeChunk() on return.</param> /// <param name="dwBufferSize">Receives the minimun number of bytes that must have the output(result) buffer</param> /// <param name="phbeStream">Receives the stream handle on return</param> /// <returns>On success: BE_ERR_SUCCESSFUL</returns> public static uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream) { return(CPU.Is32Bit ? Lame86.beInitStream(pbeConfig, ref dwSamples, ref dwBufferSize, ref phbeStream) : Lame64.beInitStream(pbeConfig, ref dwSamples, ref dwBufferSize, ref phbeStream)); }
protected Mp3WriterConfig(SerializationInfo info, StreamingContext context) : base(info, context) { m_BeConfig = (BE_CONFIG)info.GetValue("BE_CONFIG", typeof(BE_CONFIG)); }
public Mp3WriterConfig(WaveFormat InFormat, BE_CONFIG beconfig) : base(InFormat) { m_BeConfig = beconfig; }