Exemple #1
0
 public IFFTPullBuffer(SigParam <double[]> fftDataReal, SigParam <double[]> fftDataImag, int size, WindowFunction window)
     : base(size)
 {
     FFFTDataReal = fftDataReal;
     FFFTDataImag = fftDataImag;
     RealImagData = new double[size];
     TimeDomain   = new float[size];
     Window       = AudioUtils.CreateWindowDouble(size, window);
     WindowFunc   = window;
     PullCount    = size;
 }
Exemple #2
0
        protected override void FillBuffer(float[] buffer, int offset, int count)
        {
            if (InputSignal.Value != null)
            {
                InputSignal.Read(buffer, offset, count);

                //write to buffer
                FRingBuffer.Write(buffer, offset, count);

                //calc fft
                var fftSize = FRingBuffer.Size;

                if (FFFTBuffer.Length != fftSize)
                {
                    FFFTBuffer = new double[fftSize];
                    FFTOut     = new double[fftSize];
                    FWindow    = AudioUtils.CreateWindowDouble(fftSize, WindowFunc);
                }

                FRingBuffer.ReadDoubleWindowed(FFFTBuffer, FWindow, 0, fftSize);
                FFFT.RealFFT(FFFTBuffer, true);
                Array.Copy(FFFTBuffer, FFTOut, fftSize);
            }
        }