2011-10-24 08:42:30 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using CUETools.Codecs.LAME.Interop;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CUETools.Codecs.LAME
|
|
|
|
|
|
{
|
2013-04-01 23:03:22 -04:00
|
|
|
|
//[AudioEncoderClass("lame CBR", "mp3", false, 2, typeof(LAMEEncoderCBRSettings))]
|
2011-10-24 08:42:30 +00:00
|
|
|
|
public class LAMEEncoderCBR : LAMEEncoder
|
|
|
|
|
|
{
|
2013-04-04 22:07:15 -04:00
|
|
|
|
private LAMEEncoderCBRSettings m_settings = new LAMEEncoderCBRSettings();
|
2011-10-24 08:42:30 +00:00
|
|
|
|
|
2013-04-01 23:03:22 -04:00
|
|
|
|
public override AudioEncoderSettings Settings
|
2011-10-24 08:42:30 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2013-04-04 22:07:15 -04:00
|
|
|
|
return m_settings;
|
2011-10-24 08:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
2013-04-04 22:07:15 -04:00
|
|
|
|
m_settings = value.Clone<LAMEEncoderCBRSettings>();
|
2011-10-24 08:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LAMEEncoderCBR(string path, Stream IO, AudioPCMConfig pcm)
|
|
|
|
|
|
: base(path, IO, pcm)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LAMEEncoderCBR(string path, AudioPCMConfig pcm)
|
|
|
|
|
|
: base(path, null, pcm)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override BE_CONFIG MakeConfig()
|
|
|
|
|
|
{
|
2013-04-04 22:07:15 -04:00
|
|
|
|
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, m_settings.CustomBitrate > 0 ? (uint)m_settings.CustomBitrate : LAMEEncoderCBRSettings.bps_table[m_settings.EncoderModeIndex], 5);
|
2011-10-24 08:42:30 +00:00
|
|
|
|
Mp3Config.format.lhv1.bWriteVBRHeader = 1;
|
2013-04-04 22:07:15 -04:00
|
|
|
|
Mp3Config.format.lhv1.nMode = m_settings.StereoMode;
|
2011-10-24 08:42:30 +00:00
|
|
|
|
//Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NONE; // --cbr
|
|
|
|
|
|
//Mp3Config.format.lhv1.nPreset = LAME_QUALITY_PRESET.LQP_NORMAL_QUALITY;
|
|
|
|
|
|
return Mp3Config;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|