private void Update()
 {
     if (!DictationInputManager.IsListening && !submittedRequest)
     {
         StartCoroutine(DictationInputManager.StartRecording());
     }
 }
    /// <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;
    }
Пример #3
0
 public void OnInputClicked(InputClickedEventData eventData)
 {
     if (!DictationInputManager.IsListening)
     {
         StartCoroutine(DictationInputManager.StartRecording());
     }
     else
     {
         StartCoroutine(DictationInputManager.StopRecording());
     }
 }
Пример #4
0
    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));
        }
    }
Пример #5
0
 private void ToggleRecording()
 {
     if (isRecording)
     {
         isRecording = false;
         StartCoroutine(DictationInputManager.StopRecording());
     }
     else
     {
         isRecording = true;
         StartCoroutine(DictationInputManager.StartRecording(listener, autoSilenceTimeout, recordingTime));
     }
 }
Пример #6
0
 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");
 }
Пример #7
0
 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;
     }
 }
Пример #8
0
    //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  = "...";
        }
    }
Пример #9
0
 /// <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;
     }
 }
Пример #10
0
 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;
     }
 }
Пример #11
0
 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;
     }
 }
Пример #12
0
 /// <summary>
 /// Initialize dictation mode.
 /// </summary>
 private void BeginDictation()
 {
     ResetClosingTime();
     StartCoroutine(DictationInputManager.StartRecording(gameObject));
     SetMicrophoneRecording();
 }
Пример #13
0
 public void StartListening()
 {
     PhraseRecognitionSystem.Shutdown();
     isRecording = true;
     StartCoroutine(DictationInputManager.StartRecording(listener, initialSilenceTimeout, autoSilenceTimeout, recordingTime));
 }