Function zdsr_api::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)
16
17
18
19
20
21
22
23
24
25
26
fn main() {
    init_tts(0, std::ptr::null(), 0).unwrap();
    speak([65,66,67].as_ptr(), 0).unwrap();
    loop {
        std::thread::sleep(std::time::Duration::from_millis(50));
        if get_speak_state().unwrap() != 3 {
            break
        }
    }
    stop_speak().unwrap()
}