# 利用系统 API è¾¾æˆæ–‡æœ¬åˆ°è¯éŸ³çš„转æ¢ï¼Œå¹¶å€ŸåŠ©å¯¹ä¸åŒå£°å¡è®¾å¤‡çš„选择æ¥å®žçŽ°æ’放功能。 Achieve text-to-speech conversion by utilizing system APIs, and realize the playback function by means of selecting different sound card devices. ## 支æŒç³»ç»Ÿ (Support System) - [x] Windows ## 例å (Example) ### 1.åˆå§‹åŒ– Initialization 在程åºé¦–次å¯åŠ¨ä¹‹å‰ï¼Œéœ€è°ƒç”¨ä¸€æ¬¡åˆå§‹åŒ–函数,以完æˆç›¸å…³è®¾ç½®ã€‚示例代ç 如下: Before the program is launched for the first time, the initialization function needs to be called once to complete the relevant settings. The sample code is as follows: ```rust use Sound_tts::SoundTTs; SoundTTs::init(); ``` ### 2.获å–设备列表 (Get device list) ```rust let devices: Vec<String> = SoundTTs::get_devices(); for x in devices { println!("{}", x); } ``` ### 3.æ’放 (Playback) ```rust let value = SoundValue::create("文本","设备å称"); // play_count æ’放次数 0 是一直循环æ’放 // play_interval 本次æ’放完æˆåŽï¼Œæ’放下一次之间的间隔时间 let value1 = SoundValue::new("文本",0,1,"设备å称"); //顺åºæ’放 SoundTTs::speak(value); SoundTTs::speak(value1); //ä¸æ–æ’放 SoundTTs::speak_interrupt(value1); //åœæ¢æ’放 SoundTTs::stop("设备å称)"); ```