speech-dispatcher-rs/examples/hello_world.rs

18 lines
768 B
Rust
Raw Normal View History

2018-01-12 17:28:39 +00:00
extern crate speech_dispatcher;
use speech_dispatcher::*;
fn main() {
let connection = speech_dispatcher::Connection::open("hello_world", "hello_world", "hello_world", Mode::Single);
2018-01-12 17:28:39 +00:00
connection.say(Priority::Important, format!("Hello, world at rate {}.", connection.get_voice_rate()));
connection.set_voice_rate(100);
connection.say(Priority::Important, "This is faster.");
2018-01-12 17:28:39 +00:00
connection.set_voice_rate(0);
connection.set_spelling(true);
connection.say(Priority::Important, "This is spelled.");
2018-01-12 17:28:39 +00:00
connection.set_spelling(false);
connection.set_punctuation(Punctuation::All);
connection.say(Priority::Important, "This statement, unlike others, has punctuation that is spoken!");
2018-01-12 17:28:39 +00:00
connection.set_punctuation(Punctuation::None);
}