Inheritance: IDisposable
Ejemplo n.º 1
0
        public MainWindow()
        {
            controllerConfiguration = new ControllerConfiguration();
            InitializeComponent();
            setSelectedGameType();
            this.app_version.Text = CrewChief.Version;
            this.filenameLabel.Visible = System.Diagnostics.Debugger.IsAttached;
            this.filenameTextbox.Visible = System.Diagnostics.Debugger.IsAttached;
            this.recordSession.Visible = System.Diagnostics.Debugger.IsAttached;
            this.playbackInterval.Visible = System.Diagnostics.Debugger.IsAttached;
            CheckForIllegalCrossThreadCalls = false;
            Console.SetOut(new ControlWriter(textBox1));
            crewChief = new CrewChief();
            float messagesVolume = UserSettings.GetUserSettings().getFloat("messages_volume");
            float backgroundVolume = UserSettings.GetUserSettings().getFloat("background_volume");
            setMessagesVolume(messagesVolume);
            messagesVolumeSlider.Value = (int)(messagesVolume * 10f);
            backgroundVolumeSlider.Value = (int) (backgroundVolume * 10f);

            getControllers();
            controllerConfiguration.loadSettings(this);
            String customDeviceGuid = UserSettings.GetUserSettings().getString("custom_device_guid");
            if (customDeviceGuid != null && customDeviceGuid.Length > 0)
            {
                try
                {
                    Guid guid;
                    if (Guid.TryParse(customDeviceGuid, out guid)) {
                        controllerConfiguration.addCustomController(guid);
                    }
                    else
                    {
                        Console.WriteLine("Failed to add custom device, unable to process GUID");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to add custom device, message: " + e.Message);
                }
            }
            voiceOption = getVoiceOptionEnum(UserSettings.GetUserSettings().getString("VOICE_OPTION"));
            if (voiceOption == VoiceOptionEnum.DISABLED)
            {
                this.voiceDisableButton.Checked = true;
            }
            else if (voiceOption == VoiceOptionEnum.ALWAYS_ON)
            {
                this.alwaysOnButton.Checked = true;
            } else if (voiceOption == VoiceOptionEnum.HOLD)
            {
                this.holdButton.Checked = true;
            }
            else if (voiceOption == VoiceOptionEnum.TOGGLE)
            {
                this.toggleButton.Checked = true;
            }
            if (voiceOption != VoiceOptionEnum.DISABLED)
            {
                initialiseSpeechEngine();
            }
            runListenForButtonPressesThread = controllerConfiguration.listenForButtons(voiceOption == VoiceOptionEnum.TOGGLE);
            updateActions();
            this.assignButtonToAction.Enabled = false;
            this.deleteAssigmentButton.Enabled = false;

            if (UserSettings.GetUserSettings().getBoolean("run_immediately") &&
                GameDefinition.getGameDefinitionForFriendlyName(gameDefinitionList.Text) != null)
            {
                doStartAppStuff();
            }
        }
 public SpeechRecogniser(CrewChief crewChief)
 {
     this.crewChief = crewChief;
     if (minimum_name_voice_recognition_confidence < 0 || minimum_name_voice_recognition_confidence > 1)
     {
         minimum_name_voice_recognition_confidence = 0.4f;
     }
     if (minimum_voice_recognition_confidence < 0 || minimum_voice_recognition_confidence > 1)
     {
         minimum_voice_recognition_confidence = 0.5f;
     }
 }
Ejemplo n.º 3
0
 public AudioPlayer(CrewChief crewChief)
 {
     this.crewChief = crewChief;
 }