mirror of
https://github.com/RustAudio/rodio
synced 2024-12-12 21:22:36 +00:00
Use a BufReader in the examples
This commit is contained in:
parent
89abf72790
commit
1b5bbdbb50
2 changed files with 7 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue