Audio: adding support for mute status.
1.1 --- a/Server/MainForm.Designer.cs Sun Feb 08 17:27:02 2015 +0100
1.2 +++ b/Server/MainForm.Designer.cs Sun Feb 08 18:34:00 2015 +0100
1.3 @@ -96,6 +96,7 @@
1.4 this.labelFontHeight = new System.Windows.Forms.Label();
1.5 this.pictureBoxDemo = new System.Windows.Forms.PictureBox();
1.6 this.toolTip = new System.Windows.Forms.ToolTip(this.components);
1.7 + this.checkBoxMute = new System.Windows.Forms.CheckBox();
1.8 this.panelDisplay.SuspendLayout();
1.9 this.tableLayoutPanel.SuspendLayout();
1.10 this.statusStrip.SuspendLayout();
1.11 @@ -690,6 +691,7 @@
1.12 //
1.13 // tabPageAudio
1.14 //
1.15 + this.tabPageAudio.Controls.Add(this.checkBoxMute);
1.16 this.tabPageAudio.Controls.Add(this.trackBarMasterVolume);
1.17 this.tabPageAudio.Location = new System.Drawing.Point(4, 22);
1.18 this.tabPageAudio.Name = "tabPageAudio";
1.19 @@ -739,6 +741,18 @@
1.20 this.pictureBoxDemo.TabIndex = 21;
1.21 this.pictureBoxDemo.TabStop = false;
1.22 //
1.23 + // checkBoxMute
1.24 + //
1.25 + this.checkBoxMute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
1.26 + this.checkBoxMute.AutoSize = true;
1.27 + this.checkBoxMute.Location = new System.Drawing.Point(462, 219);
1.28 + this.checkBoxMute.Name = "checkBoxMute";
1.29 + this.checkBoxMute.Size = new System.Drawing.Size(50, 17);
1.30 + this.checkBoxMute.TabIndex = 17;
1.31 + this.checkBoxMute.Text = "Mute";
1.32 + this.checkBoxMute.UseVisualStyleBackColor = true;
1.33 + this.checkBoxMute.CheckedChanged += new System.EventHandler(this.checkBoxMute_CheckedChanged);
1.34 + //
1.35 // MainForm
1.36 //
1.37 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
1.38 @@ -841,6 +855,7 @@
1.39 private System.Windows.Forms.ToolTip toolTip;
1.40 private System.Windows.Forms.TabPage tabPageAudio;
1.41 private System.Windows.Forms.TrackBar trackBarMasterVolume;
1.42 + private System.Windows.Forms.CheckBox checkBoxMute;
1.43 }
1.44 }
1.45
2.1 --- a/Server/MainForm.cs Sun Feb 08 17:27:02 2015 +0100
2.2 +++ b/Server/MainForm.cs Sun Feb 08 18:34:00 2015 +0100
2.3 @@ -222,6 +222,18 @@
2.4 iMultiMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar = trackBarMasterVolume.Value / 100.0f;
2.5 }
2.6
2.7 +
2.8 + /// <summary>
2.9 + /// Mute check box changed.
2.10 + /// </summary>
2.11 + /// <param name="sender"></param>
2.12 + /// <param name="e"></param>
2.13 + private void checkBoxMute_CheckedChanged(object sender, EventArgs e)
2.14 + {
2.15 + iMultiMediaDevice.AudioEndpointVolume.Mute = checkBoxMute.Checked;
2.16 + }
2.17 +
2.18 +
2.19 /// <summary>
2.20 /// Device State Changed
2.21 /// </summary>
2.22 @@ -271,8 +283,11 @@
2.23 return;
2.24 }
2.25
2.26 + //Update volume slider
2.27 float volumeLevelScalar = iMultiMediaDevice.AudioEndpointVolume.MasterVolumeLevelScalar;
2.28 trackBarMasterVolume.Value = Convert.ToInt32(volumeLevelScalar * 100);
2.29 + //Update mute checkbox
2.30 + checkBoxMute.Checked = iMultiMediaDevice.AudioEndpointVolume.Mute;
2.31
2.32 //TODO: Check our display device too
2.33 if (iDisplay.IsOpen())
2.34 @@ -293,6 +308,23 @@
2.35 }
2.36 }
2.37 }
2.38 +
2.39 + int muteIconCount = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconMute);
2.40 + if (muteIconCount > 0)
2.41 + {
2.42 + for (int i = 0; i < muteIconCount; i++)
2.43 + {
2.44 + if (iMultiMediaDevice.AudioEndpointVolume.Mute)
2.45 + {
2.46 + iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconMute, i, 10);
2.47 + }
2.48 + else
2.49 + {
2.50 + iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconMute, i, 0);
2.51 + }
2.52 + }
2.53 + }
2.54 +
2.55 }
2.56
2.57 }