private void Analyser_Processed(SampleAnalysis[] obj) { List <SampleAnalysis> results = new List <SampleAnalysis>(); for (int i = 0; i < obj.Length; i++) { if (obj[i].Frequency <= MAX_FREQUENCY) { results.Add(obj[i]); } } for (int i = 0; i < Lines.Length; i++) { Lines[i].Color = Color.White; Lines[i].Text = null; } double maxDb = 0; foreach (var d in obj) { if (d.Amplitude > maxDb) { maxDb = d.Amplitude; } } int x = 0; var res = results.OrderByDescending(r => r.Amplitude).Take(2); foreach (var r in res) { if (r.Amplitude > 90) { var note = NotesManager.FindNote(r.Frequency); if (note != null) { Lines[results.IndexOf(r)].Text = note.ToString(); } } } for (int i = 0; i < results.Count; i++) { int relativeIntensity = (int)(100 + (results[i].CalculateIntensity() * 3000)); // change me this Lines[i].Start = new Vector2(Position.X + x, Position.Y + HEIGHT); Lines[i].End = new Vector2(Position.X + x, Position.Y + HEIGHT - relativeIntensity); x += PIXEL_GAP; /* if (maxDb > 0) * { * var pixelColor = ColorUtils.MapRainbowColor(maxDb, 0, maxDb); * * if (results[i].Amplitude > SignificantAmplitude+20) * { * Lines[i].Text = results[i].Frequency.ToString(); * } * * if (!double.IsPositiveInfinity(results[i].Amplitude) && !double.IsNegativeInfinity(results[i].Amplitude) && results[i].Amplitude > SignificantAmplitude) * { * pixelColor = ColorUtils.MapRainbowColor(results[i].Amplitude, maxDb, SignificantAmplitude); * } * * Lines[i].Color = new Color(pixelColor.R, pixelColor.G, pixelColor.B, pixelColor.A); * } */ } }