static t_int *sigfft_perform(t_int *w) { t_sample *in1 = (t_sample *)(w[1]); t_sample *in2 = (t_sample *)(w[2]); int n = (int)w[3]; mayer_fft(n, in1, in2); return (w+4); }
static void mtxFFTMatrixHot (MtxFFT *x, t_symbol *s, int argc, t_atom *argv) { int rows, columns, size; int fft_count; t_atom *list_re = x->list_re; t_atom *list_im = x->list_im; t_float *f_re = x->f_re; t_float *f_im = x->f_im; /* fftsize check */ if(iemmatrix_check(x, argc, argv, 0))return; rows = atom_getint (argv++); columns = atom_getint (argv++); size = rows * columns; if (size != x->size) { pd_error(x, "[mtx_fft]: left matrix has other dimensions than right matrix"); } else if (columns < 4) { pd_error(x, "[mtx_fft]: matrix must have at least 4 columns"); } else if (columns == (1 << ilog2(columns))) { /* ok, do the FFT! */ /* main part */ readFloatFromList (size, argv, f_re); fft_count = rows; list_re += 2; list_im += 2; while (fft_count--) { mayer_fft (columns, f_re, f_im); writeFloatIntoList (columns, list_re, f_re); writeFloatIntoList (columns, list_im, f_im); f_im += columns; f_re += columns; list_re += columns; list_im += columns; } list_re = x->list_re; list_im = x->list_im; SETSYMBOL(list_re, gensym("matrix")); SETSYMBOL(list_im, gensym("matrix")); SETFLOAT(list_re, rows); SETFLOAT(list_im, rows); SETFLOAT(list_re+1, columns); SETFLOAT(list_im+1, columns); outlet_anything(x->list_im_out, gensym("matrix"), x->size+2, list_im); outlet_anything(x->list_re_out, gensym("matrix"), x->size+2, list_re); } else { pd_error(x, "[mtx_fft]: rowvector size no power of 2!"); } }
YSE::DSP::buffer & YSE::DSP::fft::operator()(YSE::DSP::buffer & realIn, YSE::DSP::buffer & imaginaryIn) { if (realIn.getLength() != imaginaryIn.getLength()) { assert(false); } if (realIn.getLength() != real.getLength()) real.resize(realIn.getLength()); if (imaginaryIn.getLength() != imaginary.getLength()) imaginary.resize(imaginaryIn.getLength()); if (real.getPtr() == imaginaryIn.getPtr() && imaginary.getPtr() == realIn.getPtr()) { real.swap(imaginary); } else if (real.getPtr() == imaginaryIn.getPtr()) { real = realIn; imaginary = imaginaryIn; } else { if (real.getPtr() != realIn.getPtr()) real = realIn; if (imaginary.getPtr() != imaginaryIn.getPtr()) imaginary = imaginaryIn; } mayer_fft(real.getLength(), real.getPtr(), imaginary.getPtr()); return real; }