防止语音消息在聊天应用程序中重播. [英] Prevent spoken messages from being replayed in a chat application.

查看:132
本文介绍了防止语音消息在聊天应用程序中重播.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#开发带有语音消息的LAN聊天应用程序.我正在使用SAPI 5.1,并且在说出消息时遇到了问题.如果我写消息"HI",他的计算机将接收到该消息并说出"HI"字样,但是如果我写一个新消息,例如"HELLO",他的计算机将重复说第一条消息"HI",然后说出"HELLO"一词.

旧消息"HI"不应再重复,而应显示新消息"HELLO".

这是我的代码:

I am making a LAN chat application with spoken messages using C#. I''m using SAPI 5.1, and I have encountered problem with speaking the messages. If I write the message "HI" his computer will receive the message and speak the word "HI" which is OK, but if I write a new message for example "HELLO" his computer will repeat speaking the first message "HI" and then speak the word "HELLO".

The old message "HI" should not be repeated again, and it should say the new message "HELLO".

Here is my code:

private void rtbConversation_TextChanged(object sender, EventArgs e)
{
    speech.Rate = speechRate;
    speech.Speak(rtbConversation.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);

    speech.Voice = speech.GetVoices(string.Empty, 
                          string.Empty).Item(combo1.SelectedIndex); 
}

推荐答案

听起来好像您没有清除传入的文本缓冲区
Sounds like you are not clearing the incoming text buffer


这篇关于防止语音消息在聊天应用程序中重播.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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