【问题标题】:SpeechRecognitionEngine Error HRESULT E_FAIL has been returned from a call to a COM componentSpeechRecognitionEngine 错误 HRESULT E_FAIL 已从对 COM 组件的调用中返回
【发布时间】:2019-07-03 17:51:20
【问题描述】:

我正在运行一些简单的主方法代码,用于实例化 SpeechRecognitionEngine 并将一些语法数据传递给它。我似乎无法找到错误不断出现的原因。我尝试删除 .csproj 和 .suo 并没有改变。

        SpeechRecognitionEngine spe = new SpeechRecognitionEngine();
        Choices commands = new Choices();
        commands.Add("hello", "what is your name");
        GrammarBuilder gB = new GrammarBuilder(commands);
        Grammar g = new Grammar(gB);

        //every single call to spe.SomeMethod() breaks with the error in the title
        spe.LoadGrammarAsync(g);
        spe.SetInputToDefaultAudioDevice();

        spe.RecognizeAsync(RecognizeMode.Multiple);

【问题讨论】:

    标签: c# visual-studio


    【解决方案1】:

    好的,想通了: 去: 构建>配置管理器>主动解决方案平台 单击“任何 CPU”下拉菜单。 选择 将平台设置为兼容的语音 SDK 类型(在我的情况下为 x64) 享受您正在制作的机器人仆人计划

    ps。省得自己头疼,使用RecognizeAsync() 而不是Recognize()。由于某种原因,识别喜欢触发两次。

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-09
      • 1970-01-01
      • 2021-08-18
      相关资源
      最近更新 更多