Function speak

Source
pub fn speak(text: *const u16, interrupt: i32) -> Result<i32, Error>
Expand description

朗读文本

§Arguments

  • text: 要朗读的文本,Unicode
  • interrupt: TRUE:清空排队,立刻打断朗读, FALSE:等待空闲时朗读

returns: Result<i32, Error> 0: 成功 1: 版本不匹配 2: ZDSR没有运行

§Examples

 use zdsr_api::speak;
 // Speak: ABC
 speak([65u16, 66, 67].as_ptr(), 0).unwrap();
Examples found in repository?
examples/zdsr_api.rs (line 18)
16fn main() {
17    init_tts(0, std::ptr::null(), 0).unwrap();
18    speak([65,66,67].as_ptr(), 0).unwrap();
19    loop {
20        std::thread::sleep(std::time::Duration::from_millis(50));
21        if get_speak_state().unwrap() != 3 {
22            break
23        }
24    }
25    stop_speak().unwrap()
26}