Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public SAPIEngine()
        {
            SAPISettings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);
            SAPISettings = SAPISettings.Load();

            Synthesizer.SetOutputToDefaultAudioDevice();
            Synthesizer.BookmarkReached += speechSynthesizer_BookmarkReached;
        }
Beispiel #2
0
        /// <summary>
        /// Form loader.  Init settings and update the ui
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            float currentAspectRatio = (float)ClientSize.Height / ClientSize.Width;

            if (_designTimeAspectRatio != 0.0f && currentAspectRatio != _designTimeAspectRatio)
            {
                ClientSize = new System.Drawing.Size(ClientSize.Width, (int)(_designTimeAspectRatio * ClientSize.Width));
            }

            TopMost = true;

            CenterToScreen();

            _settings = SAPIEngine.SAPISettings;
            if (String.IsNullOrEmpty(SAPISettings.PreferencesFilePath))
            {
                SAPISettings.PreferencesFilePath = UserManager.GetFullPath(SAPIEngine.SettingsFileName);
            }

            if (_settings == null)
            {
                _settings = SAPISettings.Load();
            }

            _speechSynthesizer = new SpeechSynthesizer();

            var ins = _speechSynthesizer.GetInstalledVoices(CultureInfo.DefaultThreadCurrentUICulture);

            foreach (InstalledVoice iv in ins)
            {
                comboBoxSelectVoice.Items.Add(iv.VoiceInfo.Name);
            }

            if (comboBoxSelectVoice.Items.Count == 0)
            {
                checkBoxSelectVoice.Checked = false;
                checkBoxSelectVoice.Enabled = false;
            }

            comboBoxSelectVoice.DropDownStyle = ComboBoxStyle.DropDownList;

            comboBoxGender.Items.Clear();

            comboBoxGender.Items.Add(VoiceGender.Female.ToString());
            comboBoxGender.Items.Add(VoiceGender.Male.ToString());

            comboBoxGender.DropDownStyle = ComboBoxStyle.DropDownList;

            updateUI(_settings);

            _dirty = false;
        }
Beispiel #3
0
        /// <summary>
        /// User clicked on the Settings button.  Show other
        /// settings for the TTS engine
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void buttonSettings_Click(object sender, EventArgs e)
        {
            Hide();

            var form = new PreferencesEditForm
            {
                Title = Text,
                SupportsPreferencesObj = new SAPIEngine()
            };

            form.ShowDialog();

            Show();

            _settings = SAPISettings.Load();
        }