private void VolumeMonitor_Click(object sender, EventArgs e) { try { if (VolumeMonitor.Checked != true) { if (MaxStockClock < 1100) { DialogResult dialogResult = MessageBox.Show("Enabling a mixer on a computer with poor specs could make the driver stutter.\n\nAre you sure you want to enable it?", "Weak processor detected", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { VolumeMonitor.Checked = true; Settings.SetValue("VolumeMonitor", "1", RegistryValueKind.DWord); MeterFunc.EnableLEDs(); VUStatus = true; MeterFunc.ChangeMeter(0, 0); MeterFunc.ChangeMeter(1, 0); } } else if (MaxStockClock >= 1100) { VolumeMonitor.Checked = true; Settings.SetValue("VolumeMonitor", "1", RegistryValueKind.DWord); MeterFunc.EnableLEDs(); VUStatus = true; MeterFunc.ChangeMeter(0, 0); MeterFunc.ChangeMeter(1, 0); } } else { VolumeMonitor.Checked = false; Settings.SetValue("VolumeMonitor", "0", RegistryValueKind.DWord); MeterFunc.DisableLEDs(); VUStatus = false; } } catch (Exception ex) { MessageBox.Show("Can not write settings to the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void CheckIfXAudio_Tick(object sender, EventArgs e) { try { if (Convert.ToInt32(Settings.GetValue("CurrentEngine")) == 0) { if (VUStatus != false) { MeterFunc.DisableLEDs(); VUStatus = false; } } else { if (Convert.ToInt32(Settings.GetValue("VolumeMonitor")) == 1) { if (VUStatus != true) { MeterFunc.EnableLEDs(); VUStatus = true; } } else { if (VUStatus != false) { MeterFunc.DisableLEDs(); VUStatus = false; } } } System.Threading.Thread.Sleep(10); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void KeppySynthMixerWindow_Load(object sender, EventArgs e) { try { base.DoubleBuffered = true; SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); Delegate = this; CPUSpeed(); if (Channels == null) { Registry.CurrentUser.CreateSubKey("SOFTWARE\\OmniMIDI\\Channels"); return; } for (int i = 0; i <= 15; ++i) { RegValInt[i] = Convert.ToInt32(Channels.GetValue(RegValName[i], 100)); if (RegValInt[i] > 100) { RegValInt[i] = 100; } } CH1VOL.Value = RegValInt[0]; CH2VOL.Value = RegValInt[1]; CH3VOL.Value = RegValInt[2]; CH4VOL.Value = RegValInt[3]; CH5VOL.Value = RegValInt[4]; CH6VOL.Value = RegValInt[5]; CH7VOL.Value = RegValInt[6]; CH8VOL.Value = RegValInt[7]; CH9VOL.Value = RegValInt[8]; CH10VOL.Value = RegValInt[9]; CH11VOL.Value = RegValInt[10]; CH12VOL.Value = RegValInt[11]; CH13VOL.Value = RegValInt[12]; CH14VOL.Value = RegValInt[13]; CH15VOL.Value = RegValInt[14]; CH16VOL.Value = RegValInt[15]; MainVol.Value = RegValInt.Max(); if (Convert.ToInt32(Settings.GetValue("VolumeMonitor")) == 1) { VolumeMonitor.Checked = true; MeterFunc.EnableLEDs(); VUStatus = true; } else { VolumeMonitor.Checked = false; MeterFunc.DisableLEDs(); VUStatus = false; } ChannelVolume.Enabled = true; GarbageCollector.RunWorkerAsync(); Meter.ContextMenu = PeakMeterMenu; VolumeCheck.Interval = Convert.ToInt32((1.0 / Properties.Settings.Default.VolUpdateHz) * 1000.0); if (Properties.Settings.Default.CurrentTheme == 0) { ClassicTheme.PerformClick(); } else if (Properties.Settings.Default.CurrentTheme == 1) { DarkTheme.PerformClick(); } else if (Properties.Settings.Default.CurrentTheme == 2) { ItsThe80sTheme.PerformClick(); } else { ClassicTheme.PerformClick(); } } catch (Exception ex) { MessageBox.Show("Can not read settings from the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }