From a6ee1bf913abca29b5794adba8108af285d38925 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sat, 28 Mar 2020 09:39:50 -0600 Subject: [PATCH] HLE Audio: Increase frame position by input buffer sample rate (#5049) * HLE Audio: Increase frame position by input buffer sample rate Currently the frame position moves ahead by the number of samples output, but thats a fixed number based on the 3ds native sample rate. Instead, based on a homebrew by cyuubi and looking at the lle audio, this sample position should be moved forward by the number of samples from the input buffer that was read, based on the buffer's sample rate. --- src/audio_core/hle/source.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index c8ee3b618..a4a0f5412 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -289,7 +289,9 @@ void Source::GenerateFrame() { break; } } - state.next_sample_number += static_cast(frame_position); + // TODO(jroweboy): Keep track of frame_position independently so that it doesn't lose precision + // over time + state.next_sample_number += static_cast(frame_position * state.rate_multiplier); state.filters.ProcessFrame(current_frame); }