rodio/examples/music_wav.rs

14 lines
329 B
Rust
Raw Normal View History

2015-09-01 17:35:26 +00:00
extern crate rodio;
2015-09-10 14:38:16 +00:00
use std::io::BufReader;
2015-09-01 17:35:26 +00:00
fn main() {
let endpoint = rodio::get_default_endpoint().unwrap();
2015-10-16 14:37:48 +00:00
let sink = rodio::Sink::new(&endpoint);
2015-09-01 17:35:26 +00:00
let file = std::fs::File::open("examples/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
}