35 printf(
"Could not allocate enough mem for a RealFFT\n");
50 printf(
"RealFFTData::RealFFTData : input or output array doesn't exist\n");
60 printf(
"Could not allocate enough mem for a RealFFT\n");
73 if (
in)
delete []
in;
in=NULL;
120 double min=MAXDOUBLE;
124 for (
int k = 1; k < (
getSize()+1)/2; ++k){
144 double min=MAXDOUBLE;
145 double max=-MAXDOUBLE;
146 for (
int k = 0; k < (
getSize()+1)/2; ++k){
158 for (
int k = 0; k < (
getSize()+1)/2; ++k)
217 printf(
"%f\t",
in[i]);
223 printf(
"%f\t",
out[i]);
228 #ifdef HAVE_EMSCRIPTEN 229 #include <emscripten/bind.h> 230 EMSCRIPTEN_BINDINGS(RealFFTData_ex) {
231 emscripten::class_<RealFFTData>(
"RealFFTData")
void findMaxMinPowerBins(void)
Fills the max and min power spectrum bins.
RealFFTData(int sz)
All memory to be allocated internally.
void powerInDB()
This is the power spectrum in dB.
int getSize(void)
Returns the number of elements in the input and output arrays.
int deleteInOutMemory
Var used to specify if the memory was allocated by the RealFFTData class.
void zeroFFTData(void)
This function zeros the output data array (out)
void load(const unsigned int i, const fftw_real val)
int size
Specifies the size of the data array.
int minPowerBin
Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPower...
double totalPower
The total power (summed) of the power spectrum as used in the method compPowerSpec.
~RealFFTData(void)
Deconstructor.
int getHalfSize(void)
Returns the number of elements in the power spectrum array.
int compPowerSpec()
This function computes the power spectrum and returns the max bin.
fftw_real unload(const unsigned int i)
int sqrtPowerSpec()
This function computes the square root of the power spectrum and returns the max bin.
fftw_real * power_spectrum
fftw_real unloadPS(const unsigned int i)
fftw_real * in
the input, output and power_spectrum arrays
int limitHalfPowerSpec(double lim)
Limits the maximum to 'lim' and returns the last fft bin with max.
void dumpIn()
For debugging purposes, dump the in array to stdout.
#define fftw_real
use double by default
fftw_real findMaxIn(void)
Returns the maximum input variable.
void dumpOut()
For debugging purposes, dump the out array to stdout.