13
0

NO-OP: whitespace

This commit is contained in:
Robin Gareus 2019-02-28 03:08:21 +01:00
parent 06854e1315
commit 62470f3cb4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 39 additions and 42 deletions

View File

@ -76,7 +76,7 @@ FFT::analyze(ARDOUR::Sample *input, WindowingType windowing_type)
#define Re (_fftOutput[i]) #define Re (_fftOutput[i])
#define Im (_fftOutput[_window_size-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); power = (Re * Re) + (Im * Im);
phase = atanf(Im / Re); phase = atanf(Im / Re);
@ -109,29 +109,28 @@ FFT::calculate()
float* float*
FFT::get_hann_window () FFT::get_hann_window ()
{ {
if (_hann_window) if (_hann_window) {
return _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; double sum = 0.0;
for (uint32_t i=0; i < _window_size; 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)))); _hann_window[i] = 0.81f * (0.5f - (0.5f * (float) cos (2.0f * M_PI * (float)i / (float)(_window_size))));
sum += _hann_window[i]; sum += _hann_window[i];
} }
double isum = 1.0 / sum; double isum = 1.0 / sum;
for (uint32_t i=0; i < _window_size; i++) { for (uint32_t i = 0; i < _window_size; ++i) {
_hann_window[i] *= isum; _hann_window[i] *= isum;
} }
return _hann_window; return _hann_window;
} }
FFT::~FFT() FFT::~FFT()
{ {
if (_hann_window) { if (_hann_window) {

View File

@ -54,9 +54,7 @@ class FFT
float power_at_bin (uint32_t i) const { return _power_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]; } float phase_at_bin (uint32_t i) const { return _phase_at_bin[i]; }
private: private:
float* get_hann_window (); float* get_hann_window ();
uint32_t const _window_size; uint32_t const _window_size;