From 50d8017ac55f31ebd588bf13126386b74818a40b Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Tue, 2 Jun 2015 13:17:15 -0500 Subject: [PATCH] Whoops - fix overflowing on output audio samples --- src/xenia/apu/audio_decoder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/apu/audio_decoder.cc b/src/xenia/apu/audio_decoder.cc index a8f6d94c4..5d0830fd5 100644 --- a/src/xenia/apu/audio_decoder.cc +++ b/src/xenia/apu/audio_decoder.cc @@ -206,7 +206,7 @@ int AudioDecoder::DecodePacket(uint8_t *output, size_t output_offset, float raw_sample = xe::saturate(sample_array[i]); // Convert the sample and output it in big endian. - float scaled_sample = raw_sample * (1 << 15); + float scaled_sample = raw_sample * ((1 << 15) - 1); int sample = static_cast(scaled_sample); xe::store_and_swap(¤t_frame_[o++ * 2], sample & 0xFFFF);