From d6384a6886bfeaf837ff3f6fcef61325605e79b9 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Sat, 22 Jul 2023 23:27:21 +0100 Subject: [PATCH] This improves mixing performance by about 20% --- agb/src/sound/mixer/sw_mixer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agb/src/sound/mixer/sw_mixer.rs b/agb/src/sound/mixer/sw_mixer.rs index c5d50bce..13cd0376 100644 --- a/agb/src/sound/mixer/sw_mixer.rs +++ b/agb/src/sound/mixer/sw_mixer.rs @@ -433,6 +433,8 @@ impl MixerBuffer { channel.pos += 2 * self.frequency.buffer_size() as u32; } + #[link_section = ".iwram.write_mono"] + #[inline(never)] fn write_mono(&self, channel: &mut SoundChannel, working_buffer: &mut [Num]) { let right_amount = ((channel.panning + 1) / 2) * channel.volume; let left_amount = ((-channel.panning + 1) / 2) * channel.volume;