Пример #1
0
        public void ConfigureVoice(string title)
        {
            string             voicename = persistentglobalvariables.GetString(ActionSay.globalvarspeechvoice, "Default");
            string             volume    = persistentglobalvariables.GetString(ActionSay.globalvarspeechvolume, "Default");
            string             rate      = persistentglobalvariables.GetString(ActionSay.globalvarspeechrate, "Default");
            ConditionVariables effects   = new ConditionVariables(persistentglobalvariables.GetString(ActionSay.globalvarspeecheffects, ""), ConditionVariables.FromMode.MultiEntryComma);

            SpeechConfigure cfg = new SpeechConfigure();

            cfg.Init(discoveryform.AudioQueueSpeech, discoveryform.SpeechSynthesizer,
                     "Select voice synthesizer defaults", title,
                     null, false, false, AudioExtensions.AudioQueue.Priority.Normal, "", "",
                     voicename,
                     volume,
                     rate,
                     effects);

            if (cfg.ShowDialog(discoveryform) == DialogResult.OK)
            {
                SetPeristentGlobal(ActionSay.globalvarspeechvoice, cfg.VoiceName);
                SetPeristentGlobal(ActionSay.globalvarspeechvolume, cfg.Volume);
                SetPeristentGlobal(ActionSay.globalvarspeechrate, cfg.Rate);
                SetPeristentGlobal(ActionSay.globalvarspeecheffects, cfg.Effects.ToString());

                EDDConfig.Instance.DefaultVoiceDevice = discoveryform.AudioQueueSpeech.Driver.GetAudioEndpoint();
            }
        }
Пример #2
0
        private void SC(float size, bool mode)
        {
            theme.FontSize = size;
            AudioDriverCSCore   ad  = new AudioDriverCSCore();
            AudioQueue          q   = new AudioQueue(ad);
            WindowsSpeechEngine wse = new WindowsSpeechEngine();
            SpeechSynthesizer   ss  = new SpeechSynthesizer(wse);

            SpeechConfigure c = new SpeechConfigure();

            Variables ef = new Variables();

            c.Init(q, ss, "Check SC", "Caption title", this.Icon, mode ? "Text to do" : null,
                   true, true, AudioQueue.Priority.High,
                   "sn", "en", "Sheila", "100", "Default", ef);

            c.ShowDialog(this);
        }
Пример #3
0
        public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars)
        {
            string             saying;
            ConditionVariables vars;

            FromString(userdata, out saying, out vars);

            SpeechConfigure cfg = new SpeechConfigure();

            cfg.Init(cp.AudioQueueSpeech, cp.SpeechSynthesizer,
                     "Set Text to say (use ; to separate randomly selectable phrases and {} to group)", "Configure Say Command",
                     saying,
                     vars.Exists(waitname), vars.Exists(literalname),
                     AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")),
                     vars.GetString(startname, ""),
                     vars.GetString(finishname, ""),
                     vars.GetString(voicename, "Default"),
                     vars.GetString(volumename, "Default"),
                     vars.GetString(ratename, "Default"),
                     vars
                     );

            if (cfg.ShowDialog(parent) == DialogResult.OK)
            {
                ConditionVariables cond = new ConditionVariables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge
                cond.SetOrRemove(cfg.Wait, waitname, "1");
                cond.SetOrRemove(cfg.Literal, literalname, "1");
                cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString());
                cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent);
                cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent);
                cond.SetOrRemove(!cfg.VoiceName.Equals("Default", StringComparison.InvariantCultureIgnoreCase), voicename, cfg.VoiceName);
                cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume);
                cond.SetOrRemove(!cfg.Rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase), ratename, cfg.Rate);

                userdata = ToString(cfg.SayText, cond);
                return(true);
            }

            return(false);
        }