This improves mixing performance by about 20%

This commit is contained in:
Gwilym Inzani 2023-07-22 23:27:21 +01:00
parent ff0e8f659e
commit d6384a6886

View file

@ -433,6 +433,8 @@ impl MixerBuffer {
channel.pos += 2 * self.frequency.buffer_size() as u32; 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<i16, 4>]) { fn write_mono(&self, channel: &mut SoundChannel, working_buffer: &mut [Num<i16, 4>]) {
let right_amount = ((channel.panning + 1) / 2) * channel.volume; let right_amount = ((channel.panning + 1) / 2) * channel.volume;
let left_amount = ((-channel.panning + 1) / 2) * channel.volume; let left_amount = ((-channel.panning + 1) / 2) * channel.volume;