public SampleAggregator(int fftLength) { if (!IsPowerOfTwo(fftLength)) { throw new ArgumentException("FFT Length must be a power of two"); } this.m = (int)Math.Log(fftLength, 2.0); this.fftLength = fftLength; this.fftBuffer = new Complex[fftLength]; this.fftArgs = new FftEventArgs(fftBuffer); }
void FftCalculated(object sender, FftEventArgs e) { // Do something with e.result! if (this.InvokeRequired) { this.BeginInvoke(new EventHandler <FftEventArgs>(FftCalculated), sender, e); } else { float[] bbb = new float[1024]; for (int i = 0; i < 1024; ++i) { bbb[i] = (float)Math.Sqrt(Math.Pow(e.Result[i].X, 2.0) + Math.Pow(e.Result[i].Y, 2.0)); } chart1.Series["Series1"].Points.DataBindY(bbb); } }