NO-OP: whitespace
authorRobin Gareus <robin@gareus.org>
Thu, 28 Feb 2019 02:08:21 +0000 (03:08 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 28 Feb 2019 02:08:21 +0000 (03:08 +0100)
gtk2_ardour/fft.cc
gtk2_ardour/fft.h

index ec9af2fd3e086faf0fa90b7e605cc27faaf614d8..b9a23f3571d5216cdbf4fa1eb18e79b397dfb232 100644 (file)
@@ -76,7 +76,7 @@ FFT::analyze(ARDOUR::Sample *input, WindowingType windowing_type)
 
 #define Re (_fftOutput[i])
 #define Im (_fftOutput[_window_size-i])
-               for (uint32_t i=1; i < _data_size - 1; i++) {
+       for (uint32_t i = 1; i < _data_size - 1; ++i) {
 
                power = (Re * Re) + (Im * Im);
                phase = atanf(Im / Re);
@@ -95,7 +95,7 @@ FFT::analyze(ARDOUR::Sample *input, WindowingType windowing_type)
 }
 
 void
-FFT::calculate()
+FFT::calculate ()
 {
        if (_iterations > 1) {
                for (uint32_t i=0; i < _data_size - 1; i++) {
@@ -106,32 +106,31 @@ FFT::calculate()
        }
 }
 
-float *
-FFT::get_hann_window()
+float*
+FFT::get_hann_window ()
 {
-       if (_hann_window)
+       if (_hann_window) {
                return _hann_window;
+       }
 
-
-        _hann_window = (float *) malloc(sizeof(float) * _window_size);
+       _hann_window = (float*) malloc (sizeof (float) * _window_size);
 
        double sum = 0.0;
 
-        for (uint32_t i=0; i < _window_size; i++) {
-                _hann_window[i]=0.81f * ( 0.5f - (0.5f * (float) cos(2.0f * M_PI * (float)i / (float)(_window_size))));
-                sum += _hann_window[i];
-        }
+       for (uint32_t i = 0; i < _window_size; ++i) {
+               _hann_window[i] = 0.81f * (0.5f - (0.5f * (float) cos (2.0f * M_PI * (float)i / (float)(_window_size))));
+               sum += _hann_window[i];
+       }
 
-        double isum = 1.0 / sum;
+       double isum = 1.0 / sum;
 
-        for (uint32_t i=0; i < _window_size; i++) {
-                _hann_window[i] *= isum;
-        }
+       for (uint32_t i = 0; i < _window_size; ++i) {
+               _hann_window[i] *= isum;
+       }
 
        return _hann_window;
 }
 
-
 FFT::~FFT()
 {
        if (_hann_window) {
index 6022f1c7704cd27e938802ba199461b439b9289d..07a4fe8515adc8c57f8b9ecd2227c958b5e678f7 100644 (file)
@@ -36,42 +36,40 @@ namespace GTKArdour {
 
 class FFT
 {
-       public:
-               FFT(uint32_t);
-               ~FFT();
+public:
+       FFT (uint32_t);
+       ~FFT ();
 
-               enum WindowingType {
-                       NONE,
-                       HANN
-               };
+       enum WindowingType {
+               NONE,
+               HANN
+       };
 
-               void reset();
-               void analyze(ARDOUR::Sample *, WindowingType w = NONE);
-               void calculate();
+       void reset ();
+       void analyze (ARDOUR::Sample*, WindowingType w = NONE);
+       void calculate ();
 
-               uint32_t bins() const { return _data_size; }
+       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 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]; }
 
+private:
+       float* get_hann_window ();
 
-       private:
+       uint32_t const _window_size;
+       uint32_t const _data_size;
+       uint32_t       _iterations;
 
-               float *get_hann_window();
+       float* _hann_window;
 
-               uint32_t const _window_size;
-               uint32_t const _data_size;
-               uint32_t _iterations;
+       float* _fftInput;
+       float* _fftOutput;
 
-               float *_hann_window;
+       float* _power_at_bin;
+       float* _phase_at_bin;
 
-               float *_fftInput;
-               float *_fftOutput;
-
-               float *_power_at_bin;
-               float *_phase_at_bin;
-
-               fftwf_plan _plan;
+       fftwf_plan _plan;
 };
 
 }