recho/
recho.rs

1use soloud::*;
2
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut sl = Soloud::default()?;
5    sl.set_global_volume(4.0);
6    let mut speech = audio::Speech::default();
7
8    let strings: Vec<String> = std::env::args().collect();
9
10    if strings.len() < 2 {
11        speech.set_text("Please provide command line arguments!")?;
12        sl.play(&speech);
13        while sl.active_voice_count() > 0 {
14            std::thread::sleep(std::time::Duration::from_millis(100));
15        }
16    } else {
17        for i in 1..strings.len() {
18            speech.set_text(&strings[i])?;
19
20            sl.play(&speech);
21            while sl.active_voice_count() > 0 {
22                std::thread::sleep(std::time::Duration::from_millis(100));
23            }
24        }
25    }
26
27    Ok(())
28}