/// <summary> /// Initializes a new instance of the <see cref="Lame"/> class. /// </summary> /// <param name="settings">The encoding settings.</param> public Lame(MP3_Settings settings, int Channels, int SampleRate) { SOUND_INFO info = new SOUND_INFO(); info.format = 0x010002; info.samplerate = SampleRate; info.channels = Channels; LAME_CONFIG mp3config = new LAME_CONFIG(info, settings); if (beInitStream(mp3config, ref Samples, ref outputBufferSize, ref StreamHandle) != LAME_ERR_SUCCESSFUL) throw new Exception("Failed to initialize lame!"); optimalBufferSize = 2 * (int)Samples; InputBuffer = new byte[optimalBufferSize]; OutputBuffer = new byte[OutputBufferSize]; }
/// <summary> /// Initializes a new instance of the <see cref="Lame"/> class. /// </summary> /// <param name="InputWaveFile">The input wave file.</param> /// <param name="settings">The encoding settings.</param> public Lame(string InputWaveFile, MP3_Settings settings) { inputWaveFile = InputWaveFile; SOUND_INFO info = new SOUND_INFO(); GetSoundFileInfo(InputWaveFile, ref info); LAME_CONFIG mp3config = new LAME_CONFIG(info, settings); if (beInitStream(mp3config, ref Samples, ref outputBufferSize, ref StreamHandle) != LAME_ERR_SUCCESSFUL) throw new Exception("Failed to initialize lame!"); optimalBufferSize = 2 * (int)Samples; InputBuffer = new byte[optimalBufferSize]; OutputBuffer = new byte[OutputBufferSize]; }