Simply sending all data at once

This commit is contained in:
Norbi Peti 2017-11-06 22:48:18 +01:00 committed by BuildTools
parent 9301abaf8a
commit c6d3c0f3b5

View file

@ -27,34 +27,10 @@ namespace MCAudioSpectrumAnalyzer
public void Set(List<byte> data) public void Set(List<byte> data)
{ {
if (data.Count < 16) return; if (data.Count < 16) return;
//for (int i = 0; i < data.Count / 2; i++) client.Send(data.ToArray(), data.Count, new IPEndPoint(IPAddress.Loopback, 5896)); //TODO: Make visualiser source selectable
/*for (int i = 0; i < 1; i++)
if (data[i] == 0)
SetBar((byte)i, 1);
else
SetBar((byte)i, data[i * 2]);*/
byte i = 10;
if (data[i] == 0)
SetBar(0, 1);
else
SetBar(0, data[i]);
} }
/*
128.234 56 -622.622 -0.9 -21.1
Removed unnecessary block clearups
Made it catch up to 25 Hz
Fixed snow layer data value setting
*/
private UdpClient client = new UdpClient(AddressFamily.InterNetwork); private UdpClient client = new UdpClient(AddressFamily.InterNetwork);
private void SetBar(byte index, byte data)
{
//byte value = (byte)((((double)data) / 255) * 80);
client.Send(new byte[2] { (byte)(index + 1), data }, 2, new IPEndPoint(IPAddress.Loopback, 5896));
}
private Analyzer Analyzer; private Analyzer Analyzer;
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {