VulcanoLE/headers/VulcanoLE/Audio/FFT.h

31 lines
780 B
C
Raw Normal View History

2021-02-20 18:13:51 +01:00
#pragma once
#include <mutex>
#include <fftw3.h>
#include <VulcanoLE/Audio/Types.h>
2021-02-20 18:13:51 +01:00
class FFT {
public:
FFT();
~FFT();
2021-03-22 20:46:29 +01:00
void process(stereoSample *frame, double d);
2021-02-20 18:13:51 +01:00
outputSample *getData();
2021-03-22 20:46:29 +01:00
bool prepareInput(stereoSample *buffer, uint32_t sampleSize, double scale);
2021-05-02 17:25:03 +02:00
double hannWindow[BUFFER_SIZE]{};
2021-12-30 18:06:04 +01:00
int size = BUFFER_SIZE;
2021-02-20 18:13:51 +01:00
protected:
2021-05-02 17:25:03 +02:00
fftw_complex *m_fftwInputLeft{};
fftw_complex *m_fftwInputRight{};
fftw_complex *m_fftwOutputLeft{};
fftw_complex *m_fftwOutputRight{};
2021-05-02 17:25:03 +02:00
outputSample *m_sample = new outputSample(BUFFER_SIZE);
fftw_plan m_fftwPlanLeft{};
fftw_plan m_fftwPlanRight{};
2021-02-20 18:13:51 +01:00
std::mutex m_mtx;
size_t m_fftwResults;
2021-05-02 17:25:03 +02:00
static double valueToAmp(double value);
double times;
static double limit;
2021-12-30 18:06:04 +01:00
2021-02-20 18:13:51 +01:00
};