mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Update Rodio and neatly call play/pause
This commit is contained in:
parent
cb1cfddb74
commit
827b815da9
3 changed files with 12 additions and 3 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2350,9 +2350,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rodio"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d98f5e557b61525057e2bc142c8cd7f0e70d75dc32852309bec440e6e046bf9"
|
||||
checksum = "ec0939e9f626e6c6f1989adb6226a039c855ca483053f0ee7c98b90e41cf731e"
|
||||
dependencies = [
|
||||
"cpal",
|
||||
]
|
||||
|
|
|
@ -39,7 +39,7 @@ gstreamer-app = { version = "0.17", optional = true }
|
|||
glib = { version = "0.14", optional = true }
|
||||
|
||||
# Rodio dependencies
|
||||
rodio = { version = "0.14", optional = true, default-features = false }
|
||||
rodio = { version = "0.15", optional = true, default-features = false }
|
||||
cpal = { version = "0.13", optional = true }
|
||||
|
||||
# Container and audio decoder
|
||||
|
|
|
@ -186,6 +186,15 @@ pub fn open(host: cpal::Host, device: Option<String>, format: AudioFormat) -> Ro
|
|||
}
|
||||
|
||||
impl Sink for RodioSink {
|
||||
fn start(&mut self) -> SinkResult<()> {
|
||||
Ok(self.rodio_sink.play())
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> SinkResult<()> {
|
||||
self.rodio_sink.sleep_until_end();
|
||||
Ok(self.rodio_sink.pause())
|
||||
}
|
||||
|
||||
fn write(&mut self, packet: AudioPacket, converter: &mut Converter) -> SinkResult<()> {
|
||||
let samples = packet
|
||||
.samples()
|
||||
|
|
Loading…
Reference in a new issue