void Update() { if (Input.GetKeyDown(KeyCode.A)) { startDictation(); } if (Input.GetKeyUp(KeyCode.A)) { dictationResponse thisResponse = endDictation(); Debug.Log(thisResponse.text); AudioSource thisSource = transform.gameObject.AddComponent <AudioSource>(); thisSource.clip = thisResponse.clip; thisSource.Play(); } }
public dictationResponse endDictation() { Debug.Log("End Dictation"); m_DictationRecognizer.Stop(); Microphone.End(null); dictationResponse newResponse = new dictationResponse(); newResponse.text = m_Recognitions; if (m_Recognitions.Length > 0) { newResponse.clip = tempClip; } return(newResponse); }