rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Sink: sleep on pause and add `.toggle()`

Open hinto-janai opened this issue 1 year ago • 0 comments

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.

hinto-janai avatar Jun 01 '23 01:06 hinto-janai