private void InitaliseTTS() { SpeechEngine.AddCallback(() => { locales = Locale.AllLocales; locales = locales.OrderBy(go => go.Informations).ToArray(); voices = SpeechEngine.AvaillableVoices; voices = voices.OrderBy(go => go.Name).ToArray(); engines = SpeechEngine.AvailableEngines; engines = engines.OrderBy(go => go.Label).ToArray(); localeDropdown.AddOptions(locales.Select(elem => elem.Informations).ToList()); voicesDropdown.AddOptions(voices.Select(elem => elem.Name).ToList()); engineDropdown.AddOptions(engines.Select(elem => elem.Label).ToList()); localeDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetLanguage(locales[value]); voicesDropdown.ClearOptions(); voices = SpeechEngine.AvaillableVoices; voicesDropdown.AddOptions(voices.Select(elem => elem.Name).ToList()); }); voicesDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetVoice(voices[value]); }); engineDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetEngine(engines[value]); }); }); }
private void InitSpeechEngine() { SpeechEngine.AddCallback(() => { locales = Locale.AllLocales; // SpeechEngine.AvailableLocales; voices = SpeechEngine.AvaillableVoices; engines = SpeechEngine.AvailableEngines; localesDropdown.AddOptions(locales.Select(elem => elem.Informations).ToList()); voicesDropdown.AddOptions(voices.Select(elem => elem.Name).ToList()); enginesDropdown.AddOptions(engines.Select(elem => elem.Label).ToList()); SpeechEngine.AddListeners(null, pitchSlider, speechRateSlider); localesDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetLanguage(locales[value]); voicesDropdown.ClearOptions(); voices = SpeechEngine.AvaillableVoices; voicesDropdown.AddOptions(voices.Select(elem => elem.Name).ToList()); }); voicesDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetVoice(voices[value]); }); enginesDropdown.onValueChanged.AddListener(value => { SpeechEngine.SetEngine(engines[value]); }); }); }