mirror of
https://github.com/RustAudio/rodio
synced 2024-12-12 21:22:36 +00:00
24 lines
636 B
Rust
24 lines
636 B
Rust
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, BufReader::new(file));
|
|
|
|
std::thread::sleep_ms(1000);
|
|
|
|
let file = std::fs::File::open("examples/beep2.wav").unwrap();
|
|
rodio::play_once(&endpoint, BufReader::new(file));
|
|
|
|
std::thread::sleep_ms(1000);
|
|
let file = std::fs::File::open("examples/beep3.ogg").unwrap();
|
|
rodio::play_once(&endpoint, file);
|
|
|
|
std::thread::sleep_ms(1000);
|
|
beep1.stop();
|
|
|
|
std::thread::sleep_ms(7000);
|
|
}
|