VulcanoLE/headers/VulcanoLE/Audio/FFT.h

31 lines
780 B
C++

#pragma once
#include <mutex>
#include <fftw3.h>
#include <VulcanoLE/Audio/Types.h>
class FFT {
public:
FFT();
~FFT();
void process(stereoSample *frame, double d);
outputSample *getData();
bool prepareInput(stereoSample *buffer, uint32_t sampleSize, double scale);
double hannWindow[BUFFER_SIZE]{};
int size = BUFFER_SIZE;
protected:
fftw_complex *m_fftwInputLeft{};
fftw_complex *m_fftwInputRight{};
fftw_complex *m_fftwOutputLeft{};
fftw_complex *m_fftwOutputRight{};
outputSample *m_sample = new outputSample(BUFFER_SIZE);
fftw_plan m_fftwPlanLeft{};
fftw_plan m_fftwPlanRight{};
std::mutex m_mtx;
size_t m_fftwResults;
static double valueToAmp(double value);
double times;
static double limit;
};