diff options
Diffstat (limited to 'utils/makemhr/makemhr.h')
-rw-r--r-- | utils/makemhr/makemhr.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/utils/makemhr/makemhr.h b/utils/makemhr/makemhr.h index 89607cc0..82604528 100644 --- a/utils/makemhr/makemhr.h +++ b/utils/makemhr/makemhr.h @@ -4,6 +4,7 @@ #include <vector> #include <complex> +#include "alcomplex.h" #include "polyphase_resampler.h" @@ -109,9 +110,19 @@ struct HrirDataT { int PrepareHrirData(const uint fdCount, const double (&distances)[MAX_FD_COUNT], const uint (&evCounts)[MAX_FD_COUNT], const uint azCounts[MAX_FD_COUNT * MAX_EV_COUNT], HrirDataT *hData); void MagnitudeResponse(const uint n, const complex_d *in, double *out); -void FftForward(const uint n, complex_d *inout); -void FftInverse(const uint n, complex_d *inout); +// Performs a forward FFT. +inline void FftForward(const uint n, complex_d *inout) +{ forward_fft<double>({inout, n}); } + +// Performs an inverse FFT. +inline void FftInverse(const uint n, complex_d *inout) +{ + inverse_fft<double>({inout, n}); + double f{1.0 / n}; + for(uint i{0};i < n;i++) + inout[i] *= f; +} // Performs linear interpolation. inline double Lerp(const double a, const double b, const double f) |