2015-07-22 10:14:11 +00:00
|
|
|
extern crate rodio;
|
|
|
|
|
2015-09-10 14:38:16 +00:00
|
|
|
use std::io::BufReader;
|
|
|
|
|
2015-07-22 10:14:11 +00:00
|
|
|
fn main() {
|
2015-09-01 17:35:26 +00:00
|
|
|
let endpoint = rodio::get_default_endpoint().unwrap();
|
|
|
|
|
2015-07-22 10:14:11 +00:00
|
|
|
let file = std::fs::File::open("examples/beep.wav").unwrap();
|
2015-09-10 14:38:16 +00:00
|
|
|
let beep1 = rodio::play_once(&endpoint, BufReader::new(file));
|
2015-07-22 10:14:11 +00:00
|
|
|
|
2015-07-22 11:27:53 +00:00
|
|
|
std::thread::sleep_ms(1000);
|
|
|
|
|
|
|
|
let file = std::fs::File::open("examples/beep2.wav").unwrap();
|
2015-09-10 14:38:16 +00:00
|
|
|
rodio::play_once(&endpoint, BufReader::new(file));
|
2015-07-22 10:14:11 +00:00
|
|
|
|
2015-07-22 12:23:03 +00:00
|
|
|
std::thread::sleep_ms(1000);
|
2015-09-10 15:52:02 +00:00
|
|
|
let file = std::fs::File::open("examples/beep3.ogg").unwrap();
|
|
|
|
rodio::play_once(&endpoint, file);
|
2015-07-22 12:23:03 +00:00
|
|
|
|
2015-07-22 11:27:53 +00:00
|
|
|
std::thread::sleep_ms(1000);
|
|
|
|
beep1.stop();
|
|
|
|
|
2015-07-22 12:23:03 +00:00
|
|
|
std::thread::sleep_ms(7000);
|
2015-07-22 10:14:11 +00:00
|
|
|
}
|