From 7252becf24583e6bf34f89889944611ccf343bb4 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 20 Jan 2013 17:20:30 +0100 Subject: [PATCH] Fix the voice LPF implementation --- Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h | 4 ++-- Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h index cc24bd78b7..2ac9ddd2f0 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h @@ -231,8 +231,8 @@ struct PBLowPassFilter { u16 enabled; s16 yn1; - s16 a0; - s16 b0; + u16 a0; + u16 b0; }; struct AXPB diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h index fcc1bb7999..f41c4c47ff 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h @@ -342,10 +342,10 @@ void MixAdd(int* out, const s16* input, u32 count, u16* pvol, s16* dpop, bool ra // Execute a low pass filter on the samples using one history value. Returns // the new history value. -s16 LowPassFilter(s16* samples, u32 count, s16 yn1, s16 a0, s16 b0) +s16 LowPassFilter(s16* samples, u32 count, s16 yn1, u16 a0, u16 b0) { for (u32 i = 0; i < count; ++i) - yn1 = samples[i] = (s32)a0 * samples[i] - (s32)b0 * yn1; + yn1 = samples[i] = (a0 * (s32)samples[i] + b0 * (s32)yn1) >> 15; return yn1; }