日期:2014-05-18 浏览次数:20997 次
private void playButton_Click(object sender, EventArgs e)
{
Button playBtn = sender as Button;
string text=testBox.Text;
if(null == text || text.Length <1) {
MessageBox.Show("输入文本");
return;
}
speek.Text=text;
speek.Name = voiceCombo.SelectedItem as string;
speek.Rate = (int)rateUpDown.Value;
speek.Volume = (int)volumeUpDown.Value;
speek.Index = 0;
Thread th = new Thread(new ThreadStart(PlayText));
th.IsBackground = true;
th.Start();
}
private void PlayText()
{
speek.Say();
}
private void btnStartThread_Click(object sender, EventArgs e)
{
Thread th = new Thread(new ThreadStart(Start));
th.IsBackground = true;
th.Start();
}
void Start()
{
while (true)
{
Thread.Sleep(5000);
}
}
------解决方案--------------------
没找到问题
Speek类的代码贴出来看看
是不是这里卡主线程了
------解决方案--------------------
这个类也没卡
建议主线程看看有没有卡得
或者Voice类
------解决方案--------------------
我估计和微软的TTS控件有关,和多线程无关。是不是TTS就不许多线程
------解决方案--------------------
http://blog.csdn.net/hukeda0509/article/details/5586437
th.IsBackground = true; 会不会是错误根源??
另外,TTS 发声引擎,这种操作声卡的操作,子线程 到底有没有权利?
子线程冒似连界面UI都没有权限操作的?
http://topic.csdn.net/u/20110321/10/20e23804-4868-4ea2-95b0-0324619bf03f.html
遇到了和你一样的错误....