protected override BE_CONFIG MakeConfig() { BE_CONFIG Mp3Config = new BE_CONFIG(PCM, _settings.CustomBitrate > 0 ? (uint)_settings.CustomBitrate : bps, 5); Mp3Config.format.lhv1.bWriteVBRHeader = 1; Mp3Config.format.lhv1.nMode = _settings.StereoMode; //Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NONE; // --cbr //Mp3Config.format.lhv1.nPreset = LAME_QUALITY_PRESET.LQP_NORMAL_QUALITY; return Mp3Config; }
protected override BE_CONFIG MakeConfig() { BE_CONFIG Mp3Config = new BE_CONFIG(PCM, 0, (uint)_settings.Quality); Mp3Config.format.lhv1.bWriteVBRHeader = 1; Mp3Config.format.lhv1.nMode = MpegMode.JOINT_STEREO; Mp3Config.format.lhv1.bEnableVBR = 1; Mp3Config.format.lhv1.nVBRQuality = quality; Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NEW; // --vbr-new return Mp3Config; }
public static extern uint beInitStream(BE_CONFIG pbeConfig, ref uint dwSamples, ref uint dwBufferSize, ref uint phbeStream);
private void Init() { if (inited) return; m_Mp3Config = MakeConfig(); 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[Math.Max(65536, m_OutBufferSize)]; if (_IO == null) _IO = new FileStream(_path, FileMode.Create, FileAccess.Write, FileShare.Read); inited = true; }