diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 090d236cc4..2e91582944 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -101,6 +101,7 @@ namespace BizHawk.MultiClient public SNESGameGenie SNESgg = new SNESGameGenie(); public GBGameGenie GBgg = new GBGameGenie(); public GenGameGenie Gengg = new GenGameGenie(); + public NESSoundConfig NesSound = new NESSoundConfig(); #if WINDOWS public LuaConsole LuaConsole1 = new LuaConsole(); #endif @@ -3677,6 +3678,20 @@ namespace BizHawk.MultiClient RamSearch1.Focus(); } + public void LoadNesSoundConfig() + { + if (Global.Emulator is NES) + { + if (!NesSound.IsHandleCreated || NesSound.IsDisposed) + { + NesSound = new NESSoundConfig(); + NesSound.Show(); + } + else + NesSound.Focus(); + } + } + public void LoadGameGenieEC() { @@ -5072,13 +5087,7 @@ namespace BizHawk.MultiClient private void soundChannelsToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.Emulator is NES) - { - Global.Sound.StopSound(); - NESSoundConfig config = new NESSoundConfig(); - config.ShowDialog(); - Global.Sound.StartSound(); - } + LoadNesSoundConfig(); } public void ClearSaveRAM() diff --git a/BizHawk.MultiClient/NEStools/NESSoundConfig.Designer.cs b/BizHawk.MultiClient/NEStools/NESSoundConfig.Designer.cs index d68a8dedfe..eee6cb2a2e 100644 --- a/BizHawk.MultiClient/NEStools/NESSoundConfig.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESSoundConfig.Designer.cs @@ -79,7 +79,7 @@ // this.trackBar1.Location = new System.Drawing.Point(12, 12); this.trackBar1.Name = "trackBar1"; - this.trackBar1.Size = new System.Drawing.Size(104, 42); + this.trackBar1.Size = new System.Drawing.Size(104, 45); this.trackBar1.TabIndex = 2; this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged); // @@ -87,7 +87,7 @@ // this.trackBar2.Location = new System.Drawing.Point(12, 60); this.trackBar2.Name = "trackBar2"; - this.trackBar2.Size = new System.Drawing.Size(104, 42); + this.trackBar2.Size = new System.Drawing.Size(104, 45); this.trackBar2.TabIndex = 3; this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged); // @@ -95,7 +95,7 @@ // this.trackBar3.Location = new System.Drawing.Point(12, 108); this.trackBar3.Name = "trackBar3"; - this.trackBar3.Size = new System.Drawing.Size(104, 42); + this.trackBar3.Size = new System.Drawing.Size(104, 45); this.trackBar3.TabIndex = 4; this.trackBar3.ValueChanged += new System.EventHandler(this.trackBar3_ValueChanged); // @@ -103,7 +103,7 @@ // this.trackBar4.Location = new System.Drawing.Point(12, 156); this.trackBar4.Name = "trackBar4"; - this.trackBar4.Size = new System.Drawing.Size(104, 42); + this.trackBar4.Size = new System.Drawing.Size(104, 45); this.trackBar4.TabIndex = 5; this.trackBar4.ValueChanged += new System.EventHandler(this.trackBar4_ValueChanged); // @@ -111,7 +111,7 @@ // this.trackBar5.Location = new System.Drawing.Point(12, 204); this.trackBar5.Name = "trackBar5"; - this.trackBar5.Size = new System.Drawing.Size(104, 42); + this.trackBar5.Size = new System.Drawing.Size(104, 45); this.trackBar5.TabIndex = 6; this.trackBar5.ValueChanged += new System.EventHandler(this.trackBar5_ValueChanged); // @@ -229,6 +229,7 @@ this.Controls.Add(this.trackBar1); this.Controls.Add(this.Cancel); this.Controls.Add(this.OK); + this.MaximizeBox = false; this.Name = "NESSoundConfig"; this.ShowIcon = false; this.Text = "NES Sound Channels"; diff --git a/BizHawk.MultiClient/NEStools/NESSoundConfig.cs b/BizHawk.MultiClient/NEStools/NESSoundConfig.cs index fc481c1116..572054e1ae 100644 --- a/BizHawk.MultiClient/NEStools/NESSoundConfig.cs +++ b/BizHawk.MultiClient/NEStools/NESSoundConfig.cs @@ -5,6 +5,7 @@ namespace BizHawk.MultiClient { public partial class NESSoundConfig : Form { + int sq1, sq2, tr, no, dmc = 0; public NESSoundConfig() { InitializeComponent(); @@ -22,21 +23,29 @@ namespace BizHawk.MultiClient trackBar3.Value = Global.Config.NESTriangle; trackBar4.Value = Global.Config.NESNoise; trackBar5.Value = Global.Config.NESDMC; + //save value for cancel + sq1 = Global.Config.NESSquare1; + sq2 = Global.Config.NESSquare2; + tr = Global.Config.NESTriangle; + no = Global.Config.NESNoise; + dmc = Global.Config.NESDMC; } private void OK_Click(object sender, EventArgs e) { - Global.Config.NESSquare1 = trackBar1.Value; - Global.Config.NESSquare2 = trackBar2.Value; - Global.Config.NESTriangle = trackBar3.Value; - Global.Config.NESNoise = trackBar4.Value; - Global.Config.NESDMC = trackBar5.Value; - Global.MainForm.SetNESSoundChannels(); Close(); } private void Cancel_Click(object sender, EventArgs e) { + //restore previous value + //restore value + Global.Config.NESSquare1 = sq1; + Global.Config.NESSquare2 = sq2; + Global.Config.NESTriangle = tr; + Global.Config.NESNoise = no; + Global.Config.NESDMC = dmc; + Global.MainForm.SetNESSoundChannels(); Close(); } @@ -65,26 +74,36 @@ namespace BizHawk.MultiClient private void trackBar1_ValueChanged(object sender, EventArgs e) { label6.Text = trackBar1.Value.ToString(); + Global.Config.NESSquare1 = trackBar1.Value; + Global.MainForm.SetNESSoundChannels(); } private void trackBar2_ValueChanged(object sender, EventArgs e) { label7.Text = trackBar2.Value.ToString(); + Global.Config.NESSquare2 = trackBar2.Value; + Global.MainForm.SetNESSoundChannels(); } private void trackBar3_ValueChanged(object sender, EventArgs e) { label8.Text = trackBar3.Value.ToString(); + Global.Config.NESTriangle = trackBar3.Value; + Global.MainForm.SetNESSoundChannels(); } private void trackBar4_ValueChanged(object sender, EventArgs e) { label9.Text = trackBar4.Value.ToString(); + Global.Config.NESNoise = trackBar4.Value; + Global.MainForm.SetNESSoundChannels(); } private void trackBar5_ValueChanged(object sender, EventArgs e) { label10.Text = trackBar5.Value.ToString(); + Global.Config.NESDMC = trackBar5.Value; + Global.MainForm.SetNESSoundChannels(); } } }