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]); }); }); }
void Start() { SpeechEngine.AddListeners(toggle, pitchSlider, speechRateSlider); }