Function init_tts

Source
pub fn init_tts(
    type: i32,
    channel_name: *const u16,
    key_down_interrupt: i32,
) -> Result<i32, Error>
Expand description

初始化语音接口

§Arguments

  • r#type: 0 读屏通道; 1 独立通道
  • channel_name: type为0时忽略,传入NULL; type为1时:独立通道名称, NULL或空字符串时,将使用默认名称“API“
  • key_down_interrupt: TRUE 按键打断; FALSE 按键不打断

returns: Result<i32, Error> 0: 成功 1: 版本不匹配

§Examples

use zdsr_api::init_tts;
init_tts(0, std::ptr::null(), 0).unwrap();
Examples found in repository?
examples/zdsr_api.rs (line 17)
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}