public ActionController(EDDiscoveryForm frm, EDDiscoveryController ctrl, System.Drawing.Icon ic) : base(frm, ic) { discoveryform = frm; discoverycontroller = ctrl; #if !NO_SYSTEM_SPEECH // Windows TTS (2000 and above). Speech *recognition* will be Version.Major >= 6 (Vista and above) if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5 && !EDDOptions.Instance.NoSound) { audiodriverwave = AudioHelper.GetAudioDriver(ctrl.LogLineHighlight, EDDConfig.Instance.DefaultWaveDevice); audiodriverspeech = AudioHelper.GetAudioDriver(ctrl.LogLineHighlight, EDDConfig.Instance.DefaultVoiceDevice); ISpeechEngine speechengine; speechengine = AudioHelper.GetSpeechEngine(ctrl.LogLineHighlight); speechsynth = new AudioExtensions.SpeechSynthesizer(speechengine); voicerecon = AudioHelper.GetVoiceRecognition(ctrl.LogLineHighlight); } else { audiodriverwave = new AudioExtensions.AudioDriverDummy(); audiodriverspeech = new AudioExtensions.AudioDriverDummy(); speechsynth = new AudioExtensions.SpeechSynthesizer(new AudioExtensions.DummySpeechEngine()); voicerecon = new AudioExtensions.VoiceRecognitionDummy(); } #else audiodriverwave = new AudioExtensions.AudioDriverDummy(); audiodriverspeech = new AudioExtensions.AudioDriverDummy(); speechsynth = new AudioExtensions.SpeechSynthesizer(new AudioExtensions.DummySpeechEngine()); voicerecon = new AudioExtensions.VoiceRecognitionDummy(); #endif audioqueuewave = new AudioExtensions.AudioQueue(audiodriverwave); audioqueuespeech = new AudioExtensions.AudioQueue(audiodriverspeech); frontierbindings = new BindingsFile(); inputdevices = new DirectInputDevices.InputDeviceList(a => discoveryform.BeginInvoke(a)); inputdevicesactions = new Actions.ActionsFromInputDevices(inputdevices, frontierbindings, this); frontierbindings.LoadBindingsFile(); //System.Diagnostics.Debug.WriteLine("Bindings" + frontierbindings.ListBindings()); //System.Diagnostics.Debug.WriteLine("Key Names" + frontierbindings.ListKeyNames("{","}")); voicerecon.SpeechRecognised += Voicerecon_SpeechRecognised; voicerecon.SpeechNotRecognised += Voicerecon_SpeechNotRecognised; ConditionFunctions.GetCFH = DefaultGetCFH; LoadPeristentVariables(new ConditionVariables(SQLiteConnectionUser.GetSettingString("UserGlobalActionVars", ""), ConditionVariables.FromMode.MultiEntryComma)); lasteditedpack = SQLiteConnectionUser.GetSettingString("ActionPackLastFile", ""); ActionBase.AddCommand("Bookmarks", typeof(ActionBookmarks), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Commodities", typeof(ActionCommodities), ActionBase.ActionType.Cmd); ActionBase.AddCommand("DLLCall", typeof(ActionDLLCall), ActionBase.ActionType.Cmd); ActionBase.AddCommand("EliteBindings", typeof(ActionEliteBindings), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Event", typeof(ActionEventCmd), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Historytab", typeof(ActionHistoryTab), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Key", typeof(ActionKeyED), ActionBase.ActionType.Cmd); // override key ActionBase.AddCommand("Ledger", typeof(ActionLedger), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Materials", typeof(ActionMaterials), ActionBase.ActionType.Cmd); ActionBase.AddCommand("MenuItem", typeof(ActionMenuItem), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Perform", typeof(ActionPerform), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Play", typeof(ActionPlay), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Popout", typeof(ActionPopout), ActionBase.ActionType.Cmd); ActionBase.AddCommand("ProgramWindow", typeof(ActionProgramwindow), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Scan", typeof(ActionScan), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Ship", typeof(ActionShip), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Star", typeof(ActionStar), ActionBase.ActionType.Cmd); ActionBase.AddCommand("Timer", typeof(ActionTimer), ActionBase.ActionType.Cmd); }
public void Init(AudioQueue qu, SpeechSynthesizer syn, string title, string caption, String text, // if null, no text box or wait complete bool waitcomplete, bool literal, AudioQueue.Priority prio, string startname, string endname, string voicename, string volume, string rate, ConditionVariables ef) // effects can also contain other vars, it will ignore { comboBoxCustomPriority.Items.AddRange(Enum.GetNames(typeof(AudioQueue.Priority))); queue = qu; synth = syn; this.Text = caption; Title.Text = title; textBoxBorderTest.Text = "The quick brown fox jumped over the lazy dog"; bool defaultmode = (text == null); if (defaultmode) { textBoxBorderText.Visible = checkBoxCustomComplete.Visible = comboBoxCustomPriority.Visible = labelStartTrigger.Visible = labelEndTrigger.Visible = checkBoxCustomLiteral.Visible = textBoxBorderStartTrigger.Visible = checkBoxCustomV.Visible = checkBoxCustomR.Visible = textBoxBorderEndTrigger.Visible = false; int offset = comboBoxCustomVoice.Top - textBoxBorderText.Top; foreach (Control c in panelOuter.Controls) { if (!c.Name.Equals("Title")) { c.Location = new Point(c.Left, c.Top - offset); } } this.Height -= offset; } else { textBoxBorderText.Text = text; checkBoxCustomComplete.Checked = waitcomplete; checkBoxCustomLiteral.Checked = literal; comboBoxCustomPriority.SelectedItem = prio.ToString(); textBoxBorderStartTrigger.Text = startname; textBoxBorderEndTrigger.Text = endname; buttonExtDevice.Visible = false; } comboBoxCustomVoice.Items.Add("Default"); comboBoxCustomVoice.Items.Add("Female"); comboBoxCustomVoice.Items.Add("Male"); comboBoxCustomVoice.Items.AddRange(synth.GetVoiceNames()); if (comboBoxCustomVoice.Items.Contains(voicename)) { comboBoxCustomVoice.SelectedItem = voicename; } else { comboBoxCustomVoice.SelectedIndex = 0; } int i; if (!defaultmode && volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase)) { checkBoxCustomV.Checked = false; trackBarVolume.Enabled = false; } else { checkBoxCustomV.Checked = true; if (volume.InvariantParse(out i)) { trackBarVolume.Value = i; } } if (!defaultmode && rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase)) { checkBoxCustomR.Checked = false; trackBarRate.Enabled = false; } else { checkBoxCustomR.Checked = true; if (rate.InvariantParse(out i)) { trackBarRate.Value = i; } } effects = ef; BaseUtils.ThemeAbleFormsInstance.Instance.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont); }