/// <summary> /// Function that is called when the Watson API returns a result. /// </summary> /// <param name="results">List of speech-to-text results</param> protected void OnSpeechToTextResult(SpeechRecognitionEvent results) { if (results.HasResult()) { SpeechRecognitionResult watsonResult = results.results[0]; var textResult = m_WatsonSpeechToTextComponent.CreateSpeechToTextResult(watsonResult); if (m_OnTextResult != null) { m_OnTextResult(textResult); } m_LastResult = textResult; } }
/// <summary> /// Function that is called when the Watson API returns a result. /// </summary> /// <param name="results">List of speech-to-text results</param> void OnSpeechToTextResult(SpeechRecognitionEvent watsonEvent) { if (watsonEvent.HasResult()) { if (m_OnTextResult != null) { m_OnTextResult(m_WatsonSpeechToTextComponent.CreateSpeechToTextResult(watsonEvent.results[0])); } } else { m_OnTextResult(new SpeechToTextResult("", true)); } }