aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src/drown~.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-01-18 04:35:33 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-01-18 04:35:33 +0000
commit9ff5ccdea43ff2a954c1a400516dc6858e188e9c (patch)
tree6098867a573275a38bf000a382752bf115af0765 /externals/grill/fftease/src/drown~.cpp
parent478eeca99ee6f5bad3063700fbcc9d8913c770ae (diff)
""
svn path=/trunk/; revision=344
Diffstat (limited to 'externals/grill/fftease/src/drown~.cpp')
-rw-r--r--externals/grill/fftease/src/drown~.cpp30
1 files changed, 7 insertions, 23 deletions
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;
}