mirror of
https://github.com/RustAudio/rodio
synced 2024-12-13 05:32:32 +00:00
28 lines
731 B
Rust
28 lines
731 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 mut beep1 = rodio::play_once(&endpoint, BufReader::new(file));
|
|
beep1.set_volume(0.2);
|
|
|
|
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();
|
|
let beep3 = rodio::play_once(&endpoint, file);
|
|
|
|
std::thread::sleep_ms(1000);
|
|
beep1.stop();
|
|
|
|
std::thread::sleep_ms(1000);
|
|
beep3.stop();
|
|
|
|
std::thread::sleep_ms(1000);
|
|
}
|