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.
This commit is contained in:
James Rowe 2020-03-28 09:39:50 -06:00 committed by GitHub
parent f8d717bc7a
commit a6ee1bf913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,7 +289,9 @@ void Source::GenerateFrame() {
break; break;
} }
} }
state.next_sample_number += static_cast<u32>(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<u32>(frame_position * state.rate_multiplier);
state.filters.ProcessFrame(current_frame); state.filters.ProcessFrame(current_frame);
} }