audio_core: interpolate: Pad input with zeros, the algorithm reads past on final frame.

- Fixes audio crackling in Crash Team Racing Nitro-Fueled.
This commit is contained in:
bunnei
2020-02-22 01:56:38 -05:00
parent 19bce3685a
commit 8f6f7a5136

View File

@@ -162,6 +162,11 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
std::vector<s16> output(static_cast<std::size_t>(input.size() / ratio));
int in_offset = 0;
// Pad the end with zeros, as the below algorithm reads a frame past the buffer on the final
// iteration. Fixes audio crackling in Crash Team Racing Nitro-Fueled.
input.resize(input.size() + 32);
for (std::size_t out_offset = 0; out_offset < output.size(); out_offset += 2) {
const int lut_index = (state.fraction >> 8) * 4;