From ce8d118561bd86df80eae140f2e0a64db55998e3 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 28 Jan 2004 11:09:13 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1298 --- tbext/source/fftbuf.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'tbext/source/fftbuf.cpp') diff --git a/tbext/source/fftbuf.cpp b/tbext/source/fftbuf.cpp index eff81e3..13f0b9e 100644 --- a/tbext/source/fftbuf.cpp +++ b/tbext/source/fftbuf.cpp @@ -121,27 +121,36 @@ fftbuf::~fftbuf() void fftbuf::m_signal(int n, t_float *const *in, t_float *const *out) { - outs = out[0]; - - if (counter!=0) + if (check(buf)) { - n=n/2+1; + outs = out[0]; + + if (counter!=0) + { + n=n/2+1; while (--n) data[n] = data[n] - offset[n]; /* for(int i=0;i!=bs;++i) - { + { data[i] = data[i] - offset[i]; - } + } */ - + --counter; + } + + CopySamples(out[0],data,bs); } - - CopySamples(out[0],data,bs); + else + CopySamples(out[0],data,bs); + } +//perform und dsp gleichzeitig?!? + + void fftbuf::perform() { counter=blknumber(); @@ -196,7 +205,7 @@ void fftbuf::set_buf(int argc, t_atom *argv) } template -/*inline*/ void fftbuf::clear(T* buf) +inline void fftbuf::clear(T* buf) { if (buf) { @@ -207,6 +216,8 @@ template inline bool fftbuf::check(buffer * buf) { + if (buf==NULL) + return false; //code taken from the flext tutorial (buffer 1) by thomas grill if(buf->Update()) @@ -241,7 +252,8 @@ void fftbuf::set_line(int argc, t_atom *argv) inline int fftbuf::blknumber() { - // post("%i %i %i",delay,bs,sr); - // post("computer counter: %i",delay*bs/sr*1000); - return delay*bs/sr*1000; //ms/sample + post("%i %i %i",delay,bs,sr); + post("blknumber: %i",delay*bs/sr); + + return delay*bs/sr; //ms/sample } -- cgit v1.2.1