Some widgets for volume control in sound config

This commit is contained in:
andres.delikat 2011-05-23 21:31:29 +00:00
parent 4a28b282f8
commit 7dc78cdaab
3 changed files with 65 additions and 6 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}
}
}