sonar_fft.h
00001 #ifndef SEABEE3_SONAR_FFT_H
00002 #define SEABEE3_SONAR_FFT_H
00003
00004 #include <fftw3.h>
00005
00006 namespace SeaBee3_Sonar {
00007
00008 bool isValidADCNumber(int adc_number);
00009
00010 class DataToFFT {
00011 public:
00012 DataToFFT(double *data1, double *data2, double *data3, const int len, const double sampling_frequency, const double target_frequency);
00013 ~DataToFFT();
00014
00015 double getPhase(int adc_number);
00016 double getMagnitude(int adc_number);
00017 int getTargetBin();
00018
00019 void Reset();
00020 private:
00021 double *p_data1;
00022 double *p_data2;
00023 double *p_data3;
00024 const int m_fft_length;
00025 const double m_sampling_frequency;
00026 const double m_target_frequency;
00027 const int m_target_bin;
00028 fftw_plan m_fft_plan1;
00029 fftw_plan m_fft_plan2;
00030 fftw_plan m_fft_plan3;
00031 fftw_complex *p_fft1_output;
00032 fftw_complex *p_fft2_output;
00033 fftw_complex *p_fft3_output;
00034 double *p_adc1_bin_magnitude;
00035 double *p_adc2_bin_magnitude;
00036 double *p_adc3_bin_magnitude;
00037 double *p_adc1_bin_phase;
00038 double *p_adc2_bin_phase;
00039 double *p_adc3_bin_phase;
00040 };
00041
00042 }
00043
00044 #endif // SEABEE3_SONAR_FFT_H Defined