[PD-dev] mayer_realfft usage within flext

Thomas Grill gr at grrrr.org
Wed Apr 5 14:47:58 CEST 2006


Hi David,
when you are using flext you are always including flext.h which in  
turn includes m_pd.h. Hence, mayer_realfft should be readily available.

greetings,
Thomas

Am 05.04.2006 um 14:25 schrieb David Plans Casal:

> 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
>
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
>
>

Thomas Grill
http://grrrr.org






More information about the Pd-dev mailing list