From b02cdd9233d48a3f53c33be192970582d1af7f2c Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 4 May 2022 18:05:54 +0100 Subject: [PATCH] Calculate 127 + sample earlier --- agb/src/sound/mixer/mixer.s | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/agb/src/sound/mixer/mixer.s b/agb/src/sound/mixer/mixer.s index 667607a1..4df3d6b6 100644 --- a/agb/src/sound/mixer/mixer.s +++ b/agb/src/sound/mixer/mixer.s @@ -170,7 +170,6 @@ TEMP .req r10 mov r4, r2 .macro clamp_s8 reg:req - add \reg, \reg, #127 subs r10, r7, \reg, asr #8 andne \reg, r8, r10, lsr #24 .endm @@ -180,8 +179,8 @@ TEMP .req r10 ldr \left_reg, [r1], #4 lsl \right_reg, \left_reg, #16 @ push the sample 16 bits first - asr \right_reg, \right_reg, #20 @ move right sample back to being the correct value - mov \left_reg, \left_reg, asr #20 @ now we only have the left sample + add \right_reg, r9, \right_reg, asr #20 @ move right sample back to being the correct value + add \left_reg, r9, \left_reg, asr #20 @ now we only have the left sample clamp_s8 \left_reg @ clamp the audio to 8 bit values clamp_s8 \right_reg