From 7b924477c881434f7c0d1ee9ab38b540664c556a Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 29 Jul 2017 14:07:44 -0700 Subject: [PATCH] Fixes Issue #110: playback speed wrong. Turns out the channel count wasn't always being properly propagated through the system. --- src/core/audio/Stream.cpp | 1 + src/plugins/nomaddecoder/NomadDecoder.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/audio/Stream.cpp b/src/core/audio/Stream.cpp index ef65d38d6..e41dcf7ac 100644 --- a/src/core/audio/Stream.cpp +++ b/src/core/audio/Stream.cpp @@ -181,6 +181,7 @@ bool Stream::GetNextBufferFromDecoder() { for (int i = 0; i < bufferCount; i++) { auto buffer = new Buffer(this->rawBuffer + offset, samplesPerBuffer); buffer->SetSampleRate(this->decoderSampleRate); + buffer->SetChannels(this->decoderChannels); this->recycledBuffers.push_back(buffer); offset += samplesPerBuffer; } diff --git a/src/plugins/nomaddecoder/NomadDecoder.cpp b/src/plugins/nomaddecoder/NomadDecoder.cpp index 6ecc7ef40..76fea4bf5 100644 --- a/src/plugins/nomaddecoder/NomadDecoder.cpp +++ b/src/plugins/nomaddecoder/NomadDecoder.cpp @@ -113,8 +113,10 @@ bool NomadDecoder::GetBuffer(IBuffer *buffer) { DEFAULT_READ_SAMPLE_SIZE, SAMPLE_FORMAT_32_BIT_FLOAT); + auto info = nomad_info(this->nomadContext); + buffer->SetChannels(info->channels); buffer->SetSamples(read > 0 ? read : 0); - buffer->SetSampleRate(nomad_info(this->nomadContext)->sample_rate); + buffer->SetSampleRate(info->sample_rate); return (read > 0) ? true : false; }