Update of /cvsroot/pure-data/externals/tbext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31075
Modified Files: tbfft2.cpp Log Message: cleanup
Index: tbfft2.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/tbext/source/tbfft2.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tbfft2.cpp 28 Jan 2004 11:09:13 -0000 1.2 --- tbfft2.cpp 13 Jul 2004 20:06:10 -0000 1.3 *************** *** 50,82 **** class tbfft2: public flext_dsp { ! FLEXT_HEADER(tbfft2,flext_dsp); ! public: // constructor ! tbfft2();
protected: ! virtual void m_signal (int n, float *const *in, float *const *out); ! void set_freq(t_float); ! void set_width(t_float); ! private: ! FLEXT_CALLBACK_1(set_freq,t_float) ! FLEXT_CALLBACK_1(set_width,t_float) ! ! t_int center; ! t_int width; ! ! t_float pos; ! t_int posi; ! ! float *ins; ! float *outs; ! float *tmps; ! t_float tmp[17000]; ! ! t_float s; ! t_float b;
! t_int n0; };
--- 50,75 ---- class tbfft2: public flext_dsp { ! FLEXT_HEADER(tbfft2,flext_dsp); ! public: // constructor ! tbfft2(); ! ~tbfft2();
protected: ! virtual void m_signal (int n, float *const *in, float *const *out); ! virtual void m_dsp (int n, float *const *in, float *const *out); ! void set_freq(t_float); ! void set_width(t_float); ! private: ! FLEXT_CALLBACK_1(set_freq,t_float); ! FLEXT_CALLBACK_1(set_width,t_float);
! t_int center; ! t_int width; ! ! t_float * tmp; ! ! t_int n0; };
*************** *** 92,122 **** }
! void tbfft2::m_signal(int n, t_float *const *in, t_float *const *out) { ! ins = in[0]; ! outs = out[0];
- CopySamples(tmp,ins,n); - - n0=n/2;
! if (center-width>0) { ! n=center-width; } ! else ! n=0; ! ! while (n<center+width) { ! tmp[n]=*(ins+2*center-n); ! ++n; } ! !
! //memcp ! CopySamples(outs,tmp,n0*2);
} --- 85,127 ---- }
+ tbfft2::~tbfft2() + { + free(tmp); + }
! void tbfft2::m_dsp(int n, t_float *const *in, t_float *const *out) { ! free(tmp); ! tmp=(t_float*)malloc(n*sizeof(t_float)); ! }
! ! void tbfft2::m_signal(int n, t_float *const *in, t_float *const *out) ! { ! t_float * ins = in[0]; ! t_float * outs = out[0]; ! ! CopySamples(tmp,ins,n); ! ! n0=n/2; ! ! if (center-width>0) { ! n=center-width; } ! else ! n=0; ! ! while (n<center+width) { ! tmp[n]=*(ins+2*center-n); ! ++n; } !
! ! //memcpy ! CopySamples(outs,tmp,n0*2);
} *************** *** 124,129 **** void tbfft2::set_freq(t_float freq) { ! center=freq; ! set_width(width); }
--- 129,134 ---- void tbfft2::set_freq(t_float freq) { ! center=freq; ! set_width(width); }