# HG changeset patch
# User StephaneLenclud
# Date 1423416840 -3600
# Node ID 0846e5112dd7f08b1a901736e01bee14c22ad588
# Parent 57b1c6507bd72b0825b66c34158f677d7070bc4d
Audio: adding support for mute status.
diff -r 57b1c6507bd7 -r 0846e5112dd7 Server/MainForm.Designer.cs
--- a/Server/MainForm.Designer.cs Sun Feb 08 17:27:02 2015 +0100
+++ b/Server/MainForm.Designer.cs Sun Feb 08 18:34:00 2015 +0100
@@ -96,6 +96,7 @@
this.labelFontHeight = new System.Windows.Forms.Label();
this.pictureBoxDemo = new System.Windows.Forms.PictureBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+ this.checkBoxMute = new System.Windows.Forms.CheckBox();
this.panelDisplay.SuspendLayout();
this.tableLayoutPanel.SuspendLayout();
this.statusStrip.SuspendLayout();
@@ -690,6 +691,7 @@
//
// tabPageAudio
//
+ this.tabPageAudio.Controls.Add(this.checkBoxMute);
this.tabPageAudio.Controls.Add(this.trackBarMasterVolume);
this.tabPageAudio.Location = new System.Drawing.Point(4, 22);
this.tabPageAudio.Name = "tabPageAudio";
@@ -739,6 +741,18 @@
this.pictureBoxDemo.TabIndex = 21;
this.pictureBoxDemo.TabStop = false;
//
+ // checkBoxMute
+ //
+ this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.checkBoxMute.AutoSize = true;
+ this.checkBoxMute.Location = new System.Drawing.Point(462, 219);
+ this.checkBoxMute.Name = "checkBoxMute";
+ this.checkBoxMute.Size = new System.Drawing.Size(50, 17);
+ this.checkBoxMute.TabIndex = 17;
+ this.checkBoxMute.Text = "Mute";
+ this.checkBoxMute.UseVisualStyleBackColor = true;
+ this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -841,6 +855,7 @@
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.TabPage tabPageAudio;
private System.Windows.Forms.TrackBar trackBarMasterVolume;
+ private System.Windows.Forms.CheckBox checkBoxMute;
}
}
diff -r 57b1c6507bd7 -r 0846e5112dd7 Server/MainForm.cs
--- a/Server/MainForm.cs Sun Feb 08 17:27:02 2015 +0100
+++ b/Server/MainForm.cs Sun Feb 08 18:34:00 2015 +0100
@@ -222,6 +222,18 @@
iMultiMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar = trackBarMasterVolume.Value / 100.0f;
}
+
+ ///
+ /// Mute check box changed.
+ ///
+ ///
+ ///
+ private void checkBoxMute_CheckedChanged(object sender, EventArgs e)
+ {
+ iMultiMediaDevice.AudioEndpointVolume.Mute = checkBoxMute.Checked;
+ }
+
+
///
/// Device State Changed
///
@@ -271,8 +283,11 @@
return;
}
+ //Update volume slider
float volumeLevelScalar = iMultiMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar;
trackBarMasterVolume.Value = Convert.ToInt32(volumeLevelScalar * 100);
+ //Update mute checkbox
+ checkBoxMute.Checked = iMultiMediaDevice.AudioEndpointVolume.Mute;
//TODO: Check our display device too
if (iDisplay.IsOpen())
@@ -293,6 +308,23 @@
}
}
}
+
+ int muteIconCount = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconMute);
+ if (muteIconCount > 0)
+ {
+ for (int i = 0; i < muteIconCount; i++)
+ {
+ if (iMultiMediaDevice.AudioEndpointVolume.Mute)
+ {
+ iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconMute, i, 10);
+ }
+ else
+ {
+ iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconMute, i, 0);
+ }
+ }
+ }
+
}
}