Ogg Vorbis and Opus: Fix 7.1ch file remapping

File channel remapping was incorrectly only working for 1-7 channel
files, not 8 channel files. Fixed that.

PLEASE NOTE: This will be my last commit and build for over a week, I
promised myself I would stop, and this is the last straw. These are the
last two, I promise. No more bug fixes this week, until at least the 7th
of February. Please, I'm begging you.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2022-01-27 23:04:19 -08:00
parent d239b58ab1
commit 7be0ade7ce
2 changed files with 2 additions and 2 deletions

View file

@ -129,7 +129,7 @@ opus_int64 sourceTell(void *_stream)
int toread = size - total;
if (toread > 512) toread = 512;
numread = op_read_float( opusRef, (channels < MAXCHANNELS) ? tempbuf : out, toread, NULL );
if (numread > 0 && channels < MAXCHANNELS) {
if (numread > 0 && channels <= MAXCHANNELS) {
for (int i = 0; i < numread; ++i) {
for (int j = 0; j < channels; ++j) {
out[i * channels + j] = tempbuf[i * channels + chmap[channels - 1][j]];

View file

@ -106,7 +106,7 @@ long sourceTell(void *datasource)
float ** pcm;
numread = (int)ov_read_float(&vorbisRef, &pcm, frames - total, &currentSection);
if (numread > 0) {
if (channels < MAXCHANNELS) {
if (channels <= MAXCHANNELS) {
for (int i = 0; i < channels; i++) {
for (int j = 0; j < numread; j++) {
((float *)buf)[(total + j) * channels + i] = pcm[chmap[channels-1][i]][j];