gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
RealFFTData.H
Go to the documentation of this file.
1 /* Copyright 2000-2018 Matt Flax <flatmax@flatmax.org>
2  This file is part of GTK+ IOStream class set
3 
4  GTK+ IOStream is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  GTK+ IOStream is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You have received a copy of the GNU General Public License
15  along with GTK+ IOStream
16 */
17 #ifndef REALFFTDATA_H_
18 #define REALFFTDATA_H_
19 
20 #include "fft/FFTCommon.H"
21 //#include "fft/RealFFT.H"
22 
24 class RealFFTData {
27 public:
29  int size;
33  fftw_real *in, *out, *power_spectrum; //, *powerDeriv; power deriv. removed for now
35  double totalPower;
36 
38  RealFFTData(int sz);
40  RealFFTData(int sz, fftw_real*inp, fftw_real*outp);
42  ~RealFFTData(void);
43 
45  int limitHalfPowerSpec(double lim);
46 
48  int getSize(void){return size;}
50  int getHalfSize(void){ if (!(size%2)) return size/2; else return size/2+1;}
51 
53  fftw_real findMaxIn(void);
55  void findMaxMinPowerBins(void);
56 
58  int compPowerSpec();
60  int sqrtPowerSpec();
62  void powerInDB();
63  // int powerSpecDeriv(); // Find the derivative of the power spectrum
64 
66  void zeroFFTData(void);
67 
72  void load(const unsigned int i, const fftw_real val);
77  fftw_real unload(const unsigned int i);
82  fftw_real unloadPS(const unsigned int i);
83 
85  void dumpIn();
87  void dumpOut();
88 };
89 #endif // REALFFTDATA_H_
void findMaxMinPowerBins(void)
Fills the max and min power spectrum bins.
Definition: RealFFTData.C:90
RealFFTData(int sz)
All memory to be allocated internally.
Definition: RealFFTData.C:24
void powerInDB()
This is the power spectrum in dB.
Definition: RealFFTData.C:155
int getSize(void)
Returns the number of elements in the input and output arrays.
Definition: RealFFTData.H:48
int deleteInOutMemory
Var used to specify if the memory was allocated by the RealFFTData class.
Definition: RealFFTData.H:26
void zeroFFTData(void)
This function zeros the output data array (out)
Definition: RealFFTData.C:192
int maxPowerBin
Definition: RealFFTData.H:31
void load(const unsigned int i, const fftw_real val)
Definition: RealFFTData.C:198
int size
Specifies the size of the data array.
Definition: RealFFTData.H:29
int minPowerBin
Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPower...
Definition: RealFFTData.H:31
double totalPower
The total power (summed) of the power spectrum as used in the method compPowerSpec.
Definition: RealFFTData.H:35
~RealFFTData(void)
Deconstructor.
Definition: RealFFTData.C:68
int getHalfSize(void)
Returns the number of elements in the power spectrum array.
Definition: RealFFTData.H:50
int compPowerSpec()
This function computes the power spectrum and returns the max bin.
Definition: RealFFTData.C:117
fftw_real unload(const unsigned int i)
Definition: RealFFTData.C:203
class RealFFTData controls and manipulates fft data
Definition: RealFFTData.H:24
int sqrtPowerSpec()
This function computes the square root of the power spectrum and returns the max bin.
Definition: RealFFTData.C:143
fftw_real * power_spectrum
Definition: RealFFTData.H:33
fftw_real unloadPS(const unsigned int i)
Definition: RealFFTData.C:209
fftw_real * out
Definition: RealFFTData.H:33
fftw_real * in
the input, output and power_spectrum arrays
Definition: RealFFTData.H:33
int limitHalfPowerSpec(double lim)
Limits the maximum to &#39;lim&#39; and returns the last fft bin with max.
Definition: RealFFTData.C:104
void dumpIn()
For debugging purposes, dump the in array to stdout.
Definition: RealFFTData.C:215
#define fftw_real
use double by default
Definition: FFTCommon.H:24
fftw_real findMaxIn(void)
Returns the maximum input variable.
Definition: RealFFTData.C:80
void dumpOut()
For debugging purposes, dump the out array to stdout.
Definition: RealFFTData.C:221
gtkIOStream: /tmp/gtkiostream/include/fft/RealFFTData.H Source File
GTK+ IOStream  Beta