diff options
author | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2008-04-03 15:39:28 +0000 |
---|---|---|
committer | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2008-04-03 15:39:28 +0000 |
commit | 3adbad6f33d27d9004f699779ca99fe0bfa2c5de (patch) | |
tree | ed0041dfb810354a01c0ee01fc87826d826dad21 | |
parent | 26e0d82e7c375ea0313c137f97fecfac84719b7b (diff) |
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
-rwxr-xr-x | help/phasorshot~-help.pd | 12 | ||||
-rwxr-xr-x | src/breakpoints.c | 4 | ||||
-rwxr-xr-x | src/breakpoints~.c | 6 | ||||
-rwxr-xr-x | src/phasorshot~.c | 19 | ||||
-rwxr-xr-x | src/w_breakpoints.h | 11 |
5 files changed, 30 insertions, 22 deletions
diff --git a/help/phasorshot~-help.pd b/help/phasorshot~-help.pd index b18e457..527c5bc 100755 --- a/help/phasorshot~-help.pd +++ b/help/phasorshot~-help.pd @@ -1,4 +1,4 @@ -#N canvas 67 5 618 599 10;
+#N canvas 396 14 618 599 10;
#X text 390 204 Arguments:;
#X obj 372 207 cnv 15 15 15 empty empty empty 20 12 0 14 -258113 -66577
0;
@@ -6,7 +6,7 @@ #X obj 92 488 metro 100;
#X obj 92 464 loadbang;
#X obj 59 551 nbx 10 14 -1e+037 1e+037 0 0 empty empty empty 0 -8 0
-10 -1 -262144 -1 0 256;
+10 -1 -262144 -1 0.856514 256;
#X obj 381 507 soundfiler;
#X msg 381 469 read -resize \$1 \$2;
#X obj 381 438 list append \$0table;
@@ -15,7 +15,7 @@ -1 -1;
#X floatatom 381 533 10 0 0 0 - - -;
#X obj 244 471 table \$0table;
-#X obj 177 297 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 177 297 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X msg 58 154 0.1;
#X msg 89 156 -0.1;
@@ -41,8 +41,9 @@ you can change the speed DURING the ramp.; #X text 149 222 Inlet 2: phasee;
#X text 212 297 Inlet 3: loop off/on;
#X text 373 225 1) loop off/on;
-#X text 155 329 Outlets 2 and 3 bang if looping is turned off and either
-the upper (1) or lower (0) bound is reached.;
+#X msg 183 181 0;
+#X text 154 329 Outlets 2 and 3 bang when the upper (1) or lower (0)
+bound is reached.;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
@@ -68,3 +69,4 @@ the upper (1) or lower (0) bound is reached.; #X connect 27 0 22 0;
#X connect 27 1 21 0;
#X connect 27 2 20 0;
+#X connect 35 0 27 0;
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)
{
|