From 9808b8d429dbf8a0c9430b1f60e45a98ce99695d Mon Sep 17 00:00:00 2001 From: John Colket Date: Mon, 17 May 2021 08:41:29 -0400 Subject: [PATCH] Bug 2782 - 8-bit FLAC samples are not imported correctly --- src/import/ImportFLAC.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/import/ImportFLAC.cpp b/src/import/ImportFLAC.cpp index 359c23257..26e41bad2 100644 --- a/src/import/ImportFLAC.cpp +++ b/src/import/ImportFLAC.cpp @@ -245,9 +245,15 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra auto iter = mFile->mChannels.begin(); for (unsigned int chn=0; chnmNumChannels; ++iter, ++chn) { - if (frame->header.bits_per_sample == 16) { - for (unsigned int s=0; sheader.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(),