diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index eb9731538e..4cec6c0f21 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -263,7 +263,7 @@ union XA_ADPCMBlockHeader u8 bits; BitField shift; - BitField filter; + BitField filter; // For both 4bit and 8bit ADPCM, reserved shift values 13..15 will act same as shift=9). u8 GetShift() const @@ -3415,11 +3415,8 @@ s16 CDROM::SaturateVolume(s32 volume) template void CDROM::DecodeXAADPCMChunks(const u8* chunk_ptr, s16* samples) { - static constexpr std::array s_xa_adpcm_filter_table_pos = { - {0, 60, 115, 98, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; - - static constexpr std::array s_xa_adpcm_filter_table_neg = { - {0, 0, -52, -55, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + static constexpr std::array filter_table_pos = {{0, 60, 115, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + static constexpr std::array filter_table_neg = {{0, 0, -52, -55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; // The data layout is annoying here. Each word of data is interleaved with the other blocks, requiring multiple // passes to decode the whole chunk. @@ -3440,8 +3437,8 @@ void CDROM::DecodeXAADPCMChunks(const u8* chunk_ptr, s16* samples) const XA_ADPCMBlockHeader block_header{headers_ptr[block]}; const u8 shift = block_header.GetShift(); const u8 filter = block_header.GetFilter(); - const s32 filter_pos = s_xa_adpcm_filter_table_pos[filter]; - const s32 filter_neg = s_xa_adpcm_filter_table_neg[filter]; + const s32 filter_pos = filter_table_pos[filter]; + const s32 filter_neg = filter_table_neg[filter]; s16* out_samples_ptr = IS_STEREO ? &samples[(block / 2) * (WORDS_PER_BLOCK * 2) + (block % 2)] : &samples[block * WORDS_PER_BLOCK]; diff --git a/src/core/spu.cpp b/src/core/spu.cpp index f24c8c8b2c..7d488d0d92 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -189,7 +189,7 @@ struct ADPCMBlock u8 bits; BitField shift; - BitField filter; + BitField filter; } shift_filter; ADPCMFlags flags; u8 data[NUM_SAMPLES_PER_ADPCM_BLOCK / 2]; @@ -201,7 +201,7 @@ struct ADPCMBlock return (shift > 12) ? 9 : shift; } - u8 GetFilter() const { return std::min(shift_filter.filter, 4); } + u8 GetFilter() const { return shift_filter.shift; } u8 GetNibble(u32 index) const { return (data[index / 2] >> ((index % 2) * 4)) & 0x0F; } }; @@ -1877,8 +1877,8 @@ void SPU::Voice::TickADSR() void SPU::Voice::DecodeBlock(const ADPCMBlock& block) { - static constexpr std::array filter_table_pos = {{0, 60, 115, 98, 122}}; - static constexpr std::array filter_table_neg = {{0, 0, -52, -55, -60}}; + static constexpr std::array filter_table_pos = {{0, 60, 115, 98, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + static constexpr std::array filter_table_neg = {{0, 0, -52, -55, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; // store samples needed for interpolation current_block_samples[2] = current_block_samples[NUM_SAMPLES_FROM_LAST_ADPCM_BLOCK + NUM_SAMPLES_PER_ADPCM_BLOCK - 1];