diff options
Diffstat (limited to 'cyclone/sickle')
-rw-r--r-- | cyclone/sickle/Line.c | 14 | ||||
-rw-r--r-- | cyclone/sickle/Makefile.objects | 1 | ||||
-rw-r--r-- | cyclone/sickle/Scope.c | 22 | ||||
-rw-r--r-- | cyclone/sickle/average.c | 3 | ||||
-rw-r--r-- | cyclone/sickle/bitshift.c | 9 | ||||
-rw-r--r-- | cyclone/sickle/buffir.c | 16 | ||||
-rw-r--r-- | cyclone/sickle/curve.c | 16 | ||||
-rw-r--r-- | cyclone/sickle/cycle.c | 2 | ||||
-rw-r--r-- | cyclone/sickle/pong.c | 3 | ||||
-rw-r--r-- | cyclone/sickle/sickle.c | 30 | ||||
-rw-r--r-- | cyclone/sickle/svf.c | 45 |
11 files changed, 105 insertions, 56 deletions
diff --git a/cyclone/sickle/Line.c b/cyclone/sickle/Line.c index 20a81d2..eb8be26 100644 --- a/cyclone/sickle/Line.c +++ b/cyclone/sickle/Line.c @@ -53,10 +53,10 @@ static void line_tick(t_line *x) { outlet_bang(x->x_bangout); #ifdef LINE_DEBUG - post("exit point %d, after %d retarget calls", - x->dbg_exitpoint, x->dbg_nretargets); - post("at value %g, after last %d npoints, with inc %g, biginc %g", - x->x_value, x->dbg_npoints, x->x_inc, x->x_biginc); + loudbug_post("exit point %d, after %d retarget calls", + x->dbg_exitpoint, x->dbg_nretargets); + loudbug_post("at value %g, after last %d npoints, with inc %g, biginc %g", + x->x_value, x->dbg_npoints, x->x_inc, x->x_biginc); x->dbg_nretargets = x->dbg_exitpoint = x->dbg_npoints = 0; #endif } @@ -221,7 +221,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av) } x->x_nsegs = nsegs; #ifdef LINE_DEBUG - post("%d segments:", x->x_nsegs); + loudbug_post("%d segments:", x->x_nsegs); #endif segp = x->x_segs; if (odd) nsegs--; @@ -230,7 +230,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av) segp->s_target = av++->a_w.w_float; segp->s_delta = av++->a_w.w_float; #ifdef LINE_DEBUG - post("%g %g", segp->s_target, segp->s_delta); + loudbug_post("%g %g", segp->s_target, segp->s_delta); #endif segp++; } @@ -239,7 +239,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av) segp->s_target = av->a_w.w_float; segp->s_delta = 0; #ifdef LINE_DEBUG - post("%g %g", segp->s_target, segp->s_delta); + loudbug_post("%g %g", segp->s_target, segp->s_delta); #endif } x->x_deltaset = 0; diff --git a/cyclone/sickle/Makefile.objects b/cyclone/sickle/Makefile.objects index 4528d83..1d80296 100644 --- a/cyclone/sickle/Makefile.objects +++ b/cyclone/sickle/Makefile.objects @@ -4,6 +4,7 @@ unstable/fragile.o \ unstable/fringe.o \ common/loud.o \ common/grow.o \ +common/fitter.o \ common/vefl.o \ common/clc.o \ common/lex.o \ diff --git a/cyclone/sickle/Scope.c b/cyclone/sickle/Scope.c index adc4888..8a71cb5 100644 --- a/cyclone/sickle/Scope.c +++ b/cyclone/sickle/Scope.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2003 krzYszcz and others. +/* Copyright (c) 2002-2005 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ @@ -16,6 +16,7 @@ #include "g_canvas.h" #include "common/loud.h" #include "common/grow.h" +#include "common/fitter.h" #include "unstable/forky.h" #include "sickle/sic.h" @@ -320,7 +321,7 @@ static t_canvas *scope_getcanvas(t_scope *x, t_glist *glist) { if (glist != x->x_glist) { - bug("scope_getcanvas"); + loudbug_bug("scope_getcanvas"); x->x_glist = glist; } return (x->x_canvas = glist_getcanvas(glist)); @@ -338,8 +339,12 @@ static void scope_period(t_scope *x, t_symbol *s, int ac, t_atom *av) int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 2), ac, av, &period, SCOPE_MINPERIOD, SCOPE_MAXPERIOD, /* LATER rethink warning rules */ - (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), - (s ? 0 : LOUD_WARN), "samples per element"); + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "samples per element"); + if (!s && result == LOUD_ARGOVER) + fittermax_warning(*(t_pd *)x, + "more than %g samples per element requested", + SCOPE_MAXPERIOD); if (!s || result == LOUD_ARGOK || result == LOUD_ARGOVER) { x->x_period = (int)period; @@ -360,14 +365,18 @@ static void scope_bufsize(t_scope *x, t_symbol *s, int ac, t_atom *av) int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, SCOPE_MINBUFSIZE, SCOPE_WARNBUFSIZE, /* LATER rethink warning rules */ - (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), - (s ? 0 : LOUD_WARN), "display elements"); + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "display elements"); if (result == LOUD_ARGOVER) { bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE); result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, 0, SCOPE_MAXBUFSIZE, 0, LOUD_CLIP | LOUD_WARN, "display elements"); + if (!s && result == LOUD_ARGOK) + fittermax_warning(*(t_pd *)x, + "more than %g display elements requested", + SCOPE_WARNBUFSIZE); } if (!s) { @@ -1042,4 +1051,5 @@ void Scope_tilde_setup(void) gensym("_click"), A_FLOAT, 0); class_addmethod(scopehandle_class, (t_method)scopehandle__motionhook, gensym("_motion"), A_FLOAT, A_FLOAT, 0); + fitter_setup(scope_class, 0, 0); } diff --git a/cyclone/sickle/average.c b/cyclone/sickle/average.c index ea330c1..74adfc8 100644 --- a/cyclone/sickle/average.c +++ b/cyclone/sickle/average.c @@ -7,6 +7,7 @@ #include <math.h> #include "m_pd.h" +#include "common/loud.h" #include "sickle/sic.h" #if defined(NT) || defined(MACOSX) @@ -74,7 +75,7 @@ static void average_setmode(t_average *x, int mode) x->x_sumfn = average_rmssum; else { - bug("average_setmode"); + loudbug_bug("average_setmode"); return; } x->x_mode = mode; diff --git a/cyclone/sickle/bitshift.c b/cyclone/sickle/bitshift.c index 28ee744..707048c 100644 --- a/cyclone/sickle/bitshift.c +++ b/cyclone/sickle/bitshift.c @@ -8,6 +8,7 @@ more generic (use long long values?) */ #include "m_pd.h" +#include "common/loud.h" #include "sickle/sic.h" #ifdef KRZYSZCZ @@ -91,8 +92,8 @@ static void bitshift_shift(t_bitshift *x, t_floatarg f) if (i > 0) { #ifdef BITSHIFT_DEBUG - post("%.8x << %d == %.8x, %.8x << %d == %.8x", - 1, i, 1 << i, -1, i, -1 << i); + loudbug_post("%.8x << %d == %.8x, %.8x << %d == %.8x", + 1, i, 1 << i, -1, i, -1 << i); #endif if (i < nbits) x->x_lshift = i; @@ -102,8 +103,8 @@ static void bitshift_shift(t_bitshift *x, t_floatarg f) else if (i < 0) { #ifdef BITSHIFT_DEBUG - post("%.8x >> %d == %.8x, %.8x >> %d == %.8x", - 0x7fffffff, -i, 0x7fffffff >> -i, -1, -i, -1 >> -i); + loudbug_post("%.8x >> %d == %.8x, %.8x >> %d == %.8x", + 0x7fffffff, -i, 0x7fffffff >> -i, -1, -i, -1 >> -i); #endif x->x_rshift = (i <= -nbits ? nbits - 1 : -i); } diff --git a/cyclone/sickle/buffir.c b/cyclone/sickle/buffir.c index ee42af9..1fd9d23 100644 --- a/cyclone/sickle/buffir.c +++ b/cyclone/sickle/buffir.c @@ -1,10 +1,11 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* Copyright (c) 2003-2005 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ #include <string.h> #include "m_pd.h" #include "common/loud.h" +#include "common/fitter.h" #include "sickle/sic.h" #include "sickle/arsic.h" @@ -38,14 +39,11 @@ static void buffir_setrange(t_buffir *x, t_floatarg f1, t_floatarg f2) { int newsize, pos = x->x_lohead - x->x_histlo; int oldbytes = x->x_histsize * sizeof(*x->x_histlo); - if (shared_getmaxcompatibility()) + static int warned = 0; + if (fittermax_get() && !warned) { - static int warned = 0; - if (!warned) - { - loud_incompatible(buffir_class, "stretching history buffer"); - warned = 1; - } + fittermax_warning(buffir_class, "stretching history buffer"); + warned = 1; } newsize = x->x_histsize * 2; while (newsize < siz) newsize *= 2; @@ -197,7 +195,6 @@ static void *buffir_new(t_symbol *s, t_floatarg f1, t_floatarg f2) x->x_histlo = x->x_histini; buffir_clear(x); buffir_setrange(x, f1, f2); - shared_usecompatibility(); } return (x); } @@ -214,4 +211,5 @@ void buffir_tilde_setup(void) gensym("clear"), 0); class_addmethod(buffir_class, (t_method)buffir_set, gensym("set"), A_SYMBOL, A_DEFFLOAT, A_DEFFLOAT, 0); + fitter_setup(buffir_class, 0, 0); } diff --git a/cyclone/sickle/curve.c b/cyclone/sickle/curve.c index 78f1427..730dd0d 100644 --- a/cyclone/sickle/curve.c +++ b/cyclone/sickle/curve.c @@ -71,8 +71,8 @@ static void curve_cc(t_curve *x, t_curveseg *segp, float f) segp->s_nhops = (nhops > 0 ? nhops : 0); clccurve_coefs(segp->s_nhops, (double)f, &segp->s_bb, &segp->s_mm); #ifdef CURVE_DEBUG - post("%g %g %g %g", - segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm); + loudbug_post("%g %g %g %g", + segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm); #endif } @@ -80,10 +80,10 @@ static void curve_tick(t_curve *x) { outlet_bang(x->x_bangout); #ifdef CURVE_DEBUG - post("exit point %d, after %d retarget calls", - x->dbg_exitpoint, x->dbg_nretargets); - post("at value %g, after last %d nhops, with bb %g, mm %g", - x->x_value, x->dbg_nhops, x->x_bb, x->x_mm); + loudbug_post("exit point %d, after %d retarget calls", + x->dbg_exitpoint, x->dbg_nretargets); + loudbug_post("at value %g, after last %d nhops, with bb %g, mm %g", + x->x_value, x->dbg_nhops, x->x_bb, x->x_mm); x->dbg_nretargets = x->dbg_exitpoint = x->dbg_nhops = 0; #endif } @@ -223,7 +223,7 @@ static void curve_float(t_curve *x, t_float f) x->x_curseg->s_target = f; x->x_curseg->s_delta = x->x_delta; #ifdef CURVE_DEBUG - startpost("single segment: "); + loudbug_startpost("single segment: "); #endif curve_cc(x, x->x_curseg, x->x_ccinput); x->x_retarget = 1; @@ -278,7 +278,7 @@ static void curve_list(t_curve *x, t_symbol *s, int ac, t_atom *av) } x->x_nsegs = nsegs; #ifdef CURVE_DEBUG - post("%d segments:", x->x_nsegs); + loudbug_post("%d segments:", x->x_nsegs); #endif segp = x->x_segs; if (odd) nsegs--; diff --git a/cyclone/sickle/cycle.c b/cyclone/sickle/cycle.c index 01500ba..8daa43e 100644 --- a/cyclone/sickle/cycle.c +++ b/cyclone/sickle/cycle.c @@ -135,7 +135,7 @@ static void *cycle_new(t_symbol *s, int ac, t_atom *av) x->x_costable = sic_makecostable(&tabsize); if (tabsize != CYCLE_TABSIZE) { - bug("cycle_new"); + loudbug_bug("cycle_new"); pd_free((t_pd *)x); return (0); } diff --git a/cyclone/sickle/pong.c b/cyclone/sickle/pong.c index 2878842..5c5e143 100644 --- a/cyclone/sickle/pong.c +++ b/cyclone/sickle/pong.c @@ -5,6 +5,7 @@ /* CHECKED whatever args, there are always 3 inlets (refman's rubbish) */ #include "m_pd.h" +#include "common/loud.h" #include "unstable/forky.h" #include "sickle/sic.h" @@ -214,7 +215,7 @@ static void pong_dsp(t_pong *x, t_signal **sp) else { #ifdef PONG_DEBUG - post("using pong_perform_nofeeders"); + loudbug_post("using pong_perform_nofeeders"); #endif dsp_add(pong_perform_nofeeders, 6, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); diff --git a/cyclone/sickle/sickle.c b/cyclone/sickle/sickle.c index 807c2ad..1d46050 100644 --- a/cyclone/sickle/sickle.c +++ b/cyclone/sickle/sickle.c @@ -1,8 +1,7 @@ -/* Copyright (c) 2002-2004 krzYszcz and others. +/* Copyright (c) 2002-2005 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -#include <stdio.h> #include "m_pd.h" #include "unstable/fragile.h" #include "common/loud.h" @@ -15,6 +14,7 @@ typedef struct _sickle { t_object x_ob; t_symbol *x_dir; + t_symbol *x_canvasdir; t_hammerfile *x_filehandle; } t_sickle; @@ -29,7 +29,8 @@ static void sickle_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) static void sickle_doimport(t_sickle *x, t_symbol *fn, t_symbol *dir) { - if (!dir || dir == &s_) dir = x->x_dir; + if (!dir || dir == &s_) + dir = x->x_dir; if (fn && fn != &s_) import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : ""); else @@ -47,6 +48,17 @@ static void sickle_import(t_sickle *x, t_symbol *fn) sickle_doimport(x, fn, 0); } +static void sickle_cd(t_sickle *x, t_symbol *dir) +{ + /* LATER hammerfile interface for relative jumps, etc. */ + x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir); +} + +static void sickle_pwd(t_sickle *x) +{ + outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir); +} + static void sickle_bang(t_sickle *x) { fragile_class_printnames("sickle classes are: ", @@ -58,11 +70,13 @@ static void sickle_free(t_sickle *x) hammerfile_free(x->x_filehandle); } -static void *sickle_new(t_symbol *s) +static void *sickle_new(void) { t_sickle *x = (t_sickle *)pd_new(sickle_class); x->x_filehandle = hammerfile_new((t_pd *)x, 0, sickle_readhook, 0, 0); - x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas)); + x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas); + x->x_dir = x->x_canvasdir; + outlet_new((t_object *)x, &s_symbol); return (x); } @@ -87,8 +101,12 @@ void sickle_setup(void) sickle_class = class_new(gensym("sickle"), (t_newmethod)sickle_new, (t_method)sickle_free, - sizeof(t_sickle), 0, A_DEFSYM, 0); + sizeof(t_sickle), 0, 0); class_addbang(sickle_class, sickle_bang); + class_addmethod(sickle_class, (t_method)sickle_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(sickle_class, (t_method)sickle_pwd, + gensym("pwd"), 0); class_addmethod(sickle_class, (t_method)sickle_import, gensym("import"), A_DEFSYM, 0); class_addmethod(sickle_class, (t_method)sickle_click, diff --git a/cyclone/sickle/svf.c b/cyclone/sickle/svf.c index 0909571..5bc0458 100644 --- a/cyclone/sickle/svf.c +++ b/cyclone/sickle/svf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* Copyright (c) 2003-2005 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ @@ -23,11 +23,13 @@ #define SVF_LINEAR 1 #define SVF_RADIANS 2 #define SVF_DRIVE .0001 -#define SVF_QSTRETCH 1.2 /* CHECKED */ -#define SVF_MINR 0. /* CHECKME */ -#define SVF_MAXR 1.2 /* CHECKME */ -#define SVF_MINOMEGA 0. /* CHECKME */ +#define SVF_QSTRETCH 1.2 /* CHECKED */ +#define SVF_MINR 0. /* CHECKME */ +#define SVF_MAXR 1.2 /* CHECKME */ +#define SVF_MINOMEGA 0. /* CHECKME */ #define SVF_MAXOMEGA (SHARED_PI * .5) /* CHECKME */ +#define SVF_DEFFREQ 0. +#define SVF_DEFQ .01 /* CHECKME */ typedef struct _svf { @@ -125,25 +127,43 @@ static void svf_dsp(t_svf *x, t_signal **sp) sp[4]->s_vec, sp[5]->s_vec, sp[6]->s_vec); } -static void *svf_new(t_symbol *s, t_floatarg f1, t_floatarg f2) +static void *svf_new(t_symbol *s, int ac, t_atom *av) { t_svf *x = (t_svf *)pd_new(svf_class); + t_float freq = SVF_DEFFREQ, qcoef = SVF_DEFQ; + t_symbol *modesym = 0; + int i; + for (i = 0; i < ac; i++) if (av[i].a_type == A_SYMBOL) + { + modesym = av[i].a_w.w_symbol; + break; + } + while (ac && av->a_type != A_FLOAT) ac--, av++; + if (ac) + { + freq = av->a_w.w_float; + ac--; av++; + while (ac && av->a_type != A_FLOAT) ac--, av++; + if (ac) + qcoef = av->a_w.w_float; + } x->x_srcoef = SHARED_PI / sys_getsr(); - sic_newinlet((t_sic *)x, f1); - sic_newinlet((t_sic *)x, f2); + sic_newinlet((t_sic *)x, freq); + sic_newinlet((t_sic *)x, qcoef); outlet_new((t_object *)x, &s_signal); outlet_new((t_object *)x, &s_signal); outlet_new((t_object *)x, &s_signal); outlet_new((t_object *)x, &s_signal); svf_clear(x); - if (s == ps_linear) + if (modesym == ps_linear) x->x_mode = SVF_LINEAR; - else if (s == ps_radians) + else if (modesym == ps_radians) x->x_mode = SVF_RADIANS; else { x->x_mode = SVF_HZ; - if (s && s != &s_ && s != ps_hz && s != gensym("Hz")) + if (modesym && modesym != &s_ && + modesym != ps_hz && modesym != gensym("Hz")) { /* CHECKED no warning */ } @@ -158,8 +178,7 @@ void svf_tilde_setup(void) ps_radians = gensym("radians"); svf_class = class_new(gensym("svf~"), (t_newmethod)svf_new, 0, - sizeof(t_svf), 0, - A_DEFFLOAT, A_DEFFLOAT, A_DEFSYM, 0); + sizeof(t_svf), 0, A_GIMME, 0); sic_setup(svf_class, svf_dsp, SIC_FLOATTOSIGNAL); class_addmethod(svf_class, (t_method)svf_clear, gensym("clear"), 0); class_addmethod(svf_class, (t_method)svf_hz, ps_hz, 0); |