void Speak(TTSText text) { if (!string.IsNullOrEmpty(text.Voice)) { synthesizer.SelectVoice(text.Voice); } synthesizer.SpeakAsync(text.Text); TextSpoken?.Invoke(text.Voice, text.Text); }
void fireTextSpokenEvent(string text) { try { Task t = new Task(() => { if (TextSpoken != null) { try { TextSpoken.Invoke(this, new AudioRendererTextEventArgs(text)); } catch (Exception) { } } }); t.Start(); } catch (Exception) { } }