mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Removed lossyWAV support from CUETools - it was outdated anyway
This commit is contained in:
@@ -2,7 +2,6 @@ using System;
|
||||
using System.IO;
|
||||
using CUETools.CDImage;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.Codecs.LossyWAV;
|
||||
|
||||
namespace CUETools.Processor
|
||||
{
|
||||
@@ -49,35 +48,14 @@ namespace CUETools.Processor
|
||||
public static IAudioSource GetAudioSource(string path, Stream IO, CUEConfig config)
|
||||
{
|
||||
string extension = Path.GetExtension(path).ToLower();
|
||||
string filename = Path.GetFileNameWithoutExtension(path);
|
||||
string secondExtension = Path.GetExtension(filename).ToLower();
|
||||
if (secondExtension != ".lossy" && secondExtension != ".lwcdf")
|
||||
return GetAudioSource(path, IO, extension, config);
|
||||
|
||||
string lossyPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lossy" + extension);
|
||||
string lwcdfPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lwcdf" + extension);
|
||||
IAudioSource lossySource = GetAudioSource(lossyPath, null, extension, config);
|
||||
IAudioSource lwcdfSource = null;
|
||||
try
|
||||
{
|
||||
lwcdfSource = GetAudioSource(lwcdfPath, null, extension, config);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return lossySource;
|
||||
}
|
||||
return new LossyWAVReader(lossySource, lwcdfSource);
|
||||
return GetAudioSource(path, IO, extension, config);
|
||||
}
|
||||
|
||||
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, AudioPCMConfig pcm, long finalSampleCount, int padding, string extension, CUEConfig config)
|
||||
{
|
||||
IAudioDest dest;
|
||||
if (audioEncoderType == AudioEncoderType.NoAudio || extension == ".dummy")
|
||||
{
|
||||
dest = new DummyWriter(path, new AudioEncoderSettings(pcm));
|
||||
dest.FinalSampleCount = finalSampleCount;
|
||||
return dest;
|
||||
}
|
||||
if (audioEncoderType == AudioEncoderType.NoAudio || extension == ".dummy")
|
||||
return new DummyWriter(path, new AudioEncoderSettings(pcm)) { FinalSampleCount = finalSampleCount };
|
||||
CUEToolsFormat fmt;
|
||||
if (!extension.StartsWith(".") || !config.formats.TryGetValue(extension.Substring(1), out fmt))
|
||||
throw new Exception("Unsupported audio type: " + path);
|
||||
@@ -97,19 +75,5 @@ namespace CUETools.Processor
|
||||
dest.FinalSampleCount = finalSampleCount;
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, long finalSampleCount, int padding, AudioPCMConfig pcm, CUEConfig config)
|
||||
{
|
||||
string extension = Path.GetExtension(path).ToLower();
|
||||
string filename = Path.GetFileNameWithoutExtension(path);
|
||||
if (audioEncoderType == AudioEncoderType.NoAudio || audioEncoderType == AudioEncoderType.Lossless || Path.GetExtension(filename).ToLower() != ".lossy")
|
||||
return GetAudioDest(audioEncoderType, path, pcm, finalSampleCount, padding, extension, config);
|
||||
|
||||
string lwcdfPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lwcdf" + extension);
|
||||
AudioPCMConfig lossypcm = new AudioPCMConfig((config.detectHDCD && config.decodeHDCD && !config.decodeHDCDtoLW16) ? 24 : 16, pcm.ChannelCount, pcm.SampleRate);
|
||||
IAudioDest lossyDest = GetAudioDest(AudioEncoderType.Lossless, path, lossypcm, finalSampleCount, padding, extension, config);
|
||||
IAudioDest lwcdfDest = audioEncoderType == AudioEncoderType.Hybrid ? GetAudioDest(AudioEncoderType.Lossless, lwcdfPath, lossypcm, finalSampleCount, padding, extension, config) : null;
|
||||
return new LossyWAVWriter(lossyDest, lwcdfDest, config.lossyWAVQuality, new AudioEncoderSettings(pcm));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ namespace CUETools.Processor
|
||||
public bool createM3U;
|
||||
public bool createCUEFileWhenEmbedded;
|
||||
public bool truncate4608ExtraSamples;
|
||||
public int lossyWAVQuality;
|
||||
public bool decodeHDCDtoLW16;
|
||||
public bool decodeHDCDto24bit;
|
||||
public bool oneInstance;
|
||||
@@ -122,7 +121,6 @@ namespace CUETools.Processor
|
||||
createM3U = false;
|
||||
createCUEFileWhenEmbedded = true;
|
||||
truncate4608ExtraSamples = true;
|
||||
lossyWAVQuality = 5;
|
||||
decodeHDCDtoLW16 = false;
|
||||
decodeHDCDto24bit = true;
|
||||
|
||||
@@ -187,16 +185,16 @@ namespace CUETools.Processor
|
||||
}
|
||||
|
||||
formats = new Dictionary<string, CUEToolsFormat>();
|
||||
formats.Add("flac", new CUEToolsFormat("flac", CUEToolsTagger.TagLibSharp, true, false, true, true, true, encoders.GetDefault("flac", true), null, decoders.GetDefault("flac", true)));
|
||||
formats.Add("wv", new CUEToolsFormat("wv", CUEToolsTagger.TagLibSharp, true, false, true, true, true, encoders.GetDefault("wv", true), null, decoders.GetDefault("wv", true)));
|
||||
formats.Add("ape", new CUEToolsFormat("ape", CUEToolsTagger.TagLibSharp, true, false, false, true, true, encoders.GetDefault("ape", true), null, decoders.GetDefault("ape", true)));
|
||||
formats.Add("tta", new CUEToolsFormat("tta", CUEToolsTagger.APEv2, true, false, false, false, true, encoders.GetDefault("tta", true), null, decoders.GetDefault("tta", true)));
|
||||
formats.Add("wav", new CUEToolsFormat("wav", CUEToolsTagger.TagLibSharp, true, false, true, false, true, encoders.GetDefault("wav", true), null, decoders.GetDefault("wav", true)));
|
||||
formats.Add("m4a", new CUEToolsFormat("m4a", CUEToolsTagger.TagLibSharp, true, true, false, false, true, encoders.GetDefault("m4a", true), encoders.GetDefault("m4a", false), decoders.GetDefault("m4a", true)));
|
||||
formats.Add("tak", new CUEToolsFormat("tak", CUEToolsTagger.APEv2, true, false, true, true, true, encoders.GetDefault("tak", true), null, decoders.GetDefault("tak", true)));
|
||||
formats.Add("wma", new CUEToolsFormat("wma", CUEToolsTagger.TagLibSharp, true, true, false, false, true, encoders.GetDefault("wma", true), encoders.GetDefault("wma", false), decoders.GetDefault("wma", true)));
|
||||
formats.Add("mp3", new CUEToolsFormat("mp3", CUEToolsTagger.TagLibSharp, false, true, false, false, true, null, encoders.GetDefault("mp3", false), null));
|
||||
formats.Add("ogg", new CUEToolsFormat("ogg", CUEToolsTagger.TagLibSharp, false, true, false, false, true, null, encoders.GetDefault("ogg", false), null));
|
||||
formats.Add("flac", new CUEToolsFormat("flac", CUEToolsTagger.TagLibSharp, true, false, true, true, encoders.GetDefault("flac", true), null, decoders.GetDefault("flac", true)));
|
||||
formats.Add("wv", new CUEToolsFormat("wv", CUEToolsTagger.TagLibSharp, true, false, true, true, encoders.GetDefault("wv", true), null, decoders.GetDefault("wv", true)));
|
||||
formats.Add("ape", new CUEToolsFormat("ape", CUEToolsTagger.TagLibSharp, true, false, true, true, encoders.GetDefault("ape", true), null, decoders.GetDefault("ape", true)));
|
||||
formats.Add("tta", new CUEToolsFormat("tta", CUEToolsTagger.APEv2, true, false, false, true, encoders.GetDefault("tta", true), null, decoders.GetDefault("tta", true)));
|
||||
formats.Add("wav", new CUEToolsFormat("wav", CUEToolsTagger.TagLibSharp, true, false, false, true, encoders.GetDefault("wav", true), null, decoders.GetDefault("wav", true)));
|
||||
formats.Add("m4a", new CUEToolsFormat("m4a", CUEToolsTagger.TagLibSharp, true, true, false, true, encoders.GetDefault("m4a", true), encoders.GetDefault("m4a", false), decoders.GetDefault("m4a", true)));
|
||||
formats.Add("tak", new CUEToolsFormat("tak", CUEToolsTagger.APEv2, true, false, true, true, encoders.GetDefault("tak", true), null, decoders.GetDefault("tak", true)));
|
||||
formats.Add("wma", new CUEToolsFormat("wma", CUEToolsTagger.TagLibSharp, true, true, false, true, encoders.GetDefault("wma", true), encoders.GetDefault("wma", false), decoders.GetDefault("wma", true)));
|
||||
formats.Add("mp3", new CUEToolsFormat("mp3", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encoders.GetDefault("mp3", false), null));
|
||||
formats.Add("ogg", new CUEToolsFormat("ogg", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encoders.GetDefault("ogg", false), null));
|
||||
|
||||
scripts = new Dictionary<string, CUEToolsScript>();
|
||||
scripts.Add("default", new CUEToolsScript("default", true,
|
||||
@@ -296,7 +294,6 @@ return processor.Go();
|
||||
sw.Save("CreateM3U", createM3U);
|
||||
sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded);
|
||||
sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples);
|
||||
sw.Save("LossyWAVQuality", lossyWAVQuality);
|
||||
sw.Save("DecodeHDCDToLossyWAV16", decodeHDCDtoLW16);
|
||||
sw.Save("DecodeHDCDTo24bit", decodeHDCDto24bit);
|
||||
sw.Save("OneInstance", oneInstance);
|
||||
@@ -365,7 +362,6 @@ return processor.Go();
|
||||
sw.Save(string.Format("CustomFormat{0}Tagger", nFormats), (int)format.Value.tagger);
|
||||
sw.Save(string.Format("CustomFormat{0}AllowLossless", nFormats), format.Value.allowLossless);
|
||||
sw.Save(string.Format("CustomFormat{0}AllowLossy", nFormats), format.Value.allowLossy);
|
||||
sw.Save(string.Format("CustomFormat{0}AllowLossyWAV", nFormats), format.Value.allowLossyWAV);
|
||||
sw.Save(string.Format("CustomFormat{0}AllowEmbed", nFormats), format.Value.allowEmbed);
|
||||
nFormats++;
|
||||
}
|
||||
@@ -427,7 +423,6 @@ return processor.Go();
|
||||
createM3U = sr.LoadBoolean("CreateM3U") ?? false;
|
||||
createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? true;
|
||||
truncate4608ExtraSamples = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
|
||||
lossyWAVQuality = sr.LoadInt32("LossyWAVQuality", 0, 10) ?? 5;
|
||||
decodeHDCDtoLW16 = sr.LoadBoolean("DecodeHDCDToLossyWAV16") ?? false;
|
||||
decodeHDCDto24bit = sr.LoadBoolean("DecodeHDCDTo24bit") ?? true;
|
||||
|
||||
@@ -512,7 +507,6 @@ return processor.Go();
|
||||
CUEToolsTagger tagger = (CUEToolsTagger)(sr.LoadInt32(string.Format("CustomFormat{0}Tagger", nFormats), 0, 2) ?? 0);
|
||||
bool allowLossless = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossless", nFormats)) ?? false;
|
||||
bool allowLossy = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossy", nFormats)) ?? false;
|
||||
bool allowLossyWav = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossyWAV", nFormats)) ?? false;
|
||||
bool allowEmbed = sr.LoadBoolean(string.Format("CustomFormat{0}AllowEmbed", nFormats)) ?? false;
|
||||
CUEToolsFormat format;
|
||||
CUEToolsUDC udcLossless, udcLossy, udcDecoder;
|
||||
@@ -523,7 +517,7 @@ return processor.Go();
|
||||
if (decoder == "" || !decoders.TryGetValue(extension, true, decoder, out udcDecoder))
|
||||
udcDecoder = decoders.GetDefault(extension, true);
|
||||
if (!formats.TryGetValue(extension, out format))
|
||||
formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowLossyWav, allowEmbed, false, udcLossless, udcLossy, udcDecoder));
|
||||
formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowEmbed, false, udcLossless, udcLossy, udcDecoder));
|
||||
else
|
||||
{
|
||||
format.encoderLossless = udcLossless;
|
||||
@@ -534,7 +528,6 @@ return processor.Go();
|
||||
format.tagger = tagger;
|
||||
format.allowLossless = allowLossless;
|
||||
format.allowLossy = allowLossy;
|
||||
format.allowLossyWAV = allowLossyWav;
|
||||
format.allowEmbed = allowEmbed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3876,9 +3876,8 @@ namespace CUETools.Processor
|
||||
private IAudioDest GetAudioDest(string path, int finalSampleCount, int bps, int padding, bool noOutput)
|
||||
{
|
||||
var pcm = new AudioPCMConfig(bps, 2, 44100);
|
||||
if (noOutput)
|
||||
return new DummyWriter(path, new AudioEncoderSettings(pcm));
|
||||
return AudioReadWrite.GetAudioDest(_audioEncoderType, path, finalSampleCount, padding, pcm, _config);
|
||||
string extension = Path.GetExtension(path).ToLower();
|
||||
return AudioReadWrite.GetAudioDest(noOutput ? AudioEncoderType.NoAudio : _audioEncoderType, path, pcm, finalSampleCount, padding, extension, _config);
|
||||
}
|
||||
|
||||
internal IAudioSource GetAudioSource(int sourceIndex, bool pipe)
|
||||
|
||||
@@ -140,10 +140,6 @@
|
||||
<Project>{5ADCFD6D-BFEA-4B10-BB45-9083BBB56AF4}</Project>
|
||||
<Name>Freedb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CUETools.Codecs.LossyWAV\CUETools.Codecs.LossyWAV.csproj">
|
||||
<Project>{8A0426FA-0BC2-4C49-A6E5-1F9A68156F19}</Project>
|
||||
<Name>CUETools.Codecs.LossyWAV</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\taglib-sharp\src\taglib-sharp.csproj">
|
||||
<Project>{6B143A39-C7B2-4743-9917-92262C60E9A6}</Project>
|
||||
<Name>taglib-sharp</Name>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
CUEToolsTagger _tagger,
|
||||
bool _allowLossless,
|
||||
bool _allowLossy,
|
||||
bool _allowLossyWAV,
|
||||
bool _allowEmbed,
|
||||
bool _builtin,
|
||||
CUEToolsUDC _encoderLossless,
|
||||
@@ -18,7 +17,6 @@
|
||||
tagger = _tagger;
|
||||
allowLossless = _allowLossless;
|
||||
allowLossy = _allowLossy;
|
||||
allowLossyWAV = _allowLossyWAV;
|
||||
allowEmbed = _allowEmbed;
|
||||
builtin = _builtin;
|
||||
encoderLossless = _encoderLossless;
|
||||
@@ -41,6 +39,6 @@
|
||||
public CUEToolsUDC encoderLossy;
|
||||
public CUEToolsUDC decoder;
|
||||
public CUEToolsTagger tagger;
|
||||
public bool allowLossless, allowLossy, allowLossyWAV, allowEmbed, builtin;
|
||||
public bool allowLossless, allowLossy, allowEmbed, builtin;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user