Hi folks, can anyone help me with the following issue?
My program throws (VS19) a debug assertion when executing the line:
forwardFFT.perform(x.data(), xFFT.data(), false);
x and xFFT so defined earlier:
std::vector<juce::dsp::Complex<float>> xFFT(2*fftSize, juce::dsp::Complex<float>(0));
std::vector<juce::dsp::Complex<float>> x(2*fftSize, juce::dsp::Complex<float>(0));
for (size_t i{ 0 }; i < fftSize; i++)
x.at(i) = juce::dsp::Complex<float>(randObj.nextFloat()*2 - 1 );
fftSize and forwardFFT defined as:
const int fftOrder = static_cast<int>(roundf(log2f((float)m)));
juce::dsp::FFT forwardFFT{ fftOrder };
auto fftSize = static_cast<int>(forwardFFT.getSize());
Debug Assertion Failed!
Program: ...\Builds\VisualStudio2019\x64\Debug\Standalone Plugin\AAIR.exe
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector
Line: 1539
Expression: front() called on empty vector
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
I had sized the vectors to fftSize instead of 2*fftSize before but then I enlarged them to try to fix the issue as I read somewhere in the docs that perform might need extra space for the negative freqs. Anyway it is not solving the issue. I resize the vector xFFT later on in the program so that the frequency bins in forwardFFT are the same as xFFT and my freq axis.
