diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-18 04:35:33 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-18 04:35:33 +0000 |
commit | 9ff5ccdea43ff2a954c1a400516dc6858e188e9c (patch) | |
tree | 6098867a573275a38bf000a382752bf115af0765 /externals/grill/fftease/src/cross~.cpp | |
parent | 478eeca99ee6f5bad3063700fbcc9d8913c770ae (diff) |
""
svn path=/trunk/; revision=344
Diffstat (limited to 'externals/grill/fftease/src/cross~.cpp')
-rw-r--r-- | externals/grill/fftease/src/cross~.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/externals/grill/fftease/src/cross~.cpp b/externals/grill/fftease/src/cross~.cpp index 8fbc2c22..e794d761 100644 --- a/externals/grill/fftease/src/cross~.cpp +++ b/externals/grill/fftease/src/cross~.cpp @@ -18,18 +18,18 @@ class cross: FLEXT_HEADER(cross,fftease) public: - cross(I argc,const t_atom *argv); + cross(); protected: virtual V Transform(I _N2,S *const *in); }; -FLEXT_LIB_DSP_V("fftease, cross~",cross) +FLEXT_LIB_DSP("fftease, cross~",cross) -cross::cross(I argc,const t_atom *argv): - fftease(2,F_STEREO|F_WINDOW|F_BITSHUFFLE) +cross::cross(): + fftease(2,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_CONVERT) { AddInSignal("Messages and driver signal"); AddInSignal("Filter signal"); @@ -39,30 +39,12 @@ cross::cross(I argc,const t_atom *argv): V cross::Transform(I _N2,S *const *in) { - // TG: filled only once per signal vector!! - const F threshie = *in[0]; - - for (I i = 0; i <= _N2; i++ ) { - 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 amp1 = hypot( a, b ) ; - - a = ( i == _N2 ? _buffer1[1] : _buffer1[even] ); - b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] ); - - F amp2 = hypot( a, b ); - F phase2 = -atan2( b, a ); + // filled only once per signal vector!! + register const F threshie = *in[0]; + const I _N = _N2*2; + for (I i = 0; i <= _N; i += 2) { // modulate amp2 with amp1 (if over threshold) - if( amp1 > threshie ) amp2 *= amp1; - - _buffer1[even] = amp2 * cos( phase2 ); - if ( i != _N2 ) _buffer1[odd] = -amp2 * sin( phase2 ); + if(_channel1[i] > threshie ) _channel2[i] *= _channel1[i]; } } - - - |