How to restart stream after pause/stop?
Closed this issue · 3 comments
Hi again, since you requested feedback I wanted to create another issue for this question. Is it possible to pause a stream? I don't see this in the SoundController:
pub fn stop(&self);
pub fn set_doppler_factor(&mut self, factor: f32);
pub fn set_velocity(&mut self, vel: [f32; 3]);
pub fn adjust_position(&mut self, pos: [f32; 3]);
pub fn set_position(&mut self, pos: [f32; 3]);
In rodio stop() drops all the bytes from the stream, and playing again after a stream isn't possible it seems. Pausing a stream does work for me using rodio. It is possible to allow me to pause the sound using the SoundController and then play it again in ambisonic?
This functionality is missing indeed.
A naive implementation could simply produce 0-valued samples while the stream is paused, but then paused streams would still consume CPU time.
I'll need to think about this a bit. Maybe there is a way to do this without performance penalty...
I could be wrong, but I think that's what rodio does.
edit: I'm not saying that's good.. just thinking outloud
Right... but rodio also supports pausing at the sink level.
Also, the 3d sources are more expensive to play.