Exemplo n.º 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;
       }
 }
Exemplo n.º 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;
       }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 5
0
 public Mp3WriterConfig(WaveFormat InFormat, BE_CONFIG beconfig)
     : base(InFormat)
 {
     m_BeConfig = beconfig;
 }
Exemplo n.º 6
0
 protected Mp3WriterConfig(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     m_BeConfig = (BE_CONFIG)info.GetValue("BE_CONFIG", typeof(BE_CONFIG));
 }
Exemplo n.º 7
0
 public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);
Exemplo n.º 8
0
 protected Mp3WriterConfig(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     m_BeConfig = (BE_CONFIG)info.GetValue("BE_CONFIG", typeof(BE_CONFIG));
 }
Exemplo n.º 9
0
 public Mp3WriterConfig(WaveFormat InFormat, BE_CONFIG beconfig)
     : base(InFormat)
 {
     m_BeConfig = beconfig;
 }
Exemplo n.º 10
0
 public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);