diff --git a/Cargo.toml b/Cargo.toml index 775c285..983fd45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" license = "GPL-3.0-or-later" [dependencies] +rodio = "0.16.0" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..9dbdbc0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,14 @@ + +fn play_file(file: &str) { + use rodio::{Decoder, OutputStream, source::Source}; + + let (_stream, stream_handle) = OutputStream::try_default().unwrap(); + let file = std::io::BufReader::new(std::fs::File::open(file).unwrap()); + let source = Decoder::new(file).unwrap(); + stream_handle.play_raw(source.convert_samples()).unwrap(); + std::thread::sleep(std::time::Duration::from_secs(5)); +} + +fn main() { + play_file("test.flac"); +}