Cleanup IAudioDest; CompressionLevel is now part of AudioEncoderSettings.

FLAC encoders no longer offer non-subset compression levels by default.
This commit is contained in:
Grigory Chudov
2013-04-01 23:03:22 -04:00
parent 773c6d63fa
commit 9dd4897acc
44 changed files with 374 additions and 524 deletions

View File

@@ -4,15 +4,12 @@ using CUETools.Codecs.LAME.Interop;
namespace CUETools.Codecs.LAME
{
//[AudioEncoderClass("lame CBR", "mp3", false, "96 128 192 256 320", "256", 2, typeof(LAMEEncoderCBRSettings))]
//[AudioEncoderClass("lame CBR", "mp3", false, 2, typeof(LAMEEncoderCBRSettings))]
public class LAMEEncoderCBR : LAMEEncoder
{
private static readonly uint[] bps_table = new uint[] { 96, 128, 192, 256, 320 };
private uint bps;
private LAMEEncoderCBRSettings _settings = new LAMEEncoderCBRSettings();
public override object Settings
public override AudioEncoderSettings Settings
{
get
{
@@ -26,27 +23,6 @@ namespace CUETools.Codecs.LAME
}
}
public override int CompressionLevel
{
get
{
for (int i = 0; i < bps_table.Length; i++)
{
if (bps == bps_table[i])
{
return i;
}
}
return -1;
}
set
{
if (value < 0 || value > bps_table.Length)
throw new Exception("unsupported compression level");
bps = bps_table[value];
}
}
public LAMEEncoderCBR(string path, Stream IO, AudioPCMConfig pcm)
: base(path, IO, pcm)
{
@@ -59,7 +35,7 @@ namespace CUETools.Codecs.LAME
protected override BE_CONFIG MakeConfig()
{
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, _settings.CustomBitrate > 0 ? (uint)_settings.CustomBitrate : bps, 5);
BE_CONFIG Mp3Config = new BE_CONFIG(PCM, _settings.CustomBitrate > 0 ? (uint)_settings.CustomBitrate : LAMEEncoderCBRSettings.bps_table[_settings.EncoderModeIndex], 5);
Mp3Config.format.lhv1.bWriteVBRHeader = 1;
Mp3Config.format.lhv1.nMode = _settings.StereoMode;
//Mp3Config.format.lhv1.nVbrMethod = VBRMETHOD.VBR_METHOD_NONE; // --cbr