Add get and set position on sound channels

This commit is contained in:
Gwilym Kuiper 2022-07-17 10:32:01 +01:00
parent a5e0e145d2
commit 3de22df7a2

View file

@ -375,4 +375,17 @@ impl SoundChannel {
pub fn stop(&mut self) {
self.is_done = true;
}
/// Gets how far along the sound has played.
#[inline]
pub fn pos(&self) -> Num<usize, 8> {
self.pos
}
/// Sets the playback position
#[inline]
pub fn set_pos(&mut self, pos: impl Into<Num<usize, 8>>) -> &mut Self {
self.pos = pos.into();
self
}
}