rodio
rodio copied to clipboard
Sink: sleep on pause and add `.toggle()`
This makes pause
a Mutex<bool>
+ Condvar
combo instead of an AtomicBool
so that the thread can sleep when paused instead of churning every 5 milliseconds (...!)
https://github.com/RustAudio/rodio/blob/9674ea56cfbdef90703833b3c6af7790d32be76e/src/sink.rs#L92
This reduces the idle CPU usage by half, as described in https://github.com/RustAudio/cpal/issues/785. The rest is in cpal
it seems.
.toggle()
was also added.