Final version, implementing in Java

This commit is contained in:
Norbi Peti 2017-11-10 22:45:30 +01:00
parent c6d3c0f3b5
commit 16e9450c03
2 changed files with 20 additions and 5 deletions

View file

@ -29,11 +29,12 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.devicelist = new System.Windows.Forms.ComboBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(417, 90); this.button1.Location = new System.Drawing.Point(139, 12);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1; this.button1.TabIndex = 1;
@ -41,20 +42,34 @@
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// devicelist
//
this.devicelist.FormattingEnabled = true;
this.devicelist.Location = new System.Drawing.Point(12, 12);
this.devicelist.Name = "devicelist";
this.devicelist.Size = new System.Drawing.Size(121, 21);
this.devicelist.TabIndex = 2;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(733, 299); this.ClientSize = new System.Drawing.Size(239, 50);
this.Controls.Add(this.devicelist);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Form1"; this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Spectrum Analyzer";
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox devicelist;
} }
} }

View file

@ -21,13 +21,13 @@ namespace MCAudioSpectrumAnalyzer
{ {
InitializeComponent(); InitializeComponent();
Instance = this; Instance = this;
Analyzer = new Analyzer(new ProgressBar(), new ProgressBar(), new ComboBox()); Analyzer = new Analyzer(new ProgressBar(), new ProgressBar(), devicelist);
} }
public void Set(List<byte> data) public void Set(List<byte> data)
{ {
if (data.Count < 16) return; if (data.Count < 16) return;
client.Send(data.ToArray(), data.Count, new IPEndPoint(IPAddress.Loopback, 5896)); //TODO: Make visualiser source selectable client.Send(data.ToArray(), data.Count, new IPEndPoint(IPAddress.Loopback, 5896));
} }
private UdpClient client = new UdpClient(AddressFamily.InterNetwork); private UdpClient client = new UdpClient(AddressFamily.InterNetwork);