aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src/ether~.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/ether~.cpp
parentb00be027fe91e9ae5a19f53b6c1fd0245b4d4bae (diff)
""
svn path=/trunk/; revision=340
Diffstat (limited to 'externals/grill/fftease/src/ether~.cpp')
-rw-r--r--externals/grill/fftease/src/ether~.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/externals/grill/fftease/src/ether~.cpp b/externals/grill/fftease/src/ether~.cpp
index e04efaec..836349f3 100644
--- a/externals/grill/fftease/src/ether~.cpp
+++ b/externals/grill/fftease/src/ether~.cpp
@@ -46,7 +46,7 @@ V ether::setup(t_classid c)
ether::ether(I argc,const t_atom *argv):
- fftease(2,true,true,true),
+ fftease(2,F_STEREO|F_BITSHUFFLE),
_qual(false),_threshMult(0),_invert(false)
{
/* parse and set object's options given */
@@ -58,7 +58,7 @@ ether::ether(I argc,const t_atom *argv):
}
_mult = _qual?4:2;
- _window = _qual;
+ if(_qual) _flags |= F_WINDOW;
AddInSignal("Messages and input signal");
AddInSignal("Reference signal");
@@ -72,36 +72,32 @@ V ether::Transform(I _N2,S *const *in)
if (threshMult == 0. ) threshMult = 1;
for (I i = 0; i <= _N2; i++ ) {
- int even = i<<1,odd = even + 1;
+ const I even = i*2,odd = even + 1;
- /* convert to polar coordinates from complex values */
+ // convert to polar coordinates from complex values
register F a,b;
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 );
- _channel2[odd] = -atan2( b, a );
+ F amp2 = hypot( a, b );
+ F phase2 = -atan2( b, a );
- /* use simple threshold for inverse compositing */
+ // use simple threshold for inverse compositing
- if(_invert?(_channel1[even] > _channel2[even]*threshMult):(_channel1[even] < _channel2[even]*threshMult) )
- _channel1[even] = _channel2[even];
+ if(_invert?(amp1 > amp2*threshMult):(amp1 < amp2*threshMult) ) amp1 = amp2;
+ if (phase1 == 0. ) phase1 = phase2;
- if (_channel1[odd] == 0. ) _channel1[odd] = _channel2[odd];
-
- /* 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] );
+ // convert back to complex form, read for the inverse fft
+ _buffer1[even] = amp1 * cos(phase1);
+ if(i != _N2) _buffer1[odd] = -amp1 * sin(phase1);
}
}