/// <summary> /// Call LUIS to submit a dictation result. /// </summary> public IEnumerator SubmitRequestToLuis(string dictationResult) { if (string.IsNullOrEmpty(dictationResult)) { StartCoroutine(DictationInputManager.StartRecording()); yield break; } submittedRequest = true; string queryString = string.Concat(Uri.EscapeDataString(dictationResult)); using (UnityWebRequest unityWebRequest = UnityWebRequest.Get(luisEndpoint + queryString)) { unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); yield return(unityWebRequest.SendWebRequest()); long responseCode = unityWebRequest.responseCode; if (responseCode != 200) { Debug.LogError(unityWebRequest.responseCode + " " + unityWebRequest.downloadHandler.text); } AnalysedQuery analysedQuery = JsonUtility.FromJson <AnalysedQuery>(unityWebRequest.downloadHandler.text); //analyse the elements of the response AnalyseResponseElements(analysedQuery); } submittedRequest = false; }
void IDictationHandler.OnDictationError(DictationEventData eventData) { isRecording = false; speechToTextOutput = eventData.DictationResult; Debug.LogError(eventData.DictationResult); StartCoroutine(DictationInputManager.StopRecording()); }
public void OnDictationError(DictationEventData eventData) { speechToTextOutput.text = eventData.DictationResult; speechToTextOutput.color = Color.white; isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); }
private void ToNextQuestion_ButtonClick(GameObject obj) { m_lastTimeChangedQuestion = Time.time; m_currentQuestionID++; while ((Dictionary[m_currentQuestionID].NavigationFunction != null) && !Dictionary[m_currentQuestionID].NavigationFunction().ShouldSelect) { if (m_currentQuestionID == QuestionID.HowIsBodyPartFeelin) { if (!m_isReportingMode) { OnStoreSectionTwo_ButtonClick(null); } else { Exit(); } return; } m_currentQuestionID++; } SetCurrentQuestion(m_currentQuestionID, !m_isReportingMode); if (DictationInputManager.IsListening) { StartCoroutine(DictationInputManager.StopRecording()); } }
private void Update() { if (!DictationInputManager.IsListening && !submittedRequest) { StartCoroutine(DictationInputManager.StartRecording()); } }
/// <summary> /// If dictation manager encounters error, end recording. /// </summary> public void OnDictationError(DictationEventData eventData) { isRecording = false; // set recording status to false dictationOutputText.color = Color.red; renderer.material.color = Color.red; StartCoroutine(DictationInputManager.StopRecording()); // end recording }
public void OnDictationResult(DictationEventData eventData) { Debug.Log(eventData.DictationResult); StartCoroutine(DictationInputManager.StopRecording()); StartCoroutine(SubmitRequestToLuis(eventData.DictationResult)); eventData.Use(); }
/// <summary> /// Destroy unmanaged memory links. /// </summary> protected override void OnDestroy() { if (IsMicrophoneActive()) { StartCoroutine(DictationInputManager.StopRecording()); } base.OnDestroy(); }
public void StopListening() { if (isRecording) { isRecording = false; TextOutput.color = Color.white; StartCoroutine(DictationInputManager.StopRecording()); } }
/// <summary> /// When dictation is complete, end recording. /// </summary> public void OnDictationComplete(DictationEventData eventData) { dictationOutputText.text = eventData.DictationResult; // record result isRecording = false; // recording status false StartCoroutine(DictationInputManager.StopRecording()); // end recording renderer.material.color = Color.green; dictationOutputText.color = Color.green; }
/// <summary> /// Close the keyboard. /// (Clears all event subscriptions.) /// </summary> public void Close() { if (IsMicrophoneActive()) { StartCoroutine(DictationInputManager.StopRecording()); } SetMicrophoneDefault(); OnClosed(this, EventArgs.Empty); gameObject.SetActive(false); }
public void OnDictationError(DictationEventData eventData) { isRecording = false; speechToTextOutput.color = Color.red; buttonRenderer.enabled = true; recordLight.SetActive(false); speechToTextOutput.text = eventData.DictationResult; Debug.LogError(eventData.DictationResult); StartCoroutine(DictationInputManager.StopRecording()); }
public void OnInputClicked(InputClickedEventData eventData) { if (!DictationInputManager.IsListening) { StartCoroutine(DictationInputManager.StartRecording()); } else { StartCoroutine(DictationInputManager.StopRecording()); } }
private void ToggleRecording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); } else { isRecording = true; StartCoroutine(DictationInputManager.StartRecording(listener, autoSilenceTimeout, recordingTime)); } }
public IEnumerator DelayedRecord() { yield return(new WaitForSeconds(.1f)); if (!isRecording) { isRecording = true; TextOutput.color = Color.green; TextOutput.text = "..."; StartCoroutine(DictationInputManager.StartRecording( this.gameObject, 5, 20, 3)); } }
private void ToPreviousQuestion_ButtonClick(GameObject obj) { m_lastTimeChangedQuestion = Time.time; m_currentQuestionID--; while ((Dictionary[m_currentQuestionID].NavigationFunction != null) && !Dictionary[m_currentQuestionID].NavigationFunction().ShouldSelect) { m_currentQuestionID--; } SetCurrentQuestion(m_currentQuestionID, !m_isReportingMode); if (DictationInputManager.IsListening) { StartCoroutine(DictationInputManager.StopRecording()); } }
private void ToggleRecording() { StartCoroutine(DictationInputManager.StopRecording()); Debug.Log("stop recording"); speechToTextOutput.color = Color.white; MovieScript.main.scoreText.text = MovieScript.main.scoreQuote(speechToTextOutput.text).ToString(); StartCoroutine(DictationInputManager.StartRecording(initialSilenceTimeout, autoSilenceTimeout, recordingTime)); MovieScript.main.nextQuote(); speechToTextOutput.text = "..."; speechToTextOutput.color = Color.green; recordLight.SetActive(true); buttonRenderer.enabled = false; Debug.LogWarning("start recording"); }
private void Recording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); speechToTextOutput.color = Color.white; } else { isRecording = true; StartCoroutine(DictationInputManager.StartRecording(null, 5f, 20f, 10)); speechToTextOutput.color = Color.red; } }
//public void OnInputClicked(InputClickedEventData eventData) //{ // ToggleRecording(); //} public void ToggleRecording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); TextOutput.color = Color.white; } else { isRecording = true; StartCoroutine(DictationInputManager.StartRecording( this.gameObject)); TextOutput.color = Color.green; TextOutput.text = "..."; } }
/// <summary> /// Toggle recording (begin if not recording, end if still recording) /// </summary> private void ToggleRecording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); Debug.LogWarning("recording stopped"); dictationOutputText.color = Color.green; } else { isRecording = true; // set recording status to true StartCoroutine(DictationInputManager.StartRecording(5f, 2f, 30)); // begin recording dictationOutputText.color = Color.red; renderer.material.color = Color.red; } }
public void ToggleRecording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); speechToTextOutput.color = Color.white; buttonRenderer.enabled = true; recordLight.SetActive(false); } else { isRecording = true; StartCoroutine(DictationInputManager.StartRecording(initialSilenceTimeout, autoSilenceTimeout, recordingTime)); speechToTextOutput.color = Color.green; recordLight.SetActive(true); buttonRenderer.enabled = false; } }
public void ToggleRecording() { if (isRecording) { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); speechToTextOutput.color = Color.white; SetDictationState(false); //ButtonRenderer.enabled = true; } else { isRecording = true; StartCoroutine(DictationInputManager.StartRecording( gameObject, initialSilenceTimeout, autoSilenceTimeout, recordingTime)); speechToTextOutput.color = Color.green; SetDictationState(true); //ButtonRenderer.enabled = false; } }
/// <summary> /// Terminate dictation mode. /// </summary> public void EndDictation() { StartCoroutine(DictationInputManager.StopRecording()); SetMicrophoneDefault(); }
/// <summary> /// Initialize dictation mode. /// </summary> private void BeginDictation() { ResetClosingTime(); StartCoroutine(DictationInputManager.StartRecording(gameObject)); SetMicrophoneRecording(); }
public void StartListening() { PhraseRecognitionSystem.Shutdown(); isRecording = true; StartCoroutine(DictationInputManager.StartRecording(listener, initialSilenceTimeout, autoSilenceTimeout, recordingTime)); }
public void StopListening() { isRecording = false; StartCoroutine(DictationInputManager.StopRecording()); PhraseRecognitionSystem.Restart(); }