From 7dc78cdaab40d53558285d7bbc9da9e6308d2167 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Mon, 23 May 2011 21:31:29 +0000 Subject: [PATCH] Some widgets for volume control in sound config --- BizHawk.MultiClient/Config.cs | 1 + .../config/SoundConfig.Designer.cs | 57 +++++++++++++++++-- BizHawk.MultiClient/config/SoundConfig.cs | 13 ++++- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 227f2558d1..60c25dbe2d 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -132,6 +132,7 @@ // Sound options public bool SoundEnabled = true; public bool MuteFrameAdvance = true; + public int SoundVolume = 100; //Range 0-100 // Lua Console public RecentFiles RecentLua = new RecentFiles(8); diff --git a/BizHawk.MultiClient/config/SoundConfig.Designer.cs b/BizHawk.MultiClient/config/SoundConfig.Designer.cs index f0ac64027f..47e1737d73 100644 --- a/BizHawk.MultiClient/config/SoundConfig.Designer.cs +++ b/BizHawk.MultiClient/config/SoundConfig.Designer.cs @@ -32,12 +32,19 @@ this.OK = new System.Windows.Forms.Button(); this.SoundOnCheckBox = new System.Windows.Forms.CheckBox(); this.MuteFrameAdvance = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.SoundVolNumeric = new System.Windows.Forms.NumericUpDown(); + this.SoundVolBar = new System.Windows.Forms.TrackBar(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.SoundVolNumeric)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.SoundVolBar)).BeginInit(); this.SuspendLayout(); // // 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(198, 174); + this.Cancel.Location = new System.Drawing.Point(268, 251); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.TabIndex = 0; @@ -47,7 +54,8 @@ // // OK // - this.OK.Location = new System.Drawing.Point(112, 174); + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OK.Location = new System.Drawing.Point(187, 251); this.OK.Name = "OK"; this.OK.Size = new System.Drawing.Size(75, 23); this.OK.TabIndex = 1; @@ -58,7 +66,7 @@ // SoundOnCheckBox // this.SoundOnCheckBox.AutoSize = true; - this.SoundOnCheckBox.Location = new System.Drawing.Point(12, 12); + this.SoundOnCheckBox.Location = new System.Drawing.Point(215, 12); this.SoundOnCheckBox.Name = "SoundOnCheckBox"; this.SoundOnCheckBox.Size = new System.Drawing.Size(74, 17); this.SoundOnCheckBox.TabIndex = 2; @@ -68,20 +76,52 @@ // MuteFrameAdvance // this.MuteFrameAdvance.AutoSize = true; - this.MuteFrameAdvance.Location = new System.Drawing.Point(12, 35); + this.MuteFrameAdvance.Location = new System.Drawing.Point(215, 35); this.MuteFrameAdvance.Name = "MuteFrameAdvance"; this.MuteFrameAdvance.Size = new System.Drawing.Size(128, 17); this.MuteFrameAdvance.TabIndex = 3; this.MuteFrameAdvance.Text = "Mute Frame Advance"; this.MuteFrameAdvance.UseVisualStyleBackColor = true; // + // groupBox1 + // + this.groupBox1.Controls.Add(this.SoundVolBar); + this.groupBox1.Controls.Add(this.SoundVolNumeric); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(90, 219); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Volume"; + // + // SoundVolNumeric + // + this.SoundVolNumeric.Location = new System.Drawing.Point(16, 190); + this.SoundVolNumeric.Name = "SoundVolNumeric"; + this.SoundVolNumeric.Size = new System.Drawing.Size(59, 20); + this.SoundVolNumeric.TabIndex = 0; + this.SoundVolNumeric.ValueChanged += new System.EventHandler(this.SoundVolNumeric_ValueChanged); + // + // SoundVolBar + // + this.SoundVolBar.LargeChange = 10; + this.SoundVolBar.Location = new System.Drawing.Point(23, 23); + this.SoundVolBar.Maximum = 100; + this.SoundVolBar.Name = "SoundVolBar"; + this.SoundVolBar.Orientation = System.Windows.Forms.Orientation.Vertical; + this.SoundVolBar.Size = new System.Drawing.Size(45, 164); + this.SoundVolBar.TabIndex = 1; + this.SoundVolBar.TickFrequency = 10; + this.SoundVolBar.Scroll += new System.EventHandler(this.trackBar1_Scroll); + // // SoundConfig // 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(280, 209); + this.ClientSize = new System.Drawing.Size(355, 286); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.MuteFrameAdvance); this.Controls.Add(this.SoundOnCheckBox); this.Controls.Add(this.OK); @@ -89,6 +129,10 @@ this.Name = "SoundConfig"; this.Text = "Sound Configuration"; this.Load += new System.EventHandler(this.SoundConfig_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.SoundVolNumeric)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SoundVolBar)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -100,5 +144,8 @@ private System.Windows.Forms.Button OK; private System.Windows.Forms.CheckBox SoundOnCheckBox; private System.Windows.Forms.CheckBox MuteFrameAdvance; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.NumericUpDown SoundVolNumeric; + private System.Windows.Forms.TrackBar SoundVolBar; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/config/SoundConfig.cs b/BizHawk.MultiClient/config/SoundConfig.cs index bf14a204d2..164d70f8ff 100644 --- a/BizHawk.MultiClient/config/SoundConfig.cs +++ b/BizHawk.MultiClient/config/SoundConfig.cs @@ -26,7 +26,8 @@ namespace BizHawk.MultiClient { Global.Config.SoundEnabled = SoundOnCheckBox.Checked; Global.Config.MuteFrameAdvance = MuteFrameAdvance.Checked; - Global.Sound.StartSound(); + Global.Config.SoundVolume = SoundVolBar.Value; + Global.Sound.StartSound(); this.Close(); } @@ -34,5 +35,15 @@ namespace BizHawk.MultiClient { this.Close(); } + + private void trackBar1_Scroll(object sender, EventArgs e) + { + SoundVolNumeric.Value = SoundVolBar.Value; + } + + private void SoundVolNumeric_ValueChanged(object sender, EventArgs e) + { + SoundVolBar.Value = (int)SoundVolNumeric.Value; + } } }