aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src/burrow~.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-01-16 04:36:48 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-01-16 04:36:48 +0000
commitd9c287d4336721d773c8a4c01588f0b7c8be984d (patch)
tree3c521a125e8fb17d4a193bcb4514a41c1b4f1e9a /externals/grill/fftease/src/burrow~.cpp
parentb00be027fe91e9ae5a19f53b6c1fd0245b4d4bae (diff)
""
svn path=/trunk/; revision=340
Diffstat (limited to 'externals/grill/fftease/src/burrow~.cpp')
-rw-r--r--externals/grill/fftease/src/burrow~.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/externals/grill/fftease/src/burrow~.cpp b/externals/grill/fftease/src/burrow~.cpp
index 0bb3208f..f299ce3f 100644
--- a/externals/grill/fftease/src/burrow~.cpp
+++ b/externals/grill/fftease/src/burrow~.cpp
@@ -55,7 +55,7 @@ V burrow::setup(t_classid c)
burrow::burrow(I argc,const t_atom *argv):
- fftease(4,true,true,true),
+ fftease(4,F_STEREO|F_WINDOW|F_BITSHUFFLE),
_thresh_dB(-30),_mult_dB(-18),
_invert(false)
{
@@ -91,7 +91,7 @@ burrow::burrow(I argc,const t_atom *argv):
V burrow::Transform(I _N2,S *const *in)
{
for (I i = 0; i <= _N2; i++ ) {
- const I even = i<<1,odd = even+1;
+ const I even = i*2,odd = even+1;
/* convert to polar coordinates from complex values */
register F a,b;
@@ -99,23 +99,21 @@ V burrow::Transform(I _N2,S *const *in)
a = ( i == _N2 ? _buffer1[1] : _buffer1[even] );
b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] );
- _channel1[even] = hypot( a, b );
- _channel1[odd] = -atan2( b, a );
+ F amp1 = hypot( a, b );
+ F phase1 = -atan2( b, a );
a = ( i == _N2 ? _buffer2[1] : _buffer2[even] );
b = ( i == 0 || i == _N2 ? 0. : _buffer2[odd] );
- _channel2[even] = hypot( a, b );
+ F amp2 = hypot( a, b );
/* use simple threshold from second signal to trigger filtering */
- if (_invert?(_channel2[even] < _threshold):(_channel2[even] > _threshold) )
- _channel1[even] *= _multiplier;
+ if (_invert?(amp2 < _threshold):(amp2 > _threshold) )
+ amp1 *= _multiplier;
/* convert back to complex form, read for the inverse fft */
- _buffer1[even] = _channel1[even] * cos( _channel1[odd] );
-
- if ( i != _N2 )
- _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] );
+ _buffer1[even] = amp1 * cos(phase1);
+ if ( i != _N2 ) _buffer1[odd] = -amp1 * sin(phase1);
}
}