/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef FFTDISPLAY_H #define FFTDISPLAY_H #include #include #include /**Fast Fourier Transform *@author Johan Maes - ON1MH */ class fftDisplay : public QFrame { Q_OBJECT public: fftDisplay(QWidget *p=NULL,const char *name=NULL); ~fftDisplay(); /** must be called before performing any FFT */ void initFFT(unsigned int fftLength, int samplingrate); /** do the actual FFT calculation */ void realFFT(short int *iBuffer); void realFFT(double *iBuffer); /** plot one sgement of FFTLEN */ void paintEvent(QPaintEvent *); void resizeEvent(QResizeEvent *e); public slots: void mousePressEvent( QMouseEvent *e ); private: unsigned int points; double *sineTable; short *bitReversed; double *A,*B; double*sptr; double *endptr1,*endptr2; short *br1,*br2; double HRplus,HRminus,HIplus,HIminus; uint *arMag; double *oBuffer; uint bufIndex; uint dataLength; short int *buffer; QImage *im; int maxMag; int span; // frequency range to show bool showWaterfall; float maxMagnitude; float avgMagnitude; QPointArray *FFTArray; float *fftTempArray; private: // Private methods /** delete allocated buffers */ void deleteBuffers(); void doFFT(); /** No descriptions */ void draw(); int h,w; bool enabled; }; #endif