[PD-dev] mayer_realfft usage within flext

David Plans Casal main at davidcasal.com
Wed Apr 5 14:25:20 CEST 2006


Hey all

I'm trying to use pd's own fft routines in an object I'm trying to  
help develop and release, built with flext.

The problem is as a legacy, it was including Mayer's fft.c with it,  
and I now want to include mayer_realfft functions from m_pd.h instead  
(or come up with a better way of doing it).

In the current code, I have:

void myflextclass::rfft(int n, float* out)
{
   int N=n;
   int N2=N>>1; // N/2
   mayer_realfft(N,out);
   n=N2;
   register float* r = out+1; // real values
   register float*i = out+N-1; // imaginary
   while(--n){ // start at position N/2-1 leave out 0
     *r=*r**r+*i**i; // Squared Modulus
     r++;i--;
   }
   *(out+N2) = *(out+N2)**(out+N2); // value at N/2+1
   *out=*out**out; // value at 0
   // Normalize the power spectrum by RMS ?
}

Would it be correct to think that I need to import m_pd.h as an  
EXTERN into a flext function? Such as:

EXTERN "C" {
	extern void mayer_realfft (...)
	}

Do I just #include "m_pd.h" as well?

Kinda lost. Help?

d

--
David Plans Casal
Researcher, UEA Studios
d.casal at uea dot ac dot uk
http://www.davidcasal.com





More information about the Pd-dev mailing list