问题描述
SpVoicespVoice=newSpVoice();spVoice.Voice=spVoice.GetVoices().Item(7);spVoice.Speak("你好",SpeechVoiceSpeakFlags.SVSFDefault);这段代码可以正常运行,因为我电脑安装了7种语音库,但我怎么根据语音库的名字,比如“MicrosoftSam”,“MicrosoftSimplifiedChinese”或者“VWWang”,按照名字选择voice?而不是像上面代码或者网上所说的0或1选择中英文,都是乱抄袭,根本没搞懂那些下标对应的发音者,我也是醉了...
解决方案
解决方案二:
foreach(ISpeechObjectTokenTokeninvoice.GetVoices(string.Empty,string.Empty)){comboBox1.Items.Add(Token.GetDescription(49));}
解决方案三:
privatevoidcomboBox1_SelectedIndexChanged(objectsender,EventArgse){voice.Voice=voice.GetVoices(string.Empty,string.Empty).Item(comboBox1.SelectedIndex);}
时间: 2024-12-23 05:29:48