From 84231a000a4f06e34efa0d3700377dd3cc447e0b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 4 Oct 2012 22:24:37 +0000 Subject: took FFTease2.5_Pd_OSX.zip and unpacked it into a Library Template layout original source: http://www.somasa.qub.ac.uk/~elyon/LyonSoftware/MaxMSP/FFTease/FFTease2.5_Pd_OSX.zip svn path=/trunk/externals/fftease/; revision=16331 --- thresher~.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'thresher~.c') diff --git a/thresher~.c b/thresher~.c index 02c486c..5a6d1a8 100644 --- a/thresher~.c +++ b/thresher~.c @@ -121,7 +121,7 @@ void thresher_tilde_setup(void) void thresher_overlap(t_thresher *x, t_floatarg f) { int i = (int) f; - if(!power_of_two(i)){ + if(!fftease_power_of_two(i)){ error("%f is not a power of two",f); return; } @@ -133,7 +133,7 @@ void thresher_winfac(t_thresher *x, t_floatarg f) { int i = (int)f; - if(!power_of_two(i)){ + if(!fftease_power_of_two(i)){ error("%f is not a power of two",f); return; } @@ -218,6 +218,10 @@ void *thresher_new(t_symbol *s, int argc, t_atom *argv) x->overlap = atom_getfloatarg( 2, argc, argv ); x->winfac = atom_getfloatarg( 3, argc, argv ); +// post("thresh %f damper %f overlap %d winfac %d", x->move_threshold, x->damping_factor, x->overlap, x->winfac); + + /* if overlap is zero we crash so should protect against bad input parameters*/ + x->D = sys_getblksize(); x->R = sys_getsr(); @@ -233,9 +237,9 @@ void thresher_init(t_thresher *x, short initialized) x->D = 256; if(!x->R) x->R = 44100; - if(!power_of_two(x->overlap)) + if(!fftease_power_of_two(x->overlap) ) x->overlap = 4; - if(!power_of_two(x->winfac)) + if(!fftease_power_of_two(x->winfac) ) x->winfac = 1; x->N = x->D * x->overlap; x->Nw = x->N * x->winfac; @@ -254,8 +258,11 @@ void thresher_init(t_thresher *x, short initialized) if(!x->damping_factor){ x->damping_factor = .95; } + if(!x->move_threshold){ + x->move_threshold = .00001 ; + } x->first_frame = 1; - x->move_threshold = .00001 ; + x->max_hold_time = DEFAULT_HOLD ; x->max_hold_frames = x->max_hold_time / x->tadv; x->c_fundamental = (float) x->R/( (x->N2)<<1 ); -- cgit v1.2.1