[LAD] fftw_complex and C++11
fons at linuxaudio.org
Sun Jan 4 14:51:07 UTC 2015
On Sun, Jan 04, 2015 at 01:56:51PM +0000, Aurélien Leblond wrote:
> Well all the plugins in ams.lv2 are coded in c++ and are compiled with the
> c++11 standard.
> But when ported the FFT Vocoder, it only compiles when using the c99
C and C++ complex types are not compatible for C++, not even if
they have the same binary representation as they will have for
all modern C++ compilers.
You can probably fix some of these errors (at least the first
one) by including <complex.h> (not <complex>) before <fftw3.h>.
This will make fftw use the C native complex type instead of
its own. This will allow float to complex assignment for
If you really want a 'pure' C++ version you will need to
reinterpret_cast whenever you use a function that expects
or returns a C++ complex. It won't make your code any more
IMHO the C++ complex type (a template class trying to hide
its implementation) is completely useless and a real PITA,
and a good example of the pedantic attitude that is typical
of the C++ crowd.
Nobody with even just a minimal knowledge of scientific
computing would want to hide the implementation of complex
types - almost all classical algorithms (e.g. the FFT)
depend on it being cartesian.
A second source of problems with the vocoder is the mixing
of floats and doubles. There is no good reason to use a
double FFT here.
A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
More information about the Linux-audio-dev