Whoops - fix overflowing on output audio samples

This commit is contained in:
Dr. Chat 2015-06-02 13:17:15 -05:00
parent 45d3f4f886
commit 50d8017ac5
1 changed files with 1 additions and 1 deletions

View File

@ -206,7 +206,7 @@ int AudioDecoder::DecodePacket(uint8_t *output, size_t output_offset,
float raw_sample = xe::saturate(sample_array[i]); float raw_sample = xe::saturate(sample_array[i]);
// Convert the sample and output it in big endian. // 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<int>(scaled_sample); int sample = static_cast<int>(scaled_sample);
xe::store_and_swap<uint16_t>(&current_frame_[o++ * 2], xe::store_and_swap<uint16_t>(&current_frame_[o++ * 2],
sample & 0xFFFF); sample & 0xFFFF);