[PD-cvs] SF.net SVN: pure-data: [9677] trunk/externals/tof

mrtof at users.sourceforge.net mrtof at users.sourceforge.net
Thu Apr 3 17:39:28 CEST 2008


Revision: 9677
          http://pure-data.svn.sourceforge.net/pure-data/?rev=9677&view=rev
Author:   mrtof
Date:     2008-04-03 08:39:28 -0700 (Thu, 03 Apr 2008)

Log Message:
-----------
Added banging to phasorshot~ even when not looping AND modified w_breakpoints behavior in regard to it's default range

Modified Paths:
--------------
    trunk/externals/tof/help/phasorshot~-help.pd
    trunk/externals/tof/src/breakpoints.c
    trunk/externals/tof/src/breakpoints~.c
    trunk/externals/tof/src/phasorshot~.c
    trunk/externals/tof/src/w_breakpoints.h

Modified: trunk/externals/tof/help/phasorshot~-help.pd
===================================================================
--- trunk/externals/tof/help/phasorshot~-help.pd	2008-04-03 02:13:13 UTC (rev 9676)
+++ trunk/externals/tof/help/phasorshot~-help.pd	2008-04-03 15:39:28 UTC (rev 9677)
@@ -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 @@
 #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 @@
 #X connect 27 0 22 0;
 #X connect 27 1 21 0;
 #X connect 27 2 20 0;
+#X connect 35 0 27 0;

Modified: trunk/externals/tof/src/breakpoints.c
===================================================================
--- trunk/externals/tof/src/breakpoints.c	2008-04-03 02:13:13 UTC (rev 9676)
+++ trunk/externals/tof/src/breakpoints.c	2008-04-03 15:39:28 UTC (rev 9677)
@@ -147,6 +147,7 @@
         } else {
           if (x->max > 0) {
             x->min = 0;
+             if (x->max < 1) x->max =1;
           } else {
             x->max = 0;
           }
@@ -426,7 +427,8 @@
     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;

Modified: trunk/externals/tof/src/breakpoints~.c
===================================================================
--- trunk/externals/tof/src/breakpoints~.c	2008-04-03 02:13:13 UTC (rev 9676)
+++ trunk/externals/tof/src/breakpoints~.c	2008-04-03 15:39:28 UTC (rev 9677)
@@ -193,12 +193,13 @@
 
      }
      
-         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 @@
     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;

Modified: trunk/externals/tof/src/phasorshot~.c
===================================================================
--- trunk/externals/tof/src/phasorshot~.c	2008-04-03 02:13:13 UTC (rev 9676)
+++ trunk/externals/tof/src/phasorshot~.c	2008-04-03 15:39:28 UTC (rev 9677)
@@ -100,11 +100,8 @@
 
     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 @@
             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 @@
     //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 @@
     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;
 }
 
 

Modified: trunk/externals/tof/src/w_breakpoints.h
===================================================================
--- trunk/externals/tof/src/w_breakpoints.h	2008-04-03 02:13:13 UTC (rev 9676)
+++ trunk/externals/tof/src/w_breakpoints.h	2008-04-03 15:39:28 UTC (rev 9677)
@@ -68,7 +68,7 @@
 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_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 @@
 	     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)
 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list