aboutsummaryrefslogtreecommitdiffstats
path: root/common/phase_shifter.h
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /common/phase_shifter.h
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'common/phase_shifter.h')
-rw-r--r--common/phase_shifter.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/phase_shifter.h b/common/phase_shifter.h
index e1a83dab..1b3463de 100644
--- a/common/phase_shifter.h
+++ b/common/phase_shifter.h
@@ -10,6 +10,7 @@
#include <array>
#include <stddef.h>
#include <type_traits>
+#include <vector>
#include "alcomplex.h"
#include "alspan.h"
@@ -52,20 +53,19 @@ struct PhaseShifterT {
constexpr size_t fft_size{FilterSize};
constexpr size_t half_size{fft_size / 2};
- auto fftBuffer = std::make_unique<complex_d[]>(fft_size);
- std::fill_n(fftBuffer.get(), fft_size, complex_d{});
+ auto fftBuffer = std::vector<complex_d>(fft_size, complex_d{});
fftBuffer[half_size] = 1.0;
- forward_fft(al::span{fftBuffer.get(), fft_size});
+ forward_fft(al::span{fftBuffer});
fftBuffer[0] *= std::numeric_limits<double>::epsilon();
for(size_t i{1};i < half_size;++i)
fftBuffer[i] = complex_d{-fftBuffer[i].imag(), fftBuffer[i].real()};
fftBuffer[half_size] *= std::numeric_limits<double>::epsilon();
for(size_t i{half_size+1};i < fft_size;++i)
fftBuffer[i] = std::conj(fftBuffer[fft_size - i]);
- inverse_fft(al::span{fftBuffer.get(), fft_size});
+ inverse_fft(al::span{fftBuffer});
- auto fftiter = fftBuffer.get() + fft_size - 1;
+ auto fftiter = fftBuffer.data() + fft_size - 1;
for(float &coeff : mCoeffs)
{
coeff = static_cast<float>(fftiter->real() / double{fft_size});