From d9c287d4336721d773c8a4c01588f0b7c8be984d Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Thu, 16 Jan 2003 04:36:48 +0000 Subject: "" svn path=/trunk/; revision=340 --- externals/grill/fftease/src/cross~.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'externals/grill/fftease/src/cross~.cpp') diff --git a/externals/grill/fftease/src/cross~.cpp b/externals/grill/fftease/src/cross~.cpp index 728e868a..8fbc2c22 100644 --- a/externals/grill/fftease/src/cross~.cpp +++ b/externals/grill/fftease/src/cross~.cpp @@ -29,7 +29,7 @@ FLEXT_LIB_DSP_V("fftease, cross~",cross) cross::cross(I argc,const t_atom *argv): - fftease(2,true,true,true) + fftease(2,F_STEREO|F_WINDOW|F_BITSHUFFLE) { AddInSignal("Messages and driver signal"); AddInSignal("Filter signal"); @@ -40,28 +40,27 @@ cross::cross(I argc,const t_atom *argv): V cross::Transform(I _N2,S *const *in) { // TG: filled only once per signal vector!! - float threshie = *in[0]; + const F threshie = *in[0]; for (I i = 0; i <= _N2; i++ ) { - const I even = i<<1,odd = even+1; + const I even = i*2,odd = even+1; F a = ( i == _N2 ? _buffer1[1] : _buffer2[even] ); F b = ( i == 0 || i == _N2 ? 0. : _buffer2[odd] ); - F gainer = hypot( a, b ) ; + + F amp1 = hypot( a, b ) ; a = ( i == _N2 ? _buffer1[1] : _buffer1[even] ); b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] ); - if( gainer > threshie ) - _channel1[even] = hypot( a, b ) * gainer; - // else - // channel1[even] = hypot( a, b); + F amp2 = hypot( a, b ); + F phase2 = -atan2( b, a ); - _channel1[odd] = -atan2( b, a ); - _buffer1[even] = _channel1[even] * cos( _channel1[odd] ); + // modulate amp2 with amp1 (if over threshold) + if( amp1 > threshie ) amp2 *= amp1; - if ( i != _N2 ) - _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); + _buffer1[even] = amp2 * cos( phase2 ); + if ( i != _N2 ) _buffer1[odd] = -amp2 * sin( phase2 ); } } -- cgit v1.2.1