Update the examples to use the new API

This commit is contained in:
Pierre Krieger 2015-10-16 16:37:48 +02:00
parent c67362a999
commit ddc5bec344
2 changed files with 5 additions and 3 deletions

View file

@ -4,9 +4,10 @@ use std::io::BufReader;
fn main() {
let endpoint = rodio::get_default_endpoint().unwrap();
let sink = rodio::Sink::new(&endpoint);
let file = std::fs::File::open("examples/music.ogg").unwrap();
let _music = rodio::play_once(&endpoint, BufReader::new(file));
sink.append(rodio::Decoder::new(BufReader::new(file)));
std::thread::sleep_ms(60000);
}

View file

@ -4,9 +4,10 @@ use std::io::BufReader;
fn main() {
let endpoint = rodio::get_default_endpoint().unwrap();
let sink = rodio::Sink::new(&endpoint);
let file = std::fs::File::open("examples/music.wav").unwrap();
let music = rodio::play_once(&endpoint, BufReader::new(file));
sink.append(rodio::Decoder::new(BufReader::new(file)));
music.sleep_until_end();
sink.sleep_until_end();
}