private void OnFftCalculated(object sender, FftEventArgs e)
 {
     NAudio.Dsp.Complex[] result = e.Result;
     Dispatcher.Invoke(new Action(() => {
         SpecAnalyser.Update(result);
         audioBitmap.Update(OpenGLControl.OpenGL, result);
     }));
 }
 public MicrophoneAggregator(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);
 }
 public SampleAggregator(ISampleProvider source, int fftLength = 1024)
 {
     channels = source.WaveFormat.Channels;
     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.signalBuffer = new float[fftLength];
     this.fftArgs      = new FftEventArgs(fftBuffer, signalBuffer);
     this.source       = source;
 }