Provide a way to get the channel again

This commit is contained in:
Gwilym Kuiper 2021-06-25 21:41:35 +01:00
parent 27a470c648
commit 80ce5173e1

View file

@ -62,6 +62,16 @@ impl Mixer {
panic!("Cannot play more than 16 sounds at once"); panic!("Cannot play more than 16 sounds at once");
} }
pub fn get_channel(&mut self, id: ChannelId) -> Option<&'_ mut SoundChannel> {
if let Some(channel) = &mut self.channels[id.0] {
if self.indices[id.0] == id.1 {
return Some(channel);
}
}
None
}
} }
// I've picked one frequency that works nicely. But there are others that work nicely // I've picked one frequency that works nicely. But there are others that work nicely