Exemple #1
0
        private void cbLoopbackDevices_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbLoopbackDevices.SelectedIndex > 0)
            {
                if (cbEnable.Checked) //start loopback on new device, or stop loopback
                {
                    if ((string)cbLoopbackDevices.SelectedItem == "")
                    {
                        stopLoopback();
                    }
                    else
                    {
                        startLoopback();
                    }
                }
                else
                {
                    stopLoopback();
                }
            }

            string deviceName = (string)cbLoopbackDevices.SelectedItem;

            XMLSettings.soundboardSettings.LastLoopbackDevice = deviceName;

            XMLSettings.SaveSoundboardSettingsXML();
        }
Exemple #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Keys[] keysArr = null;
            string error   = "";

            if (string.IsNullOrWhiteSpace(tbStopSoundKeys.Text) || Helper.keysArrayFromString(tbStopSoundKeys.Text, out keysArr, out error))
            {
                if (loadXMLFilesList.Count == 0 || loadXMLFilesList.All(x => x.Keys.Length > 0 && !string.IsNullOrWhiteSpace(x.XMLLocation) && File.Exists(x.XMLLocation)))
                {
                    XMLSettings.soundboardSettings.StopSoundKeys = (keysArr == null ? new Keys[] { } : keysArr);

                    XMLSettings.soundboardSettings.LoadXMLFiles = loadXMLFilesList.ToArray();

                    XMLSettings.soundboardSettings.MinimizeToTray = cbMinimizeToTray.Checked;

                    XMLSettings.soundboardSettings.PlaySoundsOverEachOther = cbPlaySoundsOverEachOther.Checked;

                    XMLSettings.SaveSoundboardSettingsXML();

                    this.Close();
                }
                else
                {
                    MessageBox.Show("One or more entries either have no keys added, the location is empty, or the file the location points to does not exist");
                }
            }
            else if (error != "")
            {
                MessageBox.Show(error);
            }
        }
Exemple #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!Helper.stringToKeysArray(tbStopSoundKeys.Text, out Keyboard.Keys[] keysArray, out _))
            {
                keysArray = new Keyboard.Keys[] { }
            }
            ;

            if (loadXMLFilesList.Count == 0 || loadXMLFilesList.All(x => x.Keys.Length > 0 && !string.IsNullOrWhiteSpace(x.XMLLocation) && File.Exists(x.XMLLocation)))
            {
                XMLSettings.soundboardSettings.StopSoundKeys = keysArray;

                XMLSettings.soundboardSettings.LoadXMLFiles = loadXMLFilesList.ToArray();

                XMLSettings.soundboardSettings.StartWithWindows = cbStartWithWindows.Checked;
                Helper.setStartup(XMLSettings.soundboardSettings.StartWithWindows);

                XMLSettings.soundboardSettings.StartMinimised = cbStartMinimised.Checked;

                XMLSettings.soundboardSettings.MinimiseToTray = cbMinimiseToTray.Checked;

                XMLSettings.SaveSoundboardSettingsXML();

                this.Close();
            }
            else
            {
                MessageBox.Show("One or more entries either have no keys added, the location is empty, or the file the location points to does not exist");
            }
        }
Exemple #4
0
        private void cbPlaybackDevices_SelectedIndexChanged(object sender, EventArgs e)
        {
            //start loopback on new device and stop all sounds playing
            if (loopbackWaveOut != null && loopbackSourceStream != null && cbEnable.Checked)
            {
                startLoopback();
            }

            stopPlayback();

            string deviceName = (string)cbPlaybackDevices.SelectedItem;

            XMLSettings.soundboardSettings.LastPlaybackDevice = deviceName;

            XMLSettings.SaveSoundboardSettingsXML();
        }
Exemple #5
0
 private void saveSettingsTimer_Tick(object sender, EventArgs e)
 {
     //only save settings after no setting changes have been made for one second
     saveSettingsTimer.Stop();
     XMLSettings.SaveSoundboardSettingsXML();
 }
Exemple #6
0
        public MainForm()
        {
            InitializeComponent();

            var tooltip = new ToolTip();

            tooltip.SetToolTip(btnReloadDevices, "Refresh sound devices");
            tooltip.SetToolTip(btnReloadWindows, "Reload windows");
            tooltip.SetToolTip(cbPlaybackDevices1, PLAYBACK1_TOOLTIP);
            tooltip.SetToolTip(cbPlaybackDevices2, PLAYBACK2_TOOLTIP);
            tooltip.SetToolTip(cbLoopbackDevices, LOOPBACK_TOOLTIP);
            tooltip.SetToolTip(lblPlayback1, PLAYBACK1_TOOLTIP);
            tooltip.SetToolTip(lblPlayback2, PLAYBACK2_TOOLTIP);
            tooltip.SetToolTip(lblLoopback, LOOPBACK_TOOLTIP);
            tooltip.SetToolTip(vsSoundVolume, SOUND_VOLUME_TOOLTIP);
            tooltip.SetToolTip(nSoundVolume, SOUND_VOLUME_TOOLTIP);

            XMLSettings.LoadSoundboardSettingsXML();

            //Disable change events for elements that would trigger settings changes and unnecessarily write to settings.xml
            DisableCheckboxChangeEvents();
            DisableSoundVolumeChangeEvents();

            loadSoundDevices(false); //false argument keeps device change events disabled

            Helper.getWindows(cbWindows);
            Helper.selectWindow(cbWindows, XMLSettings.soundboardSettings.AutoPushToTalkWindow);

            if (XMLSettings.soundboardSettings.StartMinimised)
            {
                this.WindowState = FormWindowState.Minimized;

                if (XMLSettings.soundboardSettings.MinimiseToTray)
                {
                    this.HideFormToTray();
                }
            }

            Helper.setStartup(XMLSettings.soundboardSettings.StartWithWindows);

            cbEnableHotkeys.Checked  = XMLSettings.soundboardSettings.EnableHotkeys;
            cbEnableLoopback.Checked = XMLSettings.soundboardSettings.EnableLoopback;

            soundVolume          = XMLSettings.soundboardSettings.SoundVolume;
            vsSoundVolume.Volume = soundVolume;
            nSoundVolume.Value   = Helper.linearVolumeToInteger(vsSoundVolume.Volume); //needed because change events are still disabled

            pushToTalkKey = XMLSettings.soundboardSettings.AutoPushToTalkKey;

            tbPushToTalkKey.Text = pushToTalkKey.ToString() == "None" ? "" : pushToTalkKey.ToString();

            cbEnablePushToTalk.Checked = XMLSettings.soundboardSettings.EnableAutoPushToTalk;
            tbPushToTalkKey.Enabled    = !cbEnablePushToTalk.Checked;
            clearHotkey.Enabled        = !cbEnablePushToTalk.Checked;

            if (File.Exists(XMLSettings.soundboardSettings.LastXMLFile))
            {
                //loadXMLFile() returns true if error occurred
                if (loadXMLFile(XMLSettings.soundboardSettings.LastXMLFile))
                {
                    XMLSettings.soundboardSettings.LastXMLFile = "";
                    XMLSettings.SaveSoundboardSettingsXML();
                }
            }

            //Add events after settings have been loaded
            EnableCheckboxChangeEvents();
            EnableSoundVolumeChangeEvents();
            EnableDeviceChangeEvents();

            mainTimer.Enabled = cbEnableHotkeys.Checked;
            initAudioPlaybackEngine1();
            initAudioPlaybackEngine2();
            restartLoopback();

            //When sound stops, fire event which lets go of push-to-talk key.
            playbackEngine1.AllInputEnded += OnAllInputEnded;
            //Don't need to stop holding the push-to-talk key when engine2 stops playing, that's just our in-ear echo.
        }