private void listVoices_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            //QuestToSpeech.Voice s = Array.Find(tmpSelectedList.ToArray(), delegate (QuestToSpeech.Voice tv) { return (tv.Gender == v.Gender && tv.Name == v.Name && tv.LangCode == v.LangCode && tv.Module == v.Module); });

            if (drawn)
            {
                QuestToSpeech.Voice voice = new QuestToSpeech.Voice()
                {
                    Name     = e.Item.SubItems[0].Text,
                    Gender   = e.Item.SubItems[1].Text == "Female" ? QuestToSpeech.Gender.Female : QuestToSpeech.Gender.Male,
                    LangCode = e.Item.SubItems[3].Text,
                    Module   = QuestToSpeech.GetModule(e.Item.SubItems[2].Text)
                };

                if (e.Item.Checked)
                {
                    if (!tmpSelectedList.Exists(vx => QuestToSpeech.IsVoice(vx, voice)))
                    {
                        tmpSelectedList.Add(voice);
                    }
                }
                else
                {
                    if (tmpSelectedList.Exists(vx => QuestToSpeech.IsVoice(vx, voice)))
                    {
                        tmpSelectedList.Remove(tmpSelectedList.Find(vx => QuestToSpeech.IsVoice(vx, voice)));
                    }
                }
            }

            lblNumTotalSelected.Text = string.Format("(Total selected {0})", tmpSelectedList.Count);
        }
        private void comboLangCodes_SelectedIndexChanged(object sender, EventArgs e)
        {
            drawn = false;

            listVoices.Items.Clear();

            string langCode = comboLangCodes.SelectedItem.ToString();

            //QuestToSpeech.Voice x = (QuestToSpeech.Voice)Array.Find(tmpSelectedList.ToArray(), delegate (QuestToSpeech.Voice v) { return v.LangCode == langCode; }); //if (x != null)

            foreach (QuestToSpeech.Voice v in voices)               // insert voices by selected lang code
            {
                if (v.LangCode == langCode)
                {
                    listVoices.Items.Add(v.Name).SubItems.AddRange(new string[] { v.Gender.ToString(), v.Module.ToString(), v.LangCode });

                    if (tmpSelectedList.Exists(v1 => QuestToSpeech.IsVoice(v1, v)))
                    {
                        listVoices.Items[listVoices.Items.Count - 1].Checked = true;
                    }
                }
            }

            drawn = true;
        }
Example #3
0
 private void WTSMainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     qts.Stop();
     qts = null;
     ChangeClipboardChain(Handle, nextClipboardViewer);             // restore default handler
     base.OnClosing(e);
 }
        private void btnTestVoice_Click(object sender, EventArgs e)
        {
            if (listVoices.SelectedItems.Count > 0)
            {
                ListViewItem i = listVoices.SelectedItems[0];

                testString = Prompt.InputDialog(string.Format("Voice: {2}, {0} ({1})", i.SubItems[0].Text, i.SubItems[1].Text, i.SubItems[2].Text), "Enter a sentence to speak", testString == null ? "" : testString);

                if (!string.IsNullOrWhiteSpace(testString))
                {
                    QuestToSpeech.Voice v = new QuestToSpeech.Voice()
                    {
                        Name     = i.SubItems[0].Text,
                        Gender   = i.SubItems[1].Text == "Female" ? QuestToSpeech.Gender.Female : QuestToSpeech.Gender.Male,
                        LangCode = i.SubItems[3].Text,
                        Module   = QuestToSpeech.GetModule(i.SubItems[2].Text)
                    };

                    Thread t = new Thread(() => VoiceTestSpeak(testString, v));
                    t.Start();
                }
            }
            else
            {
                MessageBox.Show("No row selected");
            }
        }
Example #5
0
        public MainForm()
        {
            InitializeComponent();
            nextClipboardViewer = (IntPtr)SetClipboardViewer((int)Handle);             // save clipboard handler

            txtActionLog.Text = string.Format("{0}[Loading]\r\n", txtActionLog.Text);

            qts                = new QuestToSpeech();
            qts.Started       += Qts_Started;
            qts.Stopped       += Qts_Stopped;
            qts.TextAdded     += Qts_TextAdded;
            qts.SpeechPrepare += Qts_SpeechPrepare;
            qts.SpeechStarted += Qts_SpeechStarted;
            qts.SpeechIdle    += Qts_SpeechIdle;
            qts.Error         += Qts_Error;
        }