Correctly track 5.1 audio channel sample count

Size needs to be adjusted for 5.1 buffers since they're downsampled to stereo.
This commit is contained in:
Billy Laws 2022-05-10 18:26:20 +01:00
parent 56c9b03843
commit 622ff2a8f1

View File

@ -58,10 +58,11 @@ namespace skyline::audio {
void AudioTrack::AppendBuffer(u64 tag, span<i16> 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);