public MainWindow() { // Set UI font to system font this.Font = SystemFonts.MessageBoxFont; // Initialise UI InitializeComponent(); // Increase font size on source buttons studioButton.Font = new Font(studioButton.Font.FontFamily, 14, FontStyle.Regular); chartButton.Font = new Font(chartButton.Font.FontFamily, 14, FontStyle.Regular); obButton.Font = new Font(obButton.Font.FontFamily, 14, FontStyle.Regular); emergencyButton.Font = new Font(emergencyButton.Font.FontFamily, 14, FontStyle.Regular); // Create router router = new Router(this.Handle); // Handle router source changed event router.SourceChanged += SourceChanged; // Set to studio router.Source = Router.Sources.STUDIO; // Add audio devices to list studioInputComboBox.Items.Add("Default Input"); foreach (string device in router.GetDevices()) { studioInputComboBox.Items.Add(device); } // Handle audio events to update level metres router.SourceLevelMeterUpdate += SourceLevelMeterUpdate; router.OutputLevelMeterUpdate += OutputLevelMeterUpdate; // Add DSPs to list processorComboBox.Items.Add("None"); foreach (string processor in router.GetDSPs()) { processorComboBox.Items.Add(processor); } // Load user settings studioInputComboBox.SelectedIndex = Properties.Settings.Default.AudioInput; chartUrlTextBox.Text = Properties.Settings.Default.ChartShowURL; obUrlTextBox.Text = Properties.Settings.Default.ObURL; fileLabel.Text = Properties.Settings.Default.EmergencyFile; detectorUpDown.Value = Properties.Settings.Default.DetectorTime; processorComboBox.SelectedIndex = Properties.Settings.Default.Processor; clockIPTextBox.Text = Properties.Settings.Default.ClockIP; }
/// <summary> /// Updates source audio meters with sent levels /// </summary> /// <param name="sender">Sending object</param> /// <param name="e">Event arguments</param> private void SourceLevelMeterUpdate(object sender, Router.LevelEventArgs e) { sourceLeftMeter.Amplitude = (float)e.LeftLevel; sourceRightMeter.Amplitude = (float)e.RightLevel; }
/// <summary> /// Updates output audio meters with sent levels /// </summary> /// <param name="sender">Sending object</param> /// <param name="e">Event arguments</param> private void OutputLevelMeterUpdate(object sender, Router.LevelEventArgs e) { outputLeftMeter.Amplitude = (float)e.LeftLevel; outputRightMeter.Amplitude = (float)e.RightLevel; }