簡體   English   中英

引用System.Speech.Recognition庫-C#

[英]Referencing the System.Speech.Recognition library - C#

我的C#應用​​程序中的語音識別參考出現問題。 當我using System.Speech.Recognition語句在C#代碼中引用它時,該程序僅在存在麥克風時運行,而在相反情況為真時拒絕運行。 有沒有一種方法可以選擇性地使用該庫,以便在托管該庫的另一台計算機沒有麥克風的情況下該程序不會關閉? 提前致謝!

在創建SpeechRecognizer對象之前,您需要檢查麥克風是否存在。

即,而不是做:

using System.Speech.Recognition;

SpeechRecognizer reco = new SpeechRecognizer();

using System.Speech.Recognition;

SpeechRecognizer reco = null;

if (MicrophonePresent())
{
    reco = new SpeechRecognizer();
    // do remainder of setup here
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM