#include #include "psk31-fft.h" #include "hansis_fft.h" #include void psk31_fft::set_parameters(int len, int _delta, int _mode) { if(len!=N) { if(fft) delete fft; fft = new FFTer(len); N=len; if(Idata) delete[] Idata; Idata = new float[N]; if(Qdata) delete[] Qdata; Qdata = new float[N]; if(rxdata) delete[] rxdata; rxdata = new int[N]; if(window) delete[] window; window = new float[N]; for(int i=0; i=N) cnt=0; if(valid_counter) valid_counter--; } void psk31_fft::add_if_sample(float I, float Q) { if(mode!=MODE_NARROWIF) return; Idata[cnt]=I; Qdata[cnt++]=Q; if(cnt>=N) cnt=0; if(valid_counter) valid_counter--; } int psk31_fft::has_new_data() { return valid_counter==0; } /* Just copy out those values needed for display... * the maximum number of values has been specified by set_paramters * The copy out value starts at start (lower end == 0), * writes count values to data buffer, * where it compines step FFT values to one entry... * condition: start+count*step < MAXVALUES */ int psk31_fft::get_abs_data(float *data, int start, int count, int step) { if( start<0||count<0||step<0 ) return -1; if( start + count*step > N ) return -1; cmplx * fftval; // = new cmplx[N]; //Vector fftval(N); // switch on type; copy source; performe fft if(mode==MODE_RXDATA) { double *mydata = new double[N]; for(int i=0; irfftsr_wrapper(mydata); delete[] mydata; } else { cmplx * input = new cmplx[N]; for(int i=0; ifftsr(input); delete[] input; } int index = start; //fprintf(stderr,"power value results:\n"); for(int i=0; i