windows7 시스템에서 SpeechLib.SpSharedRecoContext를 사용하면 왜 자동으로 음성 인식 도구 시스템이 열릴까요? 다음은 내 코드입니다. Windows7 시스템에서 음성 인식 도구를 실행하면 열리고 시스템 도구 시작 버튼을 클릭해야 내 프로그램이 인식을 시작할 수 있습니다.왜 Windows7 시스템에서 SpeechLib.SpSharedRecoContext를 사용하면 자동으로 음성 인식 도구 시스템이 열립니까?
private const int grammarId = 10;
private bool speechInitialized = false;
private SpeechLib.SpSharedRecoContext objRecoContext;
private SpeechLib.ISpeechRecoGrammar grammar;
private SpeechLib.ISpeechGrammarRule ruleListItems;
private void InitializeSpeech(List<string> userKeyWords = null, bool isUseSystemGrammar = false)
{
try
{
// First of all, let's create the main reco context object.
// In this sample, we are using shared reco context. Inproc reco
// context is also available. Please see the document to decide
// which is best for your application.
objRecoContext = new SpeechLib.SpSharedRecoContext();
// Then, let's set up the event handler. We only care about
// Hypothesis and Recognition events in this sample.
objRecoContext.Hypothesis += new
_ISpeechRecoContextEvents_HypothesisEventHandler(
RecoContext_Hypothesis);
objRecoContext.Recognition += new
_ISpeechRecoContextEvents_RecognitionEventHandler(
RecoContext_Recognition);
objRecoContext.AudioLevel += new _ISpeechRecoContextEvents_AudioLevelEventHandler(objRecoContext_AudioLevel);
objRecoContext.EventInterests = SpeechRecoEvents.SREAllEvents;
// Now let's build the grammar.
grammar = objRecoContext.CreateGrammar(grammarId);
ruleListItems = grammar.Rules.Add("ListItemsRule",
SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1);
RebuildGrammar(userKeyWords, isUseSystemGrammar);
// Now we can activate the top level rule. In this sample, only
// the top level rule needs to activated. The ListItemsRule is
// referenced by the top level rule.
grammar.CmdSetRuleState("ListItemsRule", SpeechRuleState.SGDSActive);
speechInitialized = true;
}
catch (Exception e)
{
Loger.LogErr(e);
}
}
시스템 도구에 대한 프로그램 의존성을 어떻게 방지 할 수 있습니까?
그런데 Windows XP 시스템에서는이 현상이 아닙니다.
대단히 감사합니다. 내가 참조. –