当前位置: 移动技术网 > IT编程>开发语言>c# > c#中SAPI使用总结——SpVoice的使用方法

c#中SAPI使用总结——SpVoice的使用方法

2019年07月18日  | 移动技术网IT编程  | 我要评论
要使用sapi,首先添加引用dotnetspeech,请自行下载dotnetspeech.dll。

初始化对象,spvoice voice = new dotnetspeech.spvoiceclass();

朗读时,使用

voice.speak(string,speechvoicespeakflags.svsflagsasync);
暂停,使用

voice.pause();

从暂停中继续刚才的朗读,使用

voice.resume();

停止功能是大多资料都没有写清楚的,而且在网上很少能找到,这里使用

voice.speak(string.empty, speechvoicespeakflags.svsfpurgebeforespeak);

这样就可以完整地实现了“朗读”、“暂停”、“继续”、“停止”的功能。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网