2015-09-10 16:38:16 +02:00
|
|
|
use std::io::BufReader;
|
2016-10-04 16:36:11 +02:00
|
|
|
use std::thread;
|
|
|
|
use std::time::Duration;
|
2015-09-10 16:38:16 +02:00
|
|
|
|
2015-07-22 12:14:11 +02:00
|
|
|
fn main() {
|
2020-02-25 10:09:17 +00:00
|
|
|
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap();
|
2015-09-01 19:35:26 +02:00
|
|
|
|
2022-03-26 20:15:18 +01:00
|
|
|
let file = std::fs::File::open("assets/beep.wav").unwrap();
|
2020-02-25 10:09:17 +00:00
|
|
|
let beep1 = stream_handle.play_once(BufReader::new(file)).unwrap();
|
2015-09-11 13:49:07 +02:00
|
|
|
beep1.set_volume(0.2);
|
2017-02-07 12:33:18 +01:00
|
|
|
println!("Started beep1");
|
2015-07-22 12:14:11 +02:00
|
|
|
|
2017-02-07 12:33:18 +01:00
|
|
|
thread::sleep(Duration::from_millis(1500));
|
2015-07-22 13:27:53 +02:00
|
|
|
|
2022-03-26 20:15:18 +01:00
|
|
|
let file = std::fs::File::open("assets/beep2.wav").unwrap();
|
2020-02-25 10:09:17 +00:00
|
|
|
let beep2 = stream_handle.play_once(BufReader::new(file)).unwrap();
|
2020-02-08 14:25:21 +00:00
|
|
|
beep2.set_volume(0.3);
|
|
|
|
beep2.detach();
|
2017-02-07 12:33:18 +01:00
|
|
|
println!("Started beep2");
|
2015-07-22 12:14:11 +02:00
|
|
|
|
2017-02-07 12:33:18 +01:00
|
|
|
thread::sleep(Duration::from_millis(1500));
|
2022-03-26 20:15:18 +01:00
|
|
|
let file = std::fs::File::open("assets/beep3.ogg").unwrap();
|
2020-02-25 10:09:17 +00:00
|
|
|
let beep3 = stream_handle.play_once(file).unwrap();
|
2020-02-08 14:25:21 +00:00
|
|
|
beep3.set_volume(0.2);
|
2017-02-07 12:33:18 +01:00
|
|
|
println!("Started beep3");
|
2015-07-22 14:23:03 +02:00
|
|
|
|
2017-02-07 12:33:18 +01:00
|
|
|
thread::sleep(Duration::from_millis(1500));
|
2015-10-16 15:40:30 +02:00
|
|
|
drop(beep1);
|
2017-02-07 12:33:18 +01:00
|
|
|
println!("Stopped beep1");
|
2015-07-22 13:27:53 +02:00
|
|
|
|
2017-02-07 12:33:18 +01:00
|
|
|
thread::sleep(Duration::from_millis(1500));
|
2015-10-16 15:40:30 +02:00
|
|
|
drop(beep3);
|
2017-02-07 12:33:18 +01:00
|
|
|
println!("Stopped beep3");
|
2015-09-27 14:49:53 +02:00
|
|
|
|
2017-02-07 12:33:18 +01:00
|
|
|
thread::sleep(Duration::from_millis(1500));
|
2015-07-22 12:14:11 +02:00
|
|
|
}
|