Reduce maximum number of sound channels to 8

This commit is contained in:
Gwilym Kuiper 2021-10-30 21:16:32 +01:00
parent 301e2c115a
commit a92a2f503c

View file

@ -20,8 +20,8 @@ extern "C" {
pub struct Mixer { pub struct Mixer {
buffer: MixerBuffer, buffer: MixerBuffer,
channels: [Option<SoundChannel>; 16], channels: [Option<SoundChannel>; 8],
indices: [i32; 16], indices: [i32; 8],
} }
pub struct ChannelId(usize, i32); pub struct ChannelId(usize, i32);
@ -75,7 +75,7 @@ impl Mixer {
return Some(ChannelId(i, self.indices[i])); return Some(ChannelId(i, self.indices[i]));
} }
panic!("Cannot play more than 16 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 get_channel(&mut self, id: &ChannelId) -> Option<&'_ mut SoundChannel> {