Allow mutation of the SoundChannel

This commit is contained in:
Gwilym Kuiper 2021-06-25 21:27:46 +01:00
parent 1b3358345e
commit 45b8480a35

View file

@ -50,17 +50,17 @@ impl SoundChannel {
} }
} }
pub fn should_loop(mut self) -> Self { pub fn should_loop<'a>(&'a mut self) -> &'a mut Self {
self.should_loop = true; self.should_loop = true;
self self
} }
pub fn playback(mut self, playback_speed: Num<usize, 8>) -> Self { pub fn playback<'a>(&'a mut self, playback_speed: Num<usize, 8>) -> &'a mut Self {
self.playback_speed = playback_speed; self.playback_speed = playback_speed;
self self
} }
pub fn panning(mut self, panning: Num<i16, 4>) -> Self { pub fn panning<'a>(&'a mut self, panning: Num<i16, 4>) -> &'a mut Self {
debug_assert!(panning >= Num::new(-1), "panning value must be >= -1"); debug_assert!(panning >= Num::new(-1), "panning value must be >= -1");
debug_assert!(panning <= Num::new(1), "panning value must be <= 1"); debug_assert!(panning <= Num::new(1), "panning value must be <= 1");
@ -68,7 +68,7 @@ impl SoundChannel {
self self
} }
pub fn high_priority(mut self) -> Self { pub fn high_priority<'a>(&'a mut self) -> &'a mut Self {
self.priority = SoundPriority::High; self.priority = SoundPriority::High;
self self
} }