private IEnumerator ProcessInput(SpeechInputEventArgs eventArgs) { //Debug.Log("ProcessInputStart"); /*if (!GameObject.Find("AppConfig").GetComponent<AppConfig>().IsServerInstance) * yield break;*/ Debug.Log("Processing '" + eventArgs.Input + "'"); _isProcessing = true; Action <SpeechInputEventArgs> action; if (RespondExternally) { // External responder takes care of evaluating and setting // the keyword and data values for the input event args. yield return(ExternalResponder.SendRequest(eventArgs)); } // If no external responder is available, check if input token // is equal to a keyword. else if (_keywordTypeTable.ContainsKey(eventArgs.Input)) { eventArgs.Keyword = (KeywordType)Enum.Parse(typeof(KeywordType), eventArgs.Input); } action = response => SpeechInputEvent(response); InputHandler.Instance.InvokeSpeechInputEvent(action, eventArgs); _dictationRecognizer.Stop(); _isProcessing = false; //Debug.Log("ProcessInputStop"); }
public void OnDictationResult(string text, ConfidenceLevel confidence) { //Debug.Log("OnDictationResultStart"); //Debug.Log("Dictation result: " + text); // Return if SpeechInputListener is already processing speech // input (external responders may take more time). if (_isProcessing) { return; } // First token has to be equal to activation keyword, second token // is the actual input string for processing. Debug.Log("Processing: " + text); string[] token = text.ToLower().Split(new char[] { ' ' }, 2); if (token[0] == ActivationKeyword.ToLower() && token.Length > 1) { var eventArgs = new SpeechInputEventArgs(token[1]); StartCoroutine(ProcessInput(eventArgs)); } _dictationStarted = false; //Debug.Log("OnDictationResultStop"); }