1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Bug 2782 - 8-bit FLAC samples are not imported correctly

This commit is contained in:
John Colket 2021-05-17 08:41:29 -04:00 committed by Panagiotis Vasilopoulos
parent 750e4943f5
commit 9808b8d429
No known key found for this signature in database
GPG Key ID: FD806FDB3B2C5270

View File

@ -245,9 +245,15 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
auto iter = mFile->mChannels.begin();
for (unsigned int chn=0; chn<mFile->mNumChannels; ++iter, ++chn) {
if (frame->header.bits_per_sample == 16) {
for (unsigned int s=0; s<frame->header.blocksize; s++) {
tmp[s]=buffer[chn][s];
if (frame->header.bits_per_sample <= 16) {
if (frame->header.bits_per_sample == 8) {
for (unsigned int s = 0; s < frame->header.blocksize; s++) {
tmp[s] = buffer[chn][s] << 8;
}
} else /* if (frame->header.bits_per_sample == 16) */ {
for (unsigned int s = 0; s < frame->header.blocksize; s++) {
tmp[s] = buffer[chn][s];
}
}
iter->get()->Append((samplePtr)tmp.get(),