Make the UI easier to understand

This commit is contained in:
Stone_Red
2022-06-16 20:34:39 +02:00
parent 92820f6e8d
commit 843d6b1bee
2 changed files with 38 additions and 28 deletions
+31 -21
View File
@@ -57,29 +57,32 @@
legend2.Name = "Legend1";
this.chart1.Legends.Add(legend2);
this.chart1.Location = new System.Drawing.Point(0, 0);
this.chart1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.chart1.Name = "chart1";
series2.ChartArea = "ChartArea1";
series2.Legend = "Legend1";
series2.Name = "Series1";
this.chart1.Series.Add(series2);
this.chart1.Size = new System.Drawing.Size(664, 300);
this.chart1.Size = new System.Drawing.Size(996, 462);
this.chart1.TabIndex = 0;
this.chart1.Text = "chart1";
//
// barCountNumericUpDown
//
this.barCountNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.barCountNumericUpDown.Location = new System.Drawing.Point(14, 324);
this.barCountNumericUpDown.Location = new System.Drawing.Point(21, 498);
this.barCountNumericUpDown.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.barCountNumericUpDown.Name = "barCountNumericUpDown";
this.barCountNumericUpDown.Size = new System.Drawing.Size(120, 20);
this.barCountNumericUpDown.Size = new System.Drawing.Size(180, 26);
this.barCountNumericUpDown.TabIndex = 1;
//
// flattenValueNumericUpDown
//
this.flattenValueNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.flattenValueNumericUpDown.Location = new System.Drawing.Point(140, 324);
this.flattenValueNumericUpDown.Location = new System.Drawing.Point(210, 498);
this.flattenValueNumericUpDown.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.flattenValueNumericUpDown.Name = "flattenValueNumericUpDown";
this.flattenValueNumericUpDown.Size = new System.Drawing.Size(120, 20);
this.flattenValueNumericUpDown.Size = new System.Drawing.Size(180, 26);
this.flattenValueNumericUpDown.TabIndex = 2;
this.flattenValueNumericUpDown.Value = new decimal(new int[] {
4,
@@ -91,9 +94,10 @@
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 302);
this.label1.Location = new System.Drawing.Point(21, 465);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(57, 13);
this.label1.Size = new System.Drawing.Size(85, 20);
this.label1.TabIndex = 3;
this.label1.Text = "Bar Count:";
//
@@ -101,9 +105,10 @@
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(140, 302);
this.label2.Location = new System.Drawing.Point(210, 465);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 13);
this.label2.Size = new System.Drawing.Size(108, 20);
this.label2.TabIndex = 4;
this.label2.Text = "Flatten Value:";
//
@@ -111,30 +116,33 @@
//
this.volumeTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.volumeTrackBar.Location = new System.Drawing.Point(392, 324);
this.volumeTrackBar.Location = new System.Drawing.Point(588, 498);
this.volumeTrackBar.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.volumeTrackBar.Maximum = 199;
this.volumeTrackBar.Name = "volumeTrackBar";
this.volumeTrackBar.Size = new System.Drawing.Size(260, 45);
this.volumeTrackBar.Size = new System.Drawing.Size(390, 69);
this.volumeTrackBar.TabIndex = 5;
this.volumeTrackBar.Value = 185;
this.volumeTrackBar.Value = 100;
//
// volumeLabel
//
this.volumeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.volumeLabel.AutoSize = true;
this.volumeLabel.Location = new System.Drawing.Point(389, 308);
this.volumeLabel.Location = new System.Drawing.Point(584, 474);
this.volumeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.volumeLabel.Name = "volumeLabel";
this.volumeLabel.Size = new System.Drawing.Size(45, 13);
this.volumeLabel.Size = new System.Drawing.Size(74, 20);
this.volumeLabel.TabIndex = 6;
this.volumeLabel.Text = "Volume:";
this.volumeLabel.Text = "Amplifier:";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(266, 302);
this.label3.Location = new System.Drawing.Point(399, 465);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 13);
this.label3.Size = new System.Drawing.Size(102, 20);
this.label3.TabIndex = 8;
this.label3.Text = "Buffer Value:";
//
@@ -147,21 +155,22 @@
0,
0,
65536});
this.bufferValueNumericUpDown.Location = new System.Drawing.Point(266, 324);
this.bufferValueNumericUpDown.Location = new System.Drawing.Point(399, 498);
this.bufferValueNumericUpDown.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.bufferValueNumericUpDown.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.bufferValueNumericUpDown.Name = "bufferValueNumericUpDown";
this.bufferValueNumericUpDown.Size = new System.Drawing.Size(120, 20);
this.bufferValueNumericUpDown.Size = new System.Drawing.Size(180, 26);
this.bufferValueNumericUpDown.TabIndex = 7;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(664, 356);
this.ClientSize = new System.Drawing.Size(996, 548);
this.Controls.Add(this.label3);
this.Controls.Add(this.bufferValueNumericUpDown);
this.Controls.Add(this.volumeLabel);
@@ -171,6 +180,7 @@
this.Controls.Add(this.flattenValueNumericUpDown);
this.Controls.Add(this.barCountNumericUpDown);
this.Controls.Add(this.chart1);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "MainForm";
this.Text = "MainForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
+7 -7
View File
@@ -54,7 +54,7 @@ namespace AudioVisualizer
{
if (InvokeRequired)
{
BeginInvoke(new EventHandler<WaveInEventArgs>(OnDataAvailable), sender, e);
_ = BeginInvoke(new EventHandler<WaveInEventArgs>(OnDataAvailable), sender, e);
}
else
{
@@ -77,13 +77,13 @@ namespace AudioVisualizer
List<double> fft = new List<double>();
//Adding values form e.Result to fft List
for (int i = 0; i < e.Result.Length / 2 - 70; i++)
for (int i = 0; i < (e.Result.Length / 2) - 70; i++)
{
fft.Add(Math.Abs(e.Result[i].Y * i / (200 - volumeTrackBar.Value)));
}
//set volumeLabel to the current volume
volumeLabel.Text = "Volume: " + (volumeTrackBar.Value + 1) + " | " + (200 - volumeTrackBar.Value);
//Set volumeLabel to the current volume
volumeLabel.Text = "Amplifier: " + (volumeTrackBar.Value + 1);
//Check if the previous fft list isn't 0
if (lastFft.Count != 0)
@@ -97,7 +97,7 @@ namespace AudioVisualizer
}
else
{
fft[i] = lastFft[i] - (double)bufferValueNumericUpDown.Value / 1000;
fft[i] = lastFft[i] - ((1.1 - (double)bufferValueNumericUpDown.Value) / 1000);
}
}
}
@@ -113,7 +113,7 @@ namespace AudioVisualizer
{
double temp = 0;
int j;
for (j = i * count; j < count + i * count; j++)
for (j = i * count; j < count + (i * count); j++)
{
temp += fft[j];
}
@@ -171,7 +171,7 @@ namespace AudioVisualizer
for (int i = 0; i < scaledFft.Count; i++)
{
chart1.Series[0].Points.AddY(scaledFft[i]);
_ = chart1.Series[0].Points.AddY(scaledFft[i]);
}
}