Exemple #1
0
        /// <summary>
        /// Loads the voices installed on the system
        /// </summary>
        protected override void LoadVoices()
        {
            if (speechSynth == null)
            {
                return;
            }
            try
            {
                string voiceName;
                int    i = 0;

                // Retrieves the first voice of the Loquendo TTS found on the system
                voiceName = speechSynth.EnumFirstVoice(String.Empty);
                while (!String.IsNullOrEmpty(voiceName))
                {
                    if (voiceNames.ContainsKey(voiceName))
                    {
                        continue;
                    }
                    voiceNames.Add(voiceName, i++);
                    voiceName = speechSynth.EnumNextVoice();
                }

                string lang = speechSynth.EnumFirstLanguage(String.Empty);
                while (!String.IsNullOrEmpty(lang))
                {
                    lang = speechSynth.EnumNextLanguage();
                }

                if (voiceNames.ContainsKey("Susan"))
                {
                    SelectedVoiceIndex = voiceNames["Susan"];
                }
                else
                {
                    SelectedVoiceIndex = 0;
                }
            }
            catch
            {
                voiceNames.Clear();
            }
        }