chore: Update Dependencies
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user