From 622ff2a8f18937cb94e64568522d4726c4d280a4 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Tue, 10 May 2022 18:26:20 +0100 Subject: [PATCH] Correctly track 5.1 audio channel sample count Size needs to be adjusted for 5.1 buffers since they're downsampled to stereo. --- app/src/main/cpp/skyline/audio/track.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/audio/track.cpp b/app/src/main/cpp/skyline/audio/track.cpp index 54959df8..30142a9e 100644 --- a/app/src/main/cpp/skyline/audio/track.cpp +++ b/app/src/main/cpp/skyline/audio/track.cpp @@ -58,10 +58,11 @@ namespace skyline::audio { void AudioTrack::AppendBuffer(u64 tag, span buffer) { std::scoped_lock lock(bufferLock); + size_t size{(channelCount == constant::SurroundChannelCount) ? (buffer.size() / sizeof(Surround51Sample)) * sizeof(StereoSample) : buffer.size()}; BufferIdentifier identifier{ .released = false, .tag = tag, - .finalSample = identifiers.empty() ? (buffer.size()) : (buffer.size() + identifiers.front().finalSample) + .finalSample = identifiers.empty() ? size : (size + identifiers.front().finalSample) }; identifiers.push_front(identifier);