diff --git a/include/dsp/fft.hpp b/include/dsp/fft.hpp index 2aec33e1..0d0a1be7 100644 --- a/include/dsp/fft.hpp +++ b/include/dsp/fft.hpp @@ -7,24 +7,10 @@ namespace rack { namespace dsp { -/** Allocates an array to 64-byte boundaries. -Must call alignedFree() on the buffer to free. -*/ -template -T *alignedMalloc(size_t len) { - return (T*) pffft_aligned_malloc(len * sizeof(T)); -} - -template -void alignedFree(T *p) { - pffft_aligned_free(p); -} - - /** Real-valued FFT context. Wrapper for [PFFFT](https://bitbucket.org/jpommier/pffft/) `length` must be a multiple of 32. -Buffers must be aligned to 16-byte boundaries, e.g. with alignedMalloc(). +Buffers must be aligned to 16-byte boundaries. new[] and malloc() do this for you. */ struct RealFFT { PFFFT_Setup *setup; diff --git a/src/dsp/minblep.cpp b/src/dsp/minblep.cpp index 32cb34a4..0a3e5422 100644 --- a/src/dsp/minblep.cpp +++ b/src/dsp/minblep.cpp @@ -10,7 +10,7 @@ namespace dsp { void minBlepImpulse(int z, int o, float *output) { // Symmetric sinc array with `z` zero-crossings on each side int n = 2 * z * o; - float *x = alignedMalloc(n); + float *x = new float[n]; for (int i = 0; i < n; i++) { float p = math::rescale((float) i, 0.f, (float) (n - 1), (float) -z, (float) z); x[i] = sinc(p); @@ -20,7 +20,7 @@ void minBlepImpulse(int z, int o, float *output) { blackmanHarrisWindow(x, n); // Real cepstrum - float *fx = alignedMalloc(2*n); + float *fx = new float[2*n]; RealFFT rfft(n); rfft.rfft(x, fx); // fx = log(abs(fx)) @@ -73,8 +73,8 @@ void minBlepImpulse(int z, int o, float *output) { std::memcpy(output, x, n * sizeof(float)); // Cleanup - alignedFree(x); - alignedFree(fx); + delete[] x; + delete[] fx; }