Fixes Issue #110: playback speed wrong. Turns out the channel count

wasn't always being properly propagated through the system.
This commit is contained in:
casey langen 2017-07-29 14:07:44 -07:00
parent 3d6a3d93e0
commit 7b924477c8
2 changed files with 4 additions and 1 deletions

View File

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

View File

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