CLAM-Development  1.4.0
FourierTransform.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2006 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef FourierTransform_hxx
23 #define FourierTransform_hxx
24 #include <vector>
25 #if USE_FFTW3
26 #include <fftw3.h>
27 #endif
28 
30  std::vector<double> _spectrum;
31  unsigned long mFrameSize;
32  bool mIsComplex;
33 #if USE_FFTW3
34  double * _realInput;
35  fftw_complex * _complexOutput;
36  fftw_plan _plan;
37 #endif
38 public:
39  FourierTransform(unsigned long int frameSize, double normalizationFactor, bool isComplex);
41 
42  void doIt(const float * input);
43  void doIt(const double * input);
44  const std::vector<double> & spectrum() const {return _spectrum;};
45 private:
46  template <typename T> void doItGeneric(const T * input);
47 };
48 
49 #endif//FourierTransform_hxx
50