diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-19 21:11:59 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-19 21:11:59 +0000 |
commit | cada39a002fbbe9bc848f963c3eb7faa65122228 (patch) | |
tree | a6b4c611989fa15cf0f59c656c81a2e388041324 /externals/grill/fftease/src/morphine~.cpp | |
parent | 9ff5ccdea43ff2a954c1a400516dc6858e188e9c (diff) |
""
svn path=/trunk/; revision=345
Diffstat (limited to 'externals/grill/fftease/src/morphine~.cpp')
-rw-r--r-- | externals/grill/fftease/src/morphine~.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/externals/grill/fftease/src/morphine~.cpp b/externals/grill/fftease/src/morphine~.cpp index 14ba0971..23c2cca9 100644 --- a/externals/grill/fftease/src/morphine~.cpp +++ b/externals/grill/fftease/src/morphine~.cpp @@ -51,8 +51,8 @@ V morphine::setup(t_classid c) morphine::morphine(I argc,const t_atom *argv): - fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_CONVERT), - _index(1) + fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE), + _index(0) { /* parse and set object's options given */ if(argc >= 1) { @@ -69,8 +69,8 @@ morphine::morphine(I argc,const t_atom *argv): V morphine::Clear() { - fftease::Clear(); _picks = NULL; + fftease::Clear(); } V morphine::Delete() @@ -93,8 +93,9 @@ I morphine::sortpicks( const void *a, const void *b ) return 0; } -V morphine::Transform(I _N2,S *const *in) +V morphine::Transform(I _N,S *const *in) { + const I _N2 = _N/2; I i; for ( i = 0; i <= _N2; i++ ) { // find amplitude differences between home and visitors @@ -105,10 +106,12 @@ V morphine::Transform(I _N2,S *const *in) // sort our differences in ascending order qsort( _picks, _N2+1, sizeof(pickme), sortpicks ); - const I morphindex2 = (I)(_index*(_N2+1)+.5)*2; + I ix2 = (I)(_index*(_N2+1)+.5)*2; + if(ix2 < 0) ix2 = 0; + else if(ix2 > _N+2) ix2 = _N+2; // choose the bins that are least different first - for (i=0; i <= morphindex2; i += 2) { + for (i=0; i < ix2; i += 2) { _channel1[i] = _channel2[i]; _channel1[i+1] = _channel2[i+1]; } |