如何在语音中使用Tcplistner? [英] How to use Tcplistner in Speech?

查看:80
本文介绍了如何在语音中使用Tcplistner?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用语音消息制作了一个Lan Chat应用程序.我有问题,例如,如果在聊天框中键入文本"HELLO",则应用程序读取单词"HELLO"就可以了,但是在我的第二条消息上,例如,如果键入您好吗"?问题在于应用程序将说出第一条消息"Hello",然后说出第二条消息,即你好吗?".我希望不再讲旧消息,而只讲新消息.

这是我的代码,我将此代码放在文本框中

I make a Lan Chat Application With Spoken Message . I have problem for example if type the text " HELLO " in the chatbox the application read the word " HELLO " it is Okay but on my second message for example if I type " How are you"? the problem is the application would speak the first message " Hello " and after it would speak the second message which is " How are you?" I want it that the older message would not be speak anymore and the new message will only be speak.

Here''s My code I Put this code on a textbox

private void msg_TextChanged(object sender, EventArgs e)
     {

          speech.Rate = speechRate;
          speech.Speak(msg.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);




     }

推荐答案

我同意Dave和SAKryukov的评论,

您需要查看代码,您将获得解决方案.

I am agree with Comments by Dave and SAKryukov,

You need to see your code and you will get solution.

speech.Speak(msg.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);



上面的代码本身表明您正在将msg.Text传递给Speak()方法,而您需要修改msg.Text字符串并传递更新的字符串.可能您会使用一些类级别的字符串变量来执行此操作,并将所有插入的字符串或更好地维护的所有字符串存储在Array中,这有助于您创建聊天记录",并且在讲话时,您可以从当前更新的Chat中删除现有的聊天.

这只是对您的问题的一种补救措施,我并不是说这是您真正需要以连击方式设计方法的最佳方法.

问候
Rushikesh Joshi



Above code itself says that you are passing msg.Text to Speak() method, instead you need to modify msg.Text string and pass the updated one. Probably you would do it using some class level string variable and store all string inserted or better maintain in an Array which help you to create Chat History and at time of speak you can remove existing chat from current updated Chat.

This is just a remedy for your issue, I am not saying this is best approach you really need to design your approach in batter way.

Regards
Rushikesh Joshi


这篇关于如何在语音中使用Tcplistner?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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