simple/simple.rs
1use soloud::*;
2
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8
9 wav.load("song.mp3")?;
10
11 sl.play(&wav);
12 while sl.voice_count() > 0 {
13 // calls to play are non-blocking, so we put the thread to sleep
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 // wav.load("Recording.mp3")?;
18
19 // sl.play(&wav);
20 // while sl.voice_count() > 0 {
21 // std::thread::sleep(std::time::Duration::from_millis(100));
22 // }
23
24 Ok(())
25}