ALAC encoder

This commit is contained in:
chudov
2009-08-30 21:58:54 +00:00
parent 2b7312e261
commit 5e37052bc1
18 changed files with 2225 additions and 259 deletions

View File

@@ -45,28 +45,7 @@ namespace CUETools.Converter
#endif
{
IAudioSource audioSource = AudioReadWrite.GetAudioSource(sourceFile, null, config);
IAudioDest audioDest;
FlakeWriter flake = null;
if (destFile == "$flaketest$")
{
flake = new FlakeWriter("", audioSource.BitsPerSample, audioSource.ChannelCount, audioSource.SampleRate, new NullStream());
//((FlakeWriter)audioDest).CompressionLevel = 6;
flake.PredictionType = Flake.LookupPredictionType(args[2]);
flake.StereoMethod = Flake.LookupStereoMethod(args[3]);
flake.OrderMethod = Flake.LookupOrderMethod(args[4]);
flake.WindowFunction = Flake.LookupWindowFunction(args[5]);
flake.MinPartitionOrder = Int32.Parse(args[6]);
flake.MaxPartitionOrder = Int32.Parse(args[7]);
flake.MinLPCOrder = Int32.Parse(args[8]);
flake.MaxLPCOrder = Int32.Parse(args[9]);
flake.MinFixedOrder = Int32.Parse(args[10]);
flake.MaxFixedOrder = Int32.Parse(args[11]);
flake.MaxPrecisionSearch = Int32.Parse(args[12]);
flake.BlockSize = Int32.Parse(args[13]);
audioDest = new BufferedWriter(flake, 512 * 1024);
}
else
audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, audioSource.BitsPerSample, audioSource.SampleRate, 8192, config);
IAudioDest audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, audioSource.BitsPerSample, audioSource.SampleRate, 8192, config);
int[,] buff = new int[0x4000, audioSource.ChannelCount];
Console.WriteLine("Filename : {0}", sourceFile);
@@ -99,39 +78,14 @@ namespace CUETools.Converter
audioSource.Close();
audioDest.Close();
if (destFile != "$flaketest$")
TagLib.UserDefined.AdditionalFileTypes.Config = config;
TagLib.File sourceInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(sourceFile));
TagLib.File destInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(destFile));
if (Tagging.UpdateTags(destInfo, Tagging.Analyze(sourceInfo), config))
{
TagLib.UserDefined.AdditionalFileTypes.Config = config;
TagLib.File sourceInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(sourceFile));
TagLib.File destInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(destFile));
if (Tagging.UpdateTags(destInfo, Tagging.Analyze(sourceInfo), config))
{
sourceInfo.Tag.CopyTo(destInfo.Tag, true);
destInfo.Tag.Pictures = sourceInfo.Tag.Pictures;
destInfo.Save();
}
}
else
{
Console.SetOut(stdout);
//Console.Out.WriteLine("{0}\t{6}\t{1}\t{2}\t{3}\t{4}\t{5}",
// "Size ", "MaxPart", "MaxPred", "Pred ", "Stereo", "Order", "Time ");
Console.Out.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}..{7}\t{8}..{9}\t{10}..{11}\t{12}\t{13}",
flake.TotalSize,
flake.UserProcessorTime.TotalSeconds,
flake.PredictionType.ToString().PadRight(15),
flake.StereoMethod.ToString().PadRight(15),
flake.OrderMethod.ToString().PadRight(15),
flake.WindowFunction,
flake.MinPartitionOrder,
flake.MaxPartitionOrder,
flake.MinLPCOrder,
flake.MaxLPCOrder,
flake.MinFixedOrder,
flake.MaxFixedOrder,
flake.MaxPrecisionSearch,
flake.BlockSize
);
sourceInfo.Tag.CopyTo(destInfo.Tag, true);
destInfo.Tag.Pictures = sourceInfo.Tag.Pictures;
destInfo.Save();
}
}
#if !DEBUG