[PD-cvs] pd/src d_misc.c, 1.2.8.1, 1.2.8.2 d_ugen.c, 1.3.4.1.2.1, 1.3.4.1.2.2 g_canvas.c, 1.4.4.1.2.6, 1.4.4.1.2.7 g_editor.c, 1.4.4.2.2.4, 1.4.4.2.2.5 g_scalar.c, 1.4.8.2, 1.4.8.3 g_template.c, 1.4.8.4, 1.4.8.5

Tim Blechmann timblech at users.sourceforge.net
Mon Aug 22 18:28:28 CEST 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22157

Modified Files:
      Tag: devel_0_39
	d_misc.c d_ugen.c g_canvas.c g_editor.c g_scalar.c 
	g_template.c 
Log Message:
miller's 0.39-test6


Index: g_scalar.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_scalar.c,v
retrieving revision 1.4.8.2
retrieving revision 1.4.8.3
diff -C2 -d -r1.4.8.2 -r1.4.8.3
*** g_scalar.c	21 Aug 2005 11:28:24 -0000	1.4.8.2
--- g_scalar.c	22 Aug 2005 16:28:26 -0000	1.4.8.3
***************
*** 319,323 ****
  void scalar_redraw(t_scalar *x, t_glist *glist)
  {
!     sys_queuegui(x, glist, scalar_doredraw);
  }
  
--- 319,324 ----
  void scalar_redraw(t_scalar *x, t_glist *glist)
  {
!     if (glist_isvisible(glist))
!         sys_queuegui(x, glist, scalar_doredraw);
  }
  

Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.4.8.4
retrieving revision 1.4.8.5
diff -C2 -d -r1.4.8.4 -r1.4.8.5
*** g_template.c	21 Aug 2005 11:28:24 -0000	1.4.8.4
--- g_template.c	22 Aug 2005 16:28:26 -0000	1.4.8.5
***************
*** 2029,2035 ****
      }
      xloc = glist_xtopixels(glist,
!         basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
      yloc = glist_ytopixels(glist,
!         basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
      font = glist_getfont(glist);
      fontwidth = sys_fontwidth(font);
--- 2029,2035 ----
      }
      xloc = glist_xtopixels(glist,
!         basex + fielddesc_getcoord(&x->x_xloc, template, data, 0));
      yloc = glist_ytopixels(glist,
!         basey + fielddesc_getcoord(&x->x_yloc, template, data, 0));
      font = glist_getfont(glist);
      fontwidth = sys_fontwidth(font);
***************
*** 2079,2085 ****
          t_atom at;
          int xloc = glist_xtopixels(glist,
!             basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
          int yloc = glist_ytopixels(glist,
!             basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
          char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
          numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1),
--- 2079,2085 ----
          t_atom at;
          int xloc = glist_xtopixels(glist,
!             basex + fielddesc_getcoord(&x->x_xloc, template, data, 0));
          int yloc = glist_ytopixels(glist,
!             basey + fielddesc_getcoord(&x->x_yloc, template, data, 0));
          char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
          numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1),

Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.4.4.1.2.6
retrieving revision 1.4.4.1.2.7
diff -C2 -d -r1.4.4.1.2.6 -r1.4.4.1.2.7
*** g_canvas.c	21 Aug 2005 11:28:24 -0000	1.4.4.1.2.6
--- g_canvas.c	22 Aug 2005 16:28:25 -0000	1.4.4.1.2.7
***************
*** 1238,1247 ****
  }
  
- static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp);
- static void canvas_dsp(t_canvas *x, t_signal **sp)
- {
-     canvas_dodsp(x, 0, sp);
- }
- 
      /* get the document containing this canvas */
  t_canvas *canvas_getrootfor(t_canvas *x)
--- 1238,1241 ----
***************
*** 1303,1306 ****
--- 1297,1305 ----
  }
  
+ static void canvas_dsp(t_canvas *x, t_signal **sp)
+ {
+     canvas_dodsp(x, 0, sp);
+ }
+ 
      /* this routine starts DSP for all root canvases. */
  static void canvas_start_dsp(void)
***************
*** 1370,1373 ****
--- 1369,1387 ----
  }
  
+ void *canvas_getblock(t_class *blockclass, t_canvas **canvasp)
+ {
+     t_canvas *canvas = *canvasp;
+     t_gobj *g;
+     void *ret = 0;
+     for (g = canvas->gl_list; g; g = g->g_next)
+     {
+         if (g->g_pd == blockclass)
+             ret = g;
+     }
+     *canvasp = canvas->gl_owner;
+     return(ret);
+ }
+     
+ /******************* redrawing  data *********************/
  
      /* redraw all "scalars" (do this if a drawing command is changed.) 

Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.4.4.2.2.4
retrieving revision 1.4.4.2.2.5
diff -C2 -d -r1.4.4.2.2.4 -r1.4.4.2.2.5
*** g_editor.c	21 Aug 2005 11:28:24 -0000	1.4.4.2.2.4
--- g_editor.c	22 Aug 2005 16:28:26 -0000	1.4.4.2.2.5
***************
*** 1732,1736 ****
              return;
          }
!         else pd_free(&x->gl_pd);
      }
      else if (force == 1)
--- 1732,1741 ----
              return;
          }
!         else
!         {
!             sys_vgui(
! "pdtk_check {Close this window??} {.x%lx menuclose 1;\n} yes\n",
!                 x);
!         }
      }
      else if (force == 1)
***************
*** 1741,1745 ****
          while (x->gl_owner)
              x = x->gl_owner;
!         canvas_menuclose(x, 0);
      }
      else if (force == 3)
--- 1746,1759 ----
          while (x->gl_owner)
              x = x->gl_owner;
!         g = glist_finddirty(x);
!         if (g)
!         {
!             canvas_vis(g, 1);
!             sys_vgui(
! "pdtk_check {Discard changes to this window??} {.x%lx menuclose 2;\n} no\n",
!                 g);
!             return;
!         }
!         else pd_free(&x->gl_pd);
      }
      else if (force == 3)

Index: d_ugen.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_ugen.c,v
retrieving revision 1.3.4.1.2.1
retrieving revision 1.3.4.1.2.2
diff -C2 -d -r1.3.4.1.2.1 -r1.3.4.1.2.2
*** d_ugen.c	21 Aug 2005 11:28:24 -0000	1.3.4.1.2.1
--- d_ugen.c	22 Aug 2005 16:28:25 -0000	1.3.4.1.2.2
***************
*** 269,272 ****
--- 269,284 ----
  }
  
+ void block_tilde_setup(void)
+ {
+     block_class = class_new(gensym("block~"), (t_newmethod)block_new, 0,
+             sizeof(t_block), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+     class_addcreator((t_newmethod)switch_new, gensym("switch~"),
+         A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+     class_addmethod(block_class, (t_method)block_set, gensym("set"), 
+         A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+     class_addmethod(block_class, (t_method)block_dsp, gensym("dsp"), 0);
+     class_addfloat(block_class, block_float);
+ }
+ 
  /* ------------------ DSP call list ----------------------- */
  
***************
*** 693,697 ****
      t_sigoutconnect *oc, *oc2;
      t_class *class = pd_class(&u->u_obj->ob_pd);
!     int i, n, totnsig;
          /* suppress creating new signals for the outputs of signal
          inlets and subpatchs; except in the case we're an inlet and "blocking"
--- 705,709 ----
      t_sigoutconnect *oc, *oc2;
      t_class *class = pd_class(&u->u_obj->ob_pd);
!     int i, n;
          /* suppress creating new signals for the outputs of signal
          inlets and subpatchs; except in the case we're an inlet and "blocking"
***************
*** 728,733 ****
          }
      }
!     totnsig = u->u_nin + u->u_nout;
!     insig = (t_signal **)getbytes((totnsig ? totnsig : 1) * sizeof(t_signal *));
      outsig = insig + u->u_nin;
      for (sig = insig, uin = u->u_in, i = u->u_nin; i--; sig++, uin++)
--- 740,744 ----
          }
      }
!     insig = (t_signal **)getbytes((u->u_nin + u->u_nout) * sizeof(t_signal *));
      outsig = insig + u->u_nin;
      for (sig = insig, uin = u->u_in, i = u->u_nin; i--; sig++, uin++)
***************
*** 764,772 ****
          (*sig)->s_refcount = uout->o_nconnect;
      }
-         /* if thre are no input or output signals, supply one fake signal so
-         the object can learn the sample rate and block size.  Used by the
-         samplerate~ object. */
-     if (!totnsig)
-         insig[0] = signal_new(dc->dc_vecsize, dc->dc_srate);
          /* now call the DSP scheduling routine for the ugen.  This
          routine must fill in "borrowed" signal outputs in case it's either
--- 775,778 ----
***************
*** 783,789 ****
              signal_makereusable(*sig);
      }
-         /* special case: no inputs or outputs: free the fake signal we made */
-     if (!totnsig)
-         signal_makereusable(insig[0]);
      if (ugen_loud)
      {
--- 789,792 ----
***************
*** 1137,1153 ****
  }
  
  
! /* -------------------- setup routine -------------------------- */
  
! void d_ugen_setup(void)  /* really just block_setup */
  {
!     block_class = class_new(gensym("block~"), (t_newmethod)block_new, 0,
!             sizeof(t_block), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT/*IOhannes*/, 0);
!     class_addcreator((t_newmethod)switch_new, gensym("switch~"),
!         A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT/*IOhannes*/, 0);
!     class_addmethod(block_class, (t_method)block_set, gensym("set"), 
!         A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
!     class_addmethod(block_class, (t_method)block_dsp, gensym("dsp"), 0);
!     class_addfloat(block_class, block_float);
  }
  
--- 1140,1190 ----
  }
  
+ /* ------------------------ samplerate~~ -------------------------- */
  
! static t_class *samplerate_tilde_class;
  
! typedef struct _samplerate
  {
!     t_object x_obj;
!     float x_sr;
!     t_canvas *x_canvas;
! } t_samplerate;
! 
! void *canvas_getblock(t_class *blockclass, t_canvas **canvasp);
! 
! static void samplerate_tilde_bang(t_samplerate *x)
! {
!     float srate = sys_getsr();
!     t_canvas *canvas = x->x_canvas;
!     while (canvas)
!     {
!         t_block *b = (t_block *)canvas_getblock(block_class, &canvas);
!         if (b) 
!             srate *= (float)(b->x_upsample) / (float)(b->x_downsample); 
!     }
!     outlet_float(x->x_obj.ob_outlet, srate);
  }
  
+ static void *samplerate_tilde_new(t_symbol *s)
+ {
+     t_samplerate *x = (t_samplerate *)pd_new(samplerate_tilde_class);
+     outlet_new(&x->x_obj, &s_float);
+     x->x_canvas = canvas_getcurrent();
+     return (x);
+ }
+ 
+ static void samplerate_tilde_setup(void)
+ {
+     samplerate_tilde_class = class_new(gensym("samplerate~"),
+         (t_newmethod)samplerate_tilde_new, 0, sizeof(t_samplerate), 0, 0);
+     class_addbang(samplerate_tilde_class, samplerate_tilde_bang);
+ }
+ 
+ 
+ /* -------------------- setup routine -------------------------- */
+ 
+ void d_ugen_setup(void)
+ {
+     block_tilde_setup();
+ 	samplerate_tilde_setup();
+ }

Index: d_misc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_misc.c,v
retrieving revision 1.2.8.1
retrieving revision 1.2.8.2
diff -C2 -d -r1.2.8.1 -r1.2.8.2
*** d_misc.c	21 Aug 2005 11:28:24 -0000	1.2.8.1
--- d_misc.c	22 Aug 2005 16:28:25 -0000	1.2.8.2
***************
*** 218,263 ****
  }
  
- /* ------------------------ samplerate~~ -------------------------- */
- 
- static t_class *samplerate_tilde_class;
- 
- typedef struct _samplerate
- {
-     t_object x_obj;
-     float x_sr;
- } t_samplerate;
- 
- static void samplerate_tilde_bang(t_samplerate *x)
- {
-     if (!canvas_dspstate)
-     {
-         post(
-           "NB: samplerate~ momentarily started DSP to learn sample rate");
-         canvas_resume_dsp(1);
-         canvas_suspend_dsp();
-     }
-     outlet_float(x->x_obj.ob_outlet, x->x_sr);
- }
- 
- static void samplerate_tilde_dsp(t_samplerate *x, t_signal **sp)
- {
-     x->x_sr = sp[0]->s_sr;
- }
- 
- static void *samplerate_tilde_new(t_symbol *s)
- {
-     t_samplerate *x = (t_samplerate *)pd_new(samplerate_tilde_class);
-     outlet_new(&x->x_obj, &s_float);
-     return (x);
- }
- 
- static void samplerate_tilde_setup(void)
- {
-     samplerate_tilde_class = class_new(gensym("samplerate~"),
-         (t_newmethod)samplerate_tilde_new, 0, sizeof(t_samplerate), 0, 0);
-     class_addbang(samplerate_tilde_class, samplerate_tilde_bang);
-     class_addmethod(samplerate_tilde_class, (t_method)samplerate_tilde_dsp,
-         gensym("dsp"), A_CANT, 0);
- }
  
  /* ------------------------ global setup routine ------------------------- */
--- 218,221 ----
***************
*** 268,272 ****
      scope_setup();
      bang_tilde_setup();
-     samplerate_tilde_setup();
  }
  
--- 226,229 ----





More information about the Pd-cvs mailing list