mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
WavPackWriter: support multichannel audio, channelMask
This commit is contained in:
@@ -128,7 +128,8 @@ namespace CUETools { namespace Codecs { namespace APE {
|
||||
pcm = gcnew AudioPCMConfig(
|
||||
pAPEDecompress->GetInfo (APE_INFO_BITS_PER_SAMPLE, 0, 0),
|
||||
pAPEDecompress->GetInfo (APE_INFO_CHANNELS, 0, 0),
|
||||
pAPEDecompress->GetInfo (APE_INFO_SAMPLE_RATE, 0, 0));
|
||||
pAPEDecompress->GetInfo (APE_INFO_SAMPLE_RATE, 0, 0),
|
||||
(AudioPCMConfig::SpeakerConfig)0);
|
||||
|
||||
// make a buffer to hold 16384 blocks of audio data
|
||||
nBlockAlign = pAPEDecompress->GetInfo (APE_INFO_BLOCK_ALIGN, 0, 0);
|
||||
|
||||
@@ -360,7 +360,8 @@ namespace CUETools { namespace Codecs { namespace FLAC {
|
||||
pcm = gcnew AudioPCMConfig(
|
||||
metadata->data.stream_info.bits_per_sample,
|
||||
metadata->data.stream_info.channels,
|
||||
metadata->data.stream_info.sample_rate);
|
||||
metadata->data.stream_info.sample_rate,
|
||||
(AudioPCMConfig::SpeakerConfig)0);
|
||||
_sampleCount = metadata->data.stream_info.total_samples;
|
||||
}
|
||||
//if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace TTA {
|
||||
if (WAVE_FORMAT_PCM != _ttaReader->ttahdr.AudioFormat)
|
||||
throw gcnew Exception("floating point format not supported.");
|
||||
|
||||
pcm = gcnew AudioPCMConfig((int)_ttaReader->ttahdr.BitsPerSample, (int)_ttaReader->ttahdr.NumChannels, (int)_ttaReader->ttahdr.SampleRate);
|
||||
pcm = gcnew AudioPCMConfig((int)_ttaReader->ttahdr.BitsPerSample, (int)_ttaReader->ttahdr.NumChannels, (int)_ttaReader->ttahdr.SampleRate, (AudioPCMConfig::SpeakerConfig)0);
|
||||
_sampleCount = _ttaReader->ttahdr.DataLength;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,8 @@ namespace CUETools { namespace Codecs { namespace WavPack {
|
||||
pcm = gcnew AudioPCMConfig(
|
||||
WavpackGetBitsPerSample(_wpc),
|
||||
WavpackGetNumChannels(_wpc),
|
||||
(int)WavpackGetSampleRate(_wpc));
|
||||
(int)WavpackGetSampleRate(_wpc),
|
||||
(AudioPCMConfig::SpeakerConfig)WavpackGetChannelMask(_wpc));
|
||||
_sampleCount = WavpackGetNumSamples(_wpc);
|
||||
_sampleOffset = 0;
|
||||
}
|
||||
@@ -342,8 +343,6 @@ namespace CUETools { namespace Codecs { namespace WavPack {
|
||||
{
|
||||
_settings = settings;
|
||||
|
||||
if (_settings->PCM->ChannelCount != 1 && _settings->PCM->ChannelCount != 2)
|
||||
throw gcnew Exception("Only stereo and mono audio formats are allowed.");
|
||||
if (_settings->PCM->BitsPerSample < 16 || _settings->PCM->BitsPerSample > 24)
|
||||
throw gcnew Exception("Bits per sample must be 16..24.");
|
||||
|
||||
@@ -474,7 +473,7 @@ namespace CUETools { namespace Codecs { namespace WavPack {
|
||||
config.bits_per_sample = _settings->PCM->BitsPerSample;
|
||||
config.bytes_per_sample = (_settings->PCM->BitsPerSample + 7) / 8;
|
||||
config.num_channels = _settings->PCM->ChannelCount;
|
||||
config.channel_mask = 5 - _settings->PCM->ChannelCount;
|
||||
config.channel_mask = (int32_t)_settings->PCM->ChannelMask;
|
||||
config.sample_rate = _settings->PCM->SampleRate;
|
||||
Int32 _compressionMode = _settings->EncoderModeIndex;
|
||||
if (_compressionMode == 0) config.flags |= CONFIG_FAST_FLAG;
|
||||
|
||||
Reference in New Issue
Block a user