rodio/examples/music_wav.rs

12 lines
331 B
Rust
Raw Permalink Normal View History

2015-09-10 14:38:16 +00:00
use std::io::BufReader;
2015-09-01 17:35:26 +00:00
fn main() {
2020-02-25 10:09:17 +00:00
let (_stream, handle) = rodio::OutputStream::try_default().unwrap();
let sink = rodio::Sink::try_new(&handle).unwrap();
2015-09-01 17:35:26 +00:00
let file = std::fs::File::open("assets/music.wav").unwrap();
2015-10-22 14:45:33 +00:00
sink.append(rodio::Decoder::new(BufReader::new(file)).unwrap());
2015-09-01 17:35:26 +00:00
2015-10-16 14:37:48 +00:00
sink.sleep_until_end();
2015-09-01 17:35:26 +00:00
}