Use a BufReader in the examples

This commit is contained in:
Pierre Krieger 2015-09-10 16:38:16 +02:00
parent 89abf72790
commit 1b5bbdbb50
2 changed files with 7 additions and 3 deletions

View file

@ -1,15 +1,17 @@
extern crate rodio;
use std::io::BufReader;
fn main() {
let endpoint = rodio::get_default_endpoint().unwrap();
let file = std::fs::File::open("examples/beep.wav").unwrap();
let beep1 = rodio::play_once(&endpoint, file);
let beep1 = rodio::play_once(&endpoint, BufReader::new(file));
std::thread::sleep_ms(1000);
let file = std::fs::File::open("examples/beep2.wav").unwrap();
rodio::play_once(&endpoint, file);
rodio::play_once(&endpoint, BufReader::new(file));
std::thread::sleep_ms(1000);
/*let file = std::fs::File::open("examples/beep3.ogg").unwrap();

View file

@ -1,10 +1,12 @@
extern crate rodio;
use std::io::BufReader;
fn main() {
let endpoint = rodio::get_default_endpoint().unwrap();
let file = std::fs::File::open("examples/music.wav").unwrap();
let _music = rodio::play_once(&endpoint, file);
let _music = rodio::play_once(&endpoint, BufReader::new(file));
std::thread::sleep_ms(10000);
}