FilterDemoFramework.FilterView.GetFrequencyData C# (CSharp) Method

GetFrequencyData() public method

public GetFrequencyData ( ) : double[]
return double[]
		public double [] GetFrequencyData ()
		{
			if (frequencies != null)
				return frequencies.ToArray ();

			var width = graphLayer.Bounds.Width;
			var rightEdge = width + leftMargin;

			var pixelRatio = (int)Math.Ceiling (width / maxNumberOfResponseFrequencies);
			nfloat location = leftMargin;
			var locationsCount = maxNumberOfResponseFrequencies;

			if (pixelRatio <= 1) {
				pixelRatio = 1;
				locationsCount = (int)width;
			}

			frequencies = new List <double> ();

			for (int i = 0; i < locationsCount; i++) {
				if (location > rightEdge)
					frequencies.Add (DefaultMaxHertz);
				else {
					var frequencyTmp = GetFrequencyValue (location);

					if (frequencyTmp > DefaultMaxHertz)
						frequencyTmp = DefaultMaxHertz;

					location += (nfloat)pixelRatio;

					frequencies.Add (frequencyTmp);
				}
			}

			return frequencies.ToArray ();
		}