mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
CUETools.Converter: support multichannel (non-stereo) files
This commit is contained in:
@@ -42,7 +42,7 @@ namespace CUETools.Converter
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
IAudioSource audioSource = AudioReadWrite.GetAudioSource(sourceFile, null, config);
|
IAudioSource audioSource = AudioReadWrite.GetAudioSource(sourceFile, null, config);
|
||||||
IAudioDest audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, audioSource.PCM.BitsPerSample, audioSource.PCM.SampleRate, 8192, config);
|
IAudioDest audioDest = AudioReadWrite.GetAudioDest(AudioEncoderType.Lossless, destFile, (long)audioSource.Length, 8192, audioSource.PCM, config);
|
||||||
AudioBuffer buff = new AudioBuffer(audioSource, 0x10000);
|
AudioBuffer buff = new AudioBuffer(audioSource, 0x10000);
|
||||||
|
|
||||||
Console.WriteLine("Filename : {0}", sourceFile);
|
Console.WriteLine("Filename : {0}", sourceFile);
|
||||||
|
|||||||
@@ -105,16 +105,15 @@ namespace CUETools.Processor
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, long finalSampleCount, int bitsPerSample, int sampleRate, int padding, CUEConfig config)
|
public static IAudioDest GetAudioDest(AudioEncoderType audioEncoderType, string path, long finalSampleCount, int padding, AudioPCMConfig pcm, CUEConfig config)
|
||||||
{
|
{
|
||||||
string extension = Path.GetExtension(path).ToLower();
|
string extension = Path.GetExtension(path).ToLower();
|
||||||
string filename = Path.GetFileNameWithoutExtension(path);
|
string filename = Path.GetFileNameWithoutExtension(path);
|
||||||
AudioPCMConfig pcm = new AudioPCMConfig(bitsPerSample, 2, sampleRate);
|
|
||||||
if (audioEncoderType == AudioEncoderType.NoAudio || audioEncoderType == AudioEncoderType.Lossless || Path.GetExtension(filename).ToLower() != ".lossy")
|
if (audioEncoderType == AudioEncoderType.NoAudio || audioEncoderType == AudioEncoderType.Lossless || Path.GetExtension(filename).ToLower() != ".lossy")
|
||||||
return GetAudioDest(audioEncoderType, path, pcm, finalSampleCount, padding, extension, config);
|
return GetAudioDest(audioEncoderType, path, pcm, finalSampleCount, padding, extension, config);
|
||||||
|
|
||||||
string lwcdfPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lwcdf" + extension);
|
string lwcdfPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(filename) + ".lwcdf" + extension);
|
||||||
AudioPCMConfig lossypcm = new AudioPCMConfig((config.detectHDCD && config.decodeHDCD && !config.decodeHDCDtoLW16) ? 24 : 16, 2, sampleRate);
|
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 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;
|
IAudioDest lwcdfDest = audioEncoderType == AudioEncoderType.Hybrid ? GetAudioDest(AudioEncoderType.Lossless, lwcdfPath, lossypcm, finalSampleCount, padding, extension, config) : null;
|
||||||
return new LossyWAVWriter(lossyDest, lwcdfDest, config.lossyWAVQuality, pcm);
|
return new LossyWAVWriter(lossyDest, lwcdfDest, config.lossyWAVQuality, pcm);
|
||||||
|
|||||||
@@ -3875,9 +3875,10 @@ namespace CUETools.Processor
|
|||||||
|
|
||||||
private IAudioDest GetAudioDest(string path, int finalSampleCount, int bps, int padding, bool noOutput)
|
private IAudioDest GetAudioDest(string path, int finalSampleCount, int bps, int padding, bool noOutput)
|
||||||
{
|
{
|
||||||
|
var pcm = new AudioPCMConfig(bps, 2, 44100);
|
||||||
if (noOutput)
|
if (noOutput)
|
||||||
return new DummyWriter(path, new AudioPCMConfig(bps, 2, 44100));
|
return new DummyWriter(path, pcm);
|
||||||
return AudioReadWrite.GetAudioDest(_audioEncoderType, path, finalSampleCount, bps, 44100, padding, _config);
|
return AudioReadWrite.GetAudioDest(_audioEncoderType, path, finalSampleCount, padding, pcm, _config);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IAudioSource GetAudioSource(int sourceIndex, bool pipe)
|
internal IAudioSource GetAudioSource(int sourceIndex, bool pipe)
|
||||||
|
|||||||
Reference in New Issue
Block a user