在Windows XP中使用文本语音转换功能时,如何在中间句子中停止语音转换? [英] While using text to speech function in Windows XP, how to stop the speech in mid sentence?

查看:114
本文介绍了在Windows XP中使用文本语音转换功能时,如何在中间句子中停止语音转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个Windows窗体应用程序,该应用程序使用Speech SDK(SAPI 5.1)来执行一些文本到语音的功能.这是我正在使用的代码.

I making a Windows Form app that uses the Speech SDK (SAPI 5.1) to do some text to speech functions. Here''s the code I''m using.

using SpeechLib;
public SpVoice obSpeech = new SpVoice();
obSpeech.Speak("Some really long sentence", SpeechVoiceSpeakFlags.SVSFlagsAsync);



现在,当我给出一个很长的句子时,它将继续讲话,直到句子结束为止.有没有办法在句子中期停止讲话?我的意思是,当我按下按钮(例如btnStop)时,可以让它停止讲话吗?
请帮忙.



Now when I give a really long sentence, it continues speaking till it finishes the sentence. Is there any way to stop the speech in mid-sentence? What I mean is, when I press a button (say btnStop), can I make it stop speaking?
Please help.

推荐答案

S.Raaj Nishanth写道:
S.Raaj Nishanth wrote:

现在当我给一个很长的句子,它会继续说话,直到句子结束为止.有什么方法可以阻止中间句子中的讲话吗?

Now when i give a really long sentence, it continues speaking till it finishes the sentence. Is there any way to stop the speech in mid-sentence?



是的,这应该可以解决问题:



Yup, this should do the trick:

void Button1_Click(object sender, EventArgs e)
{
    obSpeech.Speak("", SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
}


效果很好!!!非常感谢你! :) :) :-D
That worked beautifully!!! Thank you very much! :) :) :-D


这篇关于在Windows XP中使用文本语音转换功能时,如何在中间句子中停止语音转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆