Rename get_write_buffer -> write_buffer

This commit is contained in:
Gwilym Kuiper 2022-03-23 20:26:43 +00:00
parent b91f129636
commit 35c7c48f73

View file

@ -141,7 +141,7 @@ impl MixerBuffer {
} }
fn swap(&mut self) { fn swap(&mut self) {
let (left_buffer, right_buffer) = self.get_write_buffer().split_at(SOUND_BUFFER_SIZE); let (left_buffer, right_buffer) = self.write_buffer().split_at(SOUND_BUFFER_SIZE);
hw::enable_dma_for_sound(left_buffer, LeftOrRight::Left); hw::enable_dma_for_sound(left_buffer, LeftOrRight::Left);
hw::enable_dma_for_sound(right_buffer, LeftOrRight::Right); hw::enable_dma_for_sound(right_buffer, LeftOrRight::Right);
@ -150,7 +150,7 @@ impl MixerBuffer {
} }
fn clear(&mut self) { fn clear(&mut self) {
self.get_write_buffer().fill(0); self.write_buffer().fill(0);
} }
fn write_channels<'a>(&mut self, channels: impl Iterator<Item = &'a mut SoundChannel>) { fn write_channels<'a>(&mut self, channels: impl Iterator<Item = &'a mut SoundChannel>) {
@ -202,13 +202,13 @@ impl MixerBuffer {
channel.pos += playback_speed * SOUND_BUFFER_SIZE; channel.pos += playback_speed * SOUND_BUFFER_SIZE;
} }
let write_buffer = self.get_write_buffer(); let write_buffer = self.write_buffer();
unsafe { unsafe {
agb_rs__mixer_collapse(write_buffer.as_mut_ptr(), buffer.as_ptr()); agb_rs__mixer_collapse(write_buffer.as_mut_ptr(), buffer.as_ptr());
} }
} }
fn get_write_buffer(&mut self) -> &mut [i8; SOUND_BUFFER_SIZE * 2] { fn write_buffer(&mut self) -> &mut [i8; SOUND_BUFFER_SIZE * 2] {
if self.buffer_1_active { if self.buffer_1_active {
&mut self.buffer2.0 &mut self.buffer2.0
} else { } else {