chore: Update Dependencies

This commit is contained in:
2020-10-08 18:15:41 -05:00
parent d54aeaf005
commit 0346154f7b
3 changed files with 249 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
use rodio::{Decoder, Source};
use rodio::{Decoder, Source, OutputStream};
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
@@ -19,11 +19,11 @@ impl Alert {
}
pub fn play(&self) -> Result<(), Box<dyn Error>> {
let (_, handle) = OutputStream::try_default()?;
let file = File::open(&self.path)?;
let device = rodio::default_output_device().ok_or("No default output device found.")?;
let source = Decoder::new(BufReader::new(file))?;
rodio::play_raw(&device, source.convert_samples());
handle.play_raw(source.convert_samples()).unwrap(); // use ?, blocked: https://github.com/RustAudio/rodio/pull/329
Ok(())
}
}