From e66e70534a4fea240387238716b1a970c8d243ec Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Thu, 7 Sep 2017 10:26:27 -0400 Subject: [PATCH] NESHawk: Audio slider --- .../config/NES/NESSoundConfig.Designer.cs | 307 +++++------------- .../config/NES/NESSoundConfig.cs | 42 +-- 2 files changed, 84 insertions(+), 265 deletions(-) diff --git a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.Designer.cs index 3eeacc6191..22e5372ca6 100644 --- a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.Designer.cs @@ -28,220 +28,87 @@ /// private void InitializeComponent() { - this.OK = new System.Windows.Forms.Button(); - this.Cancel = new System.Windows.Forms.Button(); - this.trackBar1 = new System.Windows.Forms.TrackBar(); - this.trackBar2 = new System.Windows.Forms.TrackBar(); - this.trackBar3 = new System.Windows.Forms.TrackBar(); - this.trackBar4 = new System.Windows.Forms.TrackBar(); - this.trackBar5 = new System.Windows.Forms.TrackBar(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).BeginInit(); - this.SuspendLayout(); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(41, 262); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 0; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.Ok_Click); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(122, 262); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 1; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - this.Cancel.Click += new System.EventHandler(this.Cancel_Click); - // - // trackBar1 - // - this.trackBar1.Location = new System.Drawing.Point(12, 12); - this.trackBar1.Name = "trackBar1"; - this.trackBar1.Size = new System.Drawing.Size(104, 45); - this.trackBar1.TabIndex = 2; - this.trackBar1.ValueChanged += new System.EventHandler(this.TrackBar1_ValueChanged); - // - // trackBar2 - // - this.trackBar2.Location = new System.Drawing.Point(12, 60); - this.trackBar2.Name = "trackBar2"; - this.trackBar2.Size = new System.Drawing.Size(104, 45); - this.trackBar2.TabIndex = 3; - this.trackBar2.ValueChanged += new System.EventHandler(this.TrackBar2_ValueChanged); - // - // trackBar3 - // - this.trackBar3.Location = new System.Drawing.Point(12, 108); - this.trackBar3.Name = "trackBar3"; - this.trackBar3.Size = new System.Drawing.Size(104, 45); - this.trackBar3.TabIndex = 4; - this.trackBar3.ValueChanged += new System.EventHandler(this.TrackBar3_ValueChanged); - // - // trackBar4 - // - this.trackBar4.Location = new System.Drawing.Point(12, 156); - this.trackBar4.Name = "trackBar4"; - this.trackBar4.Size = new System.Drawing.Size(104, 45); - this.trackBar4.TabIndex = 5; - this.trackBar4.ValueChanged += new System.EventHandler(this.TrackBar4_ValueChanged); - // - // trackBar5 - // - this.trackBar5.Location = new System.Drawing.Point(12, 204); - this.trackBar5.Name = "trackBar5"; - this.trackBar5.Size = new System.Drawing.Size(104, 45); - this.trackBar5.TabIndex = 6; - this.trackBar5.ValueChanged += new System.EventHandler(this.TrackBar5_ValueChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(122, 12); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(50, 13); - this.label1.TabIndex = 7; - this.label1.Text = "Square 1"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(122, 60); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(50, 13); - this.label2.TabIndex = 8; - this.label2.Text = "Square 2"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(122, 108); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(45, 13); - this.label3.TabIndex = 9; - this.label3.Text = "Triangle"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(122, 156); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(34, 13); - this.label4.TabIndex = 10; - this.label4.Text = "Noise"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(122, 204); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(31, 13); - this.label5.TabIndex = 11; - this.label5.Text = "DMC"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(122, 25); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(13, 13); - this.label6.TabIndex = 12; - this.label6.Text = "0"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(122, 73); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(13, 13); - this.label7.TabIndex = 13; - this.label7.Text = "0"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(122, 121); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(13, 13); - this.label8.TabIndex = 14; - this.label8.Text = "0"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(122, 169); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(13, 13); - this.label9.TabIndex = 15; - this.label9.Text = "0"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(122, 217); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(13, 13); - this.label10.TabIndex = 16; - this.label10.Text = "0"; - // - // NESSoundConfig - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(209, 297); - this.Controls.Add(this.label10); - this.Controls.Add(this.label9); - this.Controls.Add(this.label8); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.trackBar5); - this.Controls.Add(this.trackBar4); - this.Controls.Add(this.trackBar3); - this.Controls.Add(this.trackBar2); - 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.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "NES Sound Channels"; - this.Load += new System.EventHandler(this.NESSoundConfig_Load); - ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.OK = new System.Windows.Forms.Button(); + this.Cancel = new System.Windows.Forms.Button(); + this.trackBar1 = new System.Windows.Forms.TrackBar(); + this.label1 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); + this.SuspendLayout(); + // + // OK + // + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OK.Location = new System.Drawing.Point(41, 117); + this.OK.Name = "OK"; + this.OK.Size = new System.Drawing.Size(75, 23); + this.OK.TabIndex = 0; + this.OK.Text = "&OK"; + this.OK.UseVisualStyleBackColor = true; + this.OK.Click += new System.EventHandler(this.Ok_Click); + // + // Cancel + // + this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Cancel.Location = new System.Drawing.Point(122, 117); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 1; + this.Cancel.Text = "&Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.Click += new System.EventHandler(this.Cancel_Click); + // + // trackBar1 + // + this.trackBar1.LargeChange = 1; + this.trackBar1.Location = new System.Drawing.Point(12, 12); + this.trackBar1.Minimum = 1; + this.trackBar1.Name = "trackBar1"; + this.trackBar1.Size = new System.Drawing.Size(104, 45); + this.trackBar1.TabIndex = 2; + this.trackBar1.Value = 1; + this.trackBar1.ValueChanged += new System.EventHandler(this.TrackBar1_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(122, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(67, 13); + this.label1.TabIndex = 7; + this.label1.Text = "APU Volume"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(122, 25); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(13, 13); + this.label6.TabIndex = 12; + this.label6.Text = "0"; + // + // NESSoundConfig + // + this.AcceptButton = this.OK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(209, 152); + this.Controls.Add(this.label6); + this.Controls.Add(this.label1); + 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.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "NES Sound Channels"; + this.Load += new System.EventHandler(this.NESSoundConfig_Load); + ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -250,19 +117,7 @@ private System.Windows.Forms.Button OK; private System.Windows.Forms.Button Cancel; private System.Windows.Forms.TrackBar trackBar1; - private System.Windows.Forms.TrackBar trackBar2; - private System.Windows.Forms.TrackBar trackBar3; - private System.Windows.Forms.TrackBar trackBar4; - private System.Windows.Forms.TrackBar trackBar5; private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label10; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs index 725f4ba2c4..ac3a8f198f 100644 --- a/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs +++ b/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs @@ -38,11 +38,7 @@ namespace BizHawk.Client.EmuHawk // get baseline maxes from a default config object var d = new NES.NESSettings(); - trackBar1.Maximum = d.Square1; - trackBar2.Maximum = d.Square2; - trackBar3.Maximum = d.Triangle; - trackBar4.Maximum = d.Noise; - trackBar5.Maximum = d.DMC; + trackBar1.Minimum = d.APU_vol; } private void NESSoundConfig_Load(object sender, EventArgs e) @@ -50,11 +46,7 @@ namespace BizHawk.Client.EmuHawk _oldSettings = NES.GetSettings(); _settings = _oldSettings.Clone(); - trackBar1.Value = _settings.Square1; - trackBar2.Value = _settings.Square2; - trackBar3.Value = _settings.Triangle; - trackBar4.Value = _settings.Noise; - trackBar5.Value = _settings.DMC; + trackBar1.Value = _settings.APU_vol; } private void Ok_Click(object sender, EventArgs e) @@ -72,35 +64,7 @@ namespace BizHawk.Client.EmuHawk private void TrackBar1_ValueChanged(object sender, EventArgs e) { label6.Text = trackBar1.Value.ToString(); - _settings.Square1 = trackBar1.Value; - NES.PutSettings(_settings); - } - - private void TrackBar2_ValueChanged(object sender, EventArgs e) - { - label7.Text = trackBar2.Value.ToString(); - _settings.Square2 = trackBar2.Value; - NES.PutSettings(_settings); - } - - private void TrackBar3_ValueChanged(object sender, EventArgs e) - { - label8.Text = trackBar3.Value.ToString(); - _settings.Triangle = trackBar3.Value; - NES.PutSettings(_settings); - } - - private void TrackBar4_ValueChanged(object sender, EventArgs e) - { - label9.Text = trackBar4.Value.ToString(); - _settings.Noise = trackBar4.Value; - NES.PutSettings(_settings); - } - - private void TrackBar5_ValueChanged(object sender, EventArgs e) - { - label10.Text = trackBar5.Value.ToString(); - _settings.DMC = trackBar5.Value; + _settings.APU_vol = trackBar1.Value; NES.PutSettings(_settings); } }