コード例 #1
0
 private void RecButton_Click(object sender, System.EventArgs e)
 {
     if (recButton.Text == "Start Recording")
     {
         recButton.Text = "End Recording";
         sr.StartListening(this.CreateSpeechIntent());
     }
     else
     {
         recButton.Text = "Start Recording";
         sr.Destroy();
         sr = SpeechRecognizer.CreateSpeechRecognizer(this);
         sr.SetRecognitionListener(this);
         //sr.StopListening();
     }
 }
コード例 #2
0
 void StopRecognizer()
 {
     _speechRecognizer?.StopListening();
     _speechRecognizer?.Cancel();
     _speechRecognizer?.Destroy();
     _speechRecognizer = null;
     CancelDialog();
 }
コード例 #3
0
        protected void InitializeRecognizer()
        {
            lock (speechRecognizerLock)
            {
                if (speechRecognizer != null)
                {
                    speechRecognizer.Destroy();
                    speechRecognizer = null;
                }

                speechRecognizer = SpeechRecognizer.CreateSpeechRecognizer(context);

                speechRecognizer.ReadyForSpeech += SpeechRecognizer_ReadyForSpeech;
                speechRecognizer.RmsChanged     += SpeechRecognizer_RmsChanged;
                speechRecognizer.EndOfSpeech    += SpeechRecognizer_EndOfSpeech;

                speechRecognizer.Results += SpeechRecognizer_Results;
                speechRecognizer.Error   += SpeechRecognizer_Error;
            }
        }
コード例 #4
0
 void startover()
 {
     _speech.Destroy();
     _speech = SpeechRecognizer.CreateSpeechRecognizer(this._context);
     _speech.SetRecognitionListener(this);
     _speechIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
     _speechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1000);
     _speechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1000);
     _speechIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 1500);
 StartListening();
 }
コード例 #5
0
 void StopRecognizer()
 {
     Mvx.Resolve <IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
     {
         _speechRecognizer?.StopListening();
         _speechRecognizer?.Cancel();
         _speechRecognizer?.Destroy();
         _speechRecognizer = null;
         CancelDialog();
     });
 }