From 3adbad6f33d27d9004f699779ca99fe0bfa2c5de Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Thu, 3 Apr 2008 15:39:28 +0000 Subject: Added banging to phasorshot~ even when not looping AND modified w_breakpoints behavior in regard to it's default range svn path=/trunk/externals/tof/; revision=9677 --- src/breakpoints.c | 4 +++- src/breakpoints~.c | 6 ++++-- src/phasorshot~.c | 19 ++++++++++--------- src/w_breakpoints.h | 11 ++++++----- 4 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/breakpoints.c b/src/breakpoints.c index d98753d..587a025 100755 --- a/src/breakpoints.c +++ b/src/breakpoints.c @@ -147,6 +147,7 @@ void breakpoints_init(t_breakpoints *x,int argc,t_atom* argv) } else { if (x->max > 0) { x->min = 0; + if (x->max < 1) x->max =1; } else { x->max = 0; } @@ -426,7 +427,8 @@ void breakpoints_setup(void) breakpoints_widgetbehavior.w_getrectfn = breakpoints_getrect; breakpoints_widgetbehavior.w_displacefn = breakpoints_displace; breakpoints_widgetbehavior.w_selectfn = breakpoints_select; - breakpoints_widgetbehavior.w_activatefn = breakpoints_activate; + breakpoints_widgetbehavior.w_activatefn = NULL; + //breakpoints_widgetbehavior.w_activatefn = breakpoints_activate; breakpoints_widgetbehavior.w_deletefn = breakpoints_delete; breakpoints_widgetbehavior.w_visfn = breakpoints_vis; breakpoints_widgetbehavior.w_clickfn = (t_clickfn) breakpoints_newclick; diff --git a/src/breakpoints~.c b/src/breakpoints~.c index b7135b2..3ac2000 100755 --- a/src/breakpoints~.c +++ b/src/breakpoints~.c @@ -193,12 +193,13 @@ void breakpoints_init(t_breakpoints *x,int argc,t_atom* argv) } - if ( x->max == x->min ) { + if ( x->max == x->min ) { if ( x->max == 0 ) { x->max = 1; } else { if (x->max > 0) { x->min = 0; + if (x->max < 1) x->max =1; } else { x->max = 0; } @@ -456,7 +457,8 @@ void breakpoints_tilde_setup(void) breakpoints_widgetbehavior.w_getrectfn = breakpoints_getrect; breakpoints_widgetbehavior.w_displacefn = breakpoints_displace; breakpoints_widgetbehavior.w_selectfn = breakpoints_select; - breakpoints_widgetbehavior.w_activatefn = breakpoints_activate; + //breakpoints_widgetbehavior.w_activatefn = breakpoints_activate; + breakpoints_widgetbehavior.w_activatefn = NULL; breakpoints_widgetbehavior.w_deletefn = breakpoints_delete; breakpoints_widgetbehavior.w_visfn = breakpoints_vis; breakpoints_widgetbehavior.w_clickfn = (t_clickfn) breakpoints_newclick; diff --git a/src/phasorshot~.c b/src/phasorshot~.c index a2e6423..22fa90c 100755 --- a/src/phasorshot~.c +++ b/src/phasorshot~.c @@ -100,11 +100,8 @@ void phasorshot_tick(t_phasorshot *x) while (n--) { - //wrap - if (x->loop) { - tf.tf_i[HIOFFSET] = normhipart; - } else { - if ( tf.tf_d >= UNITBIT32 + 1 ) { + // BANG when bounds are reached + if ( tf.tf_d >= UNITBIT32 + 1 ) { tf.tf_d = UNITBIT32 + 1; if (x->state != 1) clock_delay(x->x_clock, 0L); x->state = 1; @@ -112,11 +109,13 @@ void phasorshot_tick(t_phasorshot *x) tf.tf_d = UNITBIT32; if (x->state != 0) clock_delay(x->x_clock, 0L); x->state = 0; - } else { x->state = -1; } - } + + //wrap + if (x->loop) tf.tf_i[HIOFFSET] = normhipart; + dphase += *in++ * conv; //increment //dphase = UNITBIT32 + 1; //set to one *out++ = tf.tf_d - UNITBIT32; @@ -126,7 +125,7 @@ void phasorshot_tick(t_phasorshot *x) //wrap if (x->loop) { tf.tf_i[HIOFFSET] = normhipart; - x->state = -1; + //x->state = -1; } else { if ( tf.tf_d > UNITBIT32 + 1 ) { tf.tf_d = UNITBIT32 + 1; @@ -150,13 +149,15 @@ void phasorshot_tick(t_phasorshot *x) if (f < 0) f = 0; if (f > 1) f = 1; x->x_phase = f; + if ( f == 1) x->state = 1; + if ( f == 0) x->state = 0; } void phasorshot_loop(t_phasorshot *x, t_float f) { x->loop = f; - if (!f) x->state = -1; + //if (!f) x->state = -1; } diff --git a/src/w_breakpoints.h b/src/w_breakpoints.h index 672fc93..a44d793 100755 --- a/src/w_breakpoints.h +++ b/src/w_breakpoints.h @@ -68,7 +68,7 @@ static void draw_inlets(t_breakpoints *x, t_glist *glist, int firsttime, int nin static int breakpoints_next_doodle(t_breakpoints *x, struct _glist *glist, int xpos,int ypos) { - int ret = -1; + // int ret = -1; float xscale,yscale; int dxpos,dypos; float minval = 100000.0; @@ -311,7 +311,7 @@ void breakpoints_drawme(t_breakpoints *x, t_glist *glist, int firsttime) void breakpoints_erase(t_breakpoints* x,t_glist* glist) { - int n; + //int n; sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); @@ -364,13 +364,14 @@ static void breakpoints_select(t_gobj *z, t_glist *glist, int state) x, (state? "blue" : BACKGROUNDCOLOR)); } - +/* static void breakpoints_activate(t_gobj *z, t_glist *glist, int state) { -/* t_text *x = (t_text *)z; + t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); - if (z->g_pd != gatom_class) rtext_activate(y, state);*/ + if (z->g_pd != gatom_class) rtext_activate(y, state); } +*/ static void breakpoints_delete(t_gobj *z, t_glist *glist) { -- cgit v1.2.1