public void OnInit([GeneratedEnum] OperationResult status) { if (status == OperationResult.Success) { try { var list = toSpeech.Voices; foreach (var item in list) { if (item.Name == configuracion.TipoVoz) { v = item; break; } } if (v != null) { toSpeech.SetVoice(v); } toSpeech.SetSpeechRate(configuracion.Velocidad); toSpeech.SetLanguage(new Locale("es", "ES")); toSpeech.Speak(textToSpeak, QueueMode.Flush, null); Thread.Sleep(2000); } catch (Exception e) { Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } while (true) { if (!toSpeech.IsSpeaking) { Log.Info(LOG_TAG, "he terminado de hablar"); toSpeech.Stop(); toSpeech.Shutdown(); break; } } if (record) { speechReco.StartListening(intentReco); } else if (!record && textToSpeak == "Sesión cerrada correctamente") { this.FinishAffinity(); } } }
public void OnInit([GeneratedEnum] OperationResult status) { if (status == OperationResult.Success) { try { if (v != null) { toSpeech.SetVoice(v); } toSpeech.SetSpeechRate(configuracion.Velocidad); toSpeech.SetLanguage(new Locale("es", "ES")); toSpeech.Speak(textToSpeak, QueueMode.Flush, null); System.Threading.Thread.Sleep(2000); } catch (Exception e) { Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } while (true) { if (!toSpeech.IsSpeaking) { Log.Info(LOG_TAG, "he terminado de hablar"); toSpeech.Stop(); toSpeech.Shutdown(); break; } } if (record) { speechReco.StartListening(intentReco); } } }