Hi!
I’m looking to use the SDK’s wrapper for pffft
so I went searching for an example of its use. I found one in the Fundamental Noise module, and I have a question about it. It’s not so much about the math or algorithm, but about some C++ syntax, which I’m still getting the hang of.
Why is it that the input and output buffers are initialized as they are? Particularly the alignas
specifier and the empty brackets {}
? (Fundamental/src/Noise.cpp at eb41dd7cdf1112530c1a8059cfa3a99a402944ef · VCVRack/Fundamental · GitHub)
Regarding alignment, I so far am thinking this:
(From cppreference.com)
Every object type has the property called alignment requirement , which is an integer value (of type std::size_t, always a power of 2) representing the number of bytes between successive addresses at which objects of this type can be allocated.
From this, my understanding is that the code initializing the input and output buffers each as 16 aligned addresses. I would hazard a guess that this improves performance of the FFT?
The other question was about why the buffer is initialized with the empty brackets. Would it also work without the empty brackets? In another way of phrasing my question, what is the difference between the two below initializations?
int[LEN] foo;
int[LEN] bar = {};
Please let me know if I can clarify my two questions here! Thanks