Refactoring: moved Padding and BlockSize from IAudioDest to AudioEncoderSettings;

This commit is contained in:
Grigory Chudov
2013-04-04 22:07:15 -04:00
parent 1c9e76c421
commit b44e482dee
31 changed files with 255 additions and 550 deletions

View File

@@ -35,11 +35,6 @@ namespace CUETools.Codecs.LAME
}
}
public long Padding
{
set { }
}
public long Position
{
get { return position; }
@@ -50,12 +45,6 @@ namespace CUETools.Codecs.LAME
set { sample_count = (int)value; }
}
public long BlockSize
{
set { }
get { return 0; }
}
public AudioPCMConfig PCM
{
get { return _pcm; }

View File

@@ -7,19 +7,17 @@ namespace CUETools.Codecs.LAME
//[AudioEncoderClass("lame CBR", "mp3", false, 2, typeof(LAMEEncoderCBRSettings))]
public class LAMEEncoderCBR : LAMEEncoder
{
private LAMEEncoderCBRSettings _settings = new LAMEEncoderCBRSettings();
private LAMEEncoderCBRSettings m_settings = new LAMEEncoderCBRSettings();
public override AudioEncoderSettings Settings
{
get
{
return _settings;
return m_settings;
}
set
{
if (value as LAMEEncoderCBRSettings == null)
throw new Exception("Unsupported options " + value);
_settings = value as LAMEEncoderCBRSettings;
m_settings = value.Clone<LAMEEncoderCBRSettings>();
}
}
@@ -35,9 +33,9 @@ namespace CUETools.Codecs.LAME
protected override BE_CONFIG MakeConfig()
{
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, _settings.CustomBitrate > 0 ? (uint)_settings.CustomBitrate : LAMEEncoderCBRSettings.bps_table[_settings.EncoderModeIndex], 5);
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, m_settings.CustomBitrate > 0 ? (uint)m_settings.CustomBitrate : LAMEEncoderCBRSettings.bps_table[m_settings.EncoderModeIndex], 5);
Mp3Config.format.lhv1.bWriteVBRHeader = 1;
Mp3Config.format.lhv1.nMode = _settings.StereoMode;
Mp3Config.format.lhv1.nMode = m_settings.StereoMode;
//Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NONE; // --cbr
//Mp3Config.format.lhv1.nPreset = LAME_QUALITY_PRESET.LQP_NORMAL_QUALITY;
return Mp3Config;

View File

@@ -7,19 +7,17 @@ namespace CUETools.Codecs.LAME
//[AudioEncoderClass("lame VBR", "mp3", false, 2, typeof(LAMEEncoderVBRSettings))]
public class LAMEEncoderVBR : LAMEEncoder
{
private LAMEEncoderVBRSettings _settings = new LAMEEncoderVBRSettings();
private LAMEEncoderVBRSettings m_settings = new LAMEEncoderVBRSettings();
public override AudioEncoderSettings Settings
{
get
{
return _settings;
return m_settings;
}
set
{
if (value as LAMEEncoderVBRSettings == null)
throw new Exception("Unsupported options " + value);
_settings = value as LAMEEncoderVBRSettings;
m_settings = value.Clone<LAMEEncoderVBRSettings>();
}
}
@@ -35,11 +33,11 @@ namespace CUETools.Codecs.LAME
protected override BE_CONFIG MakeConfig()
{
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, 0, (uint)_settings.Quality);
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, 0, (uint)m_settings.Quality);
Mp3Config.format.lhv1.bWriteVBRHeader = 1;
Mp3Config.format.lhv1.nMode = MpegMode.JOINT_STEREO;
Mp3Config.format.lhv1.bEnableVBR = 1;
Mp3Config.format.lhv1.nVBRQuality = 9 - _settings.EncoderModeIndex;
Mp3Config.format.lhv1.nVBRQuality = 9 - m_settings.EncoderModeIndex;
Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NEW; // --vbr-new
return Mp3Config;
}

View File

@@ -58,11 +58,6 @@ namespace CUETools.Codecs.LAME
private uint m_finalSampleCount;
private byte[] m_outputBuffer;
public long BlockSize
{
set { }
}
public long FinalSampleCount
{
set
@@ -80,11 +75,6 @@ namespace CUETools.Codecs.LAME
get { return this.m_pcm; }
}
public long Padding
{
set { }
}
public string Path
{
get { return this.m_outputPath; }
@@ -100,9 +90,7 @@ namespace CUETools.Codecs.LAME
}
set
{
if (value as LameWriterSettings == null)
throw new InvalidOperationException("Unsupported options " + value);
m_settings = value as LameWriterSettings;
m_settings = value.Clone<LameWriterSettings>();
}
}