WavPackWriter: support multichannel audio, channelMask

This commit is contained in:
Grigory Chudov
2013-04-14 17:17:47 -04:00
parent 563f066646
commit e480b1612e
4 changed files with 8 additions and 7 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;