X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ffft.h;h=6022f1c7704cd27e938802ba199461b439b9289d;hb=52718b341163dab439596049392b9c80fb8635ec;hp=a68ed59edc0f257f09e74266db531350df886103;hpb=d9106e99a456a7aa45fc4a9a3e4d4282f63ed59d;p=ardour.git diff --git a/gtk2_ardour/fft.h b/gtk2_ardour/fft.h index a68ed59edc..6022f1c770 100644 --- a/gtk2_ardour/fft.h +++ b/gtk2_ardour/fft.h @@ -30,7 +30,9 @@ #include -#include +#include "ardour/types.h" + +namespace GTKArdour { class FFT { @@ -38,28 +40,40 @@ class FFT FFT(uint32_t); ~FFT(); + enum WindowingType { + NONE, + HANN + }; + void reset(); - void analyze(ARDOUR::Sample *); + void analyze(ARDOUR::Sample *, WindowingType w = NONE); void calculate(); - uint32_t bins() const { return _dataSize; } + uint32_t bins() const { return _data_size; } + + float power_at_bin(uint32_t i) const { return _power_at_bin[i]; } + float phase_at_bin(uint32_t i) const { return _phase_at_bin[i]; } - float powerAtBin(uint32_t i) const { return _powerAtBin[i]; } - float phaseAtBin(uint32_t i) const { return _phaseAtBin[i]; } private: - uint32_t const _windowSize; - uint32_t const _dataSize; + float *get_hann_window(); + + uint32_t const _window_size; + uint32_t const _data_size; uint32_t _iterations; + float *_hann_window; + float *_fftInput; float *_fftOutput; - float *_powerAtBin; - float *_phaseAtBin; + float *_power_at_bin; + float *_phase_at_bin; fftwf_plan _plan; }; +} + #endif