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

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

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

                EDDConfig.Instance.DefaultVoiceDevice = discoveryform.AudioQueueSpeech.Driver.GetAudioEndpoint();
            }
        }
Пример #2
0
        public override bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars)
        {
            string             saying;
            ConditionVariables vars;

            FromString(userdata, out saying, out vars);

            Audio.SpeechConfigure cfg = new Audio.SpeechConfigure();
            cfg.Init(discoveryform.AudioQueueSpeech, discoveryform.SpeechSynthesizer,
                     "Set Text to say (use ; to separate randomly selectable phrases and {} to group)", "Configure Say Command",
                     saying,
                     vars.Exists(waitname), vars.Exists(literalname),
                     Audio.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 != Audio.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);
        }