public void update(AmplitudeData amplitudeData, int maxLength) { if (amplitudeDataLength != amplitudeData.DataList.Count()) { amplitudeDataLength = amplitudeData.DataList.Count(); ampData.Clear(); } ampData.Add(amplitudeData.DataList); while (ampData.Count > maxLength) { ampData.RemoveAt(0); } }
static public AmplitudeData parse(byte[] buffer) { List <float> data = new List <float>(); for (int index = 0; index < buffer.Count(); index += 4) { float ampVal = System.BitConverter.ToSingle(buffer, index); data.Add(ampVal); } AmplitudeData ampData = new AmplitudeData(data); return(ampData); }