Exemple #1
0
 /// <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, bool isStreamOwner)
     : base(Output, InputDataFormat)
 {
     IsStreamOwner = isStreamOwner;
       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
       {
     CloseStream();
     throw;
       }
 }
Exemple #2
0
 /// <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>
 /// <param name="isStreamOwner"> </param>
 public Mp3Writer(Stream output, WaveFormat inputDataFormat, BE_CONFIG mp3Config, bool isStreamOwner)
     : base(output, inputDataFormat)
 {
     IsStreamOwner = isStreamOwner;
       try
       {
     _mMp3Config = mp3Config;
     uint lameResult = Lame_encDll.beInitStream(_mMp3Config, ref _mInputSamples, ref _mOutBufferSize, ref _mHLameStream);
     if ( lameResult != Lame_encDll.BE_ERR_SUCCESSFUL)
     {
       throw new ApplicationException(string.Format("Lame_encDll.beInitStream failed with the error code {0}", lameResult));
     }
     _mInBuffer = new byte[_mInputSamples*2]; //Input buffer is expected as short[]
     _mOutBuffer = new byte[_mOutBufferSize];
       }
       catch
       {
     CloseStream();
     throw;
       }
 }
Exemple #3
0
 /// <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>
 /// <param name="isStreamOwner"> </param>
 public Mp3Writer(Stream output, WaveFormat inputDataFormat, BE_CONFIG mp3Config, bool isStreamOwner)
     : base(output, inputDataFormat)
 {
     IsStreamOwner = isStreamOwner;
     try
     {
         _mMp3Config = mp3Config;
         uint lameResult = Lame_encDll.beInitStream(_mMp3Config, ref _mInputSamples, ref _mOutBufferSize, ref _mHLameStream);
         if (lameResult != Lame_encDll.BE_ERR_SUCCESSFUL)
         {
             throw new ApplicationException(string.Format("Lame_encDll.beInitStream failed with the error code {0}", lameResult));
         }
         _mInBuffer  = new byte[_mInputSamples * 2]; //Input buffer is expected as short[]
         _mOutBuffer = new byte[_mOutBufferSize];
     }
     catch
     {
         CloseStream();
         throw;
     }
 }
Exemple #4
0
 /// <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, bool isStreamOwner)
     : base(Output, InputDataFormat)
 {
     IsStreamOwner = isStreamOwner;
     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
     {
         CloseStream();
         throw;
     }
 }
 public Mp3WriterConfig(WaveFormat InFormat, BE_CONFIG beconfig)
     : base(InFormat)
 {
     m_BeConfig = beconfig;
 }
 protected Mp3WriterConfig(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     m_BeConfig = (BE_CONFIG)info.GetValue("BE_CONFIG", typeof(BE_CONFIG));
 }
Exemple #7
0
 public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint 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;
 }
Exemple #10
0
 public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);