SpeechLib有趣的问题 [英] SpeechLib funny problem

查看:298
本文介绍了SpeechLib有趣的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常有趣的问题:
我正在c#中使用SpeechLib com讲某事,我已经尝试了一个简单的测试
通过点击按钮说英语或说中文,例如下面的简单代码:
有趣的是:对于说英语,这很好,没问题.但是当您说中文时,它适用于第一次点击,但不适用于第二次点击,但是如果我单击更多,则有时它会起作用,但大多数时候它不会说.
有人知道这个问题吗?
谢谢!

i have met a very funny problem:
I am using SpeechLib com in c# to speak sth, I have tried a simple test
either speak english or speak chinese by clicking a button, e.g. below simple code:
the funny thing is: for speaking english, it is fine, no problem. but when speaking Chinese, it works for the first click then it does not work for the second click, but if I click more, sometime it works, but most time, it does not speak.
Anyone knows the problem?
thanks!

private void btn_read_Click(object sender, EventArgs e)
        {
            //play english
            SpVoice voice = new SpVoice();
            voice.Voice=voice.GetVoices(string.Empty, string.Empty).Item(0);
            voice.Speak("hello", SpeechVoiceSpeakFlags.SVSFlagsAsync);

            //play chinese
            SpVoice voice = new SpVoice();
            voice.Voice=voice.GetVoices(string.Empty, string.Empty).Item(1);
            voice.Speak("你好", SpeechVoiceSpeakFlags.SVSFlagsAsync);
        }

推荐答案

您也可以在PC上尝试一下吗,尝试非常简单,因为您只需从com中添加SpeechLib供您参考.
谢谢!"


我立即得到一个例外:

"can you please try also on your PC, the try is very simple,as you just need to add SpeechLib from com to your reference.
thanks!"


I immediately get an exception:

System.Runtime.InteropServices.COMException was unhandled
  Message=Exception from HRESULT: 0x80045039
  Source=AudioMaster
  ErrorCode=-2147200967
  StackTrace:
       at SpeechLib.ISpeechObjectTokens.Item(Int32 Index)
       at AudioMaster.Form1.button4_Click(Object sender, EventArgs e) in C:\Users\griff\Documents\My Projects\AudioMaster\AudioMaster\Form1.cs:line 191
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at AudioMaster.Program.Main() in C:\Users\griff\Documents\My Projects\AudioMaster\AudioMaster\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

大概意味着未初始化引擎.

您是否检查了任何东西?
单步显示好吗?

Which presumably means that the engine is not initialized.

Have you checked if you are getting anything?
Single step show ok?


这篇关于SpeechLib有趣的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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