From 9ff5ccdea43ff2a954c1a400516dc6858e188e9c Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 18 Jan 2003 04:35:33 +0000 Subject: "" svn path=/trunk/; revision=344 --- externals/grill/fftease/src/drown~.cpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'externals/grill/fftease/src/drown~.cpp') diff --git a/externals/grill/fftease/src/drown~.cpp b/externals/grill/fftease/src/drown~.cpp index 2d6b46ba..171fbaf8 100644 --- a/externals/grill/fftease/src/drown~.cpp +++ b/externals/grill/fftease/src/drown~.cpp @@ -24,11 +24,11 @@ protected: virtual V Transform(I n,S *const *in); }; -FLEXT_LIB_DSP_V("fftease, drown~",drown) +FLEXT_LIB_DSP_V("fftease, drown~ denude~",drown) drown::drown(I argc,const t_atom *argv): - fftease(4,F_WINDOW) + fftease(4,F_BALANCED|F_CONVERT) { AddInSignal("Messages and input signal"); AddInSignal("Threshold generator signal"); @@ -40,29 +40,13 @@ drown::drown(I argc,const t_atom *argv): V drown::Transform(I _N2,S *const *in) { // only first value of the signal vectors - const F thresh = in[0][0],mult = in[1][0]; + const F thresh = *in[0],mult = *in[1]; - // nudist helper function is integrated + const I _N = _N2*2; - for (I i = 0; i <= _N2; i++ ) { - const I real = i*2,imag = real+1; - F amp,phase; - - // convert to amp and phase - const F a = ( i == _N2 ? _buffer1[1] : _buffer1[real] ); - const F b = ( i == 0 || i == _N2 ? 0. : _buffer1[imag] ); - - amp = hypot( a, b ); - // make up low amplitude bins - if(amp < thresh) amp *= mult; - - phase = -atan2( b, a ); - - - // convert back to real and imag - _buffer1[real] = amp * cos( phase ); - if (i != _N2) _buffer1[imag] = -amp * sin( phase ); - } + // make up low amplitude bins + for (I i = 0; i <= _N; i += 2) + if(_channel1[i] < thresh) _channel1[i] *= mult; } -- cgit v1.2.1