Rename get_channel to channel

This commit is contained in:
Gwilym Kuiper 2022-03-23 20:21:54 +00:00
parent 518f73c01e
commit 48ddda9ae9
3 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ fn main(mut gba: Gba) -> ! {
input.update(); input.update();
{ {
if let Some(channel) = mixer.get_channel(&channel_id) { if let Some(channel) = mixer.channel(&channel_id) {
let half: Num<i16, 4> = Num::new(1) / 2; let half: Num<i16, 4> = Num::new(1) / 2;
let half_usize: Num<usize, 8> = Num::new(1) / 2; let half_usize: Num<usize, 8> = Num::new(1) / 2;
match input.x_tri() { match input.x_tri() {

View file

@ -85,7 +85,7 @@ impl<'a> Mixer<'a> {
panic!("Cannot play more than 8 sounds at once"); panic!("Cannot play more than 8 sounds at once");
} }
pub fn get_channel(&mut self, id: &ChannelId) -> Option<&'_ mut SoundChannel> { pub fn channel(&mut self, id: &ChannelId) -> Option<&'_ mut SoundChannel> {
if let Some(channel) = &mut self.channels[id.0] { if let Some(channel) = &mut self.channels[id.0] {
if self.indices[id.0] == id.1 && !channel.is_done { if self.indices[id.0] == id.1 && !channel.is_done {
return Some(channel); return Some(channel);

View file

@ -45,7 +45,7 @@ impl<'a> Sfx<'a> {
pub fn stop_music(&mut self) { pub fn stop_music(&mut self) {
if let Some(bgm) = &self.bgm { if let Some(bgm) = &self.bgm {
let channel = self.mixer.get_channel(bgm).unwrap(); let channel = self.mixer.channel(bgm).unwrap();
channel.stop(); channel.stop();
} }
self.bgm = None; self.bgm = None;
@ -53,7 +53,7 @@ impl<'a> Sfx<'a> {
pub fn purple_night(&mut self) { pub fn purple_night(&mut self) {
if let Some(bgm) = &self.bgm { if let Some(bgm) = &self.bgm {
let channel = self.mixer.get_channel(bgm).unwrap(); let channel = self.mixer.channel(bgm).unwrap();
channel.stop(); channel.stop();
} }
@ -64,7 +64,7 @@ impl<'a> Sfx<'a> {
pub fn sunrise(&mut self) { pub fn sunrise(&mut self) {
if let Some(bgm) = &self.bgm { if let Some(bgm) = &self.bgm {
let channel = self.mixer.get_channel(bgm).unwrap(); let channel = self.mixer.channel(bgm).unwrap();
channel.stop(); channel.stop();
} }
@ -75,7 +75,7 @@ impl<'a> Sfx<'a> {
pub fn boss(&mut self) { pub fn boss(&mut self) {
if let Some(bgm) = &self.bgm { if let Some(bgm) = &self.bgm {
let channel = self.mixer.get_channel(bgm).unwrap(); let channel = self.mixer.channel(bgm).unwrap();
channel.stop(); channel.stop();
} }