diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 3845922fbe..88df7c7c53 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -20,12 +20,12 @@ #include "../MemMap.h" #include "SasAudio.h" -static const double f[5][2] = -{ { 0.0, 0.0 }, -{ 60.0 / 64.0, 0.0 }, -{ 115.0 / 64.0, -52.0 / 64.0 }, -{ 98.0 / 64.0, -55.0 / 64.0 }, -{ 122.0 / 64.0, -60.0 / 64.0 } }; +static const s8 f[5][2] = +{ { 0, 0 }, +{ 60, 0 }, +{ 115, -52 }, +{ 98, -55 }, +{ 122, -60 } }; void VagDecoder::Start(u32 data, int vagSize, bool loopEnabled) { loopEnabled_ = loopEnabled; @@ -59,12 +59,12 @@ void VagDecoder::DecodeBlock(u8 *&readp) { for (int i = 0; i < 28; i += 2) { int d = *readp++; int s = (short)((d & 0xf) << 12); - samples[i] = (double)(s >> shift_factor); + samples[i] = s >> shift_factor; s = (short)((d & 0xf0) << 8); - samples[i + 1] = (double)(s >> shift_factor); + samples[i + 1] = s >> shift_factor; } for (int i = 0; i < 28; i++) { - samples[i] = samples[i] + s_1 * f[predict_nr][0] + s_2 * f[predict_nr][1]; + samples[i] = samples[i] + ((s_1 * f[predict_nr][0] + s_2 * f[predict_nr][1]) >> 6); s_2 = s_1; s_1 = samples[i]; } diff --git a/Core/HW/SasAudio.h b/Core/HW/SasAudio.h index 1c204782fa..12df0c09f0 100644 --- a/Core/HW/SasAudio.h +++ b/Core/HW/SasAudio.h @@ -86,7 +86,7 @@ public: bool End() const { return end_; } private: - double samples[28]; + int samples[28]; int curSample; u32 data_; @@ -96,8 +96,8 @@ private: int numBlocks_; // rolling state. start at 0, should probably reset to 0 on loops? - double s_1; - double s_2; + int s_1; + int s_2; bool loopEnabled_; bool loopAtNextBlock_;