[PD-cvs] pd/src builtins.c,1.1.2.13,1.1.2.14

Mathieu Bouchard matju at users.sourceforge.net
Tue Jan 9 20:59:21 CET 2007


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

Modified Files:
      Tag: desiredata
	builtins.c 
Log Message:
introducing in() out() C++ methods in t_object


Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -C2 -d -r1.1.2.13 -r1.1.2.14
*** builtins.c	9 Jan 2007 18:58:26 -0000	1.1.2.13
--- builtins.c	9 Jan 2007 19:59:19 -0000	1.1.2.14
***************
*** 64,98 ****
  template <class T> T max(T a, T b) {return a>b?a:b;}
  
! float mtof(float f) {
!     if (f <= -1500) return 0;
!     if (f > 1499) f = 1499;
!     return 8.17579891564 * exp(.0577622650 * f);
! }
! 
! float ftom(float f) {
!     return f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500;
! }
! 
! float powtodb(float f) {
!     if (f <= 0) return 0;
!     return max(100 + 10./LOGTEN * log(f),0.);
! }
! 
! float rmstodb(float f) {
!     if (f <= 0) return 0;
!     return max(100 + 20./LOGTEN * log(f),0.);
! }
! 
! float dbtopow(float f) {
!     if (f <= 0) return 0;
!     f = min(f,870.f);
!     return exp((LOGTEN * 0.1) * (f-100.));
! }
! 
! float dbtorms(float f) {
!     if (f <= 0) return 0;
!     f = min(f,485.f);
!     return exp((LOGTEN * 0.05) * (f-100.));
! }
  
  /* ------------- corresponding objects ----------------------- */
--- 64,73 ----
  template <class T> T max(T a, T b) {return a>b?a:b;}
  
! float mtof(float f) {return f>-1500 ? 8.17579891564 * exp(.0577622650 * min(f,1499.f)) : 0;}
! float ftom(float f) {return f>0 ? 17.3123405046 * log(.12231220585 * f) : -1500;}
! float powtodb(float f) {return f>0 ? max(100 + 10./LOGTEN * log(f),0.) : 0;}
! float rmstodb(float f) {return f>0 ? max(100 + 20./LOGTEN * log(f),0.) : 0;}
! float dbtopow(float f) {return f>0 ? exp((LOGTEN * 0.1 ) * (min(f,870.f)-100.)) : 0;}
! float dbtorms(float f) {return f>0 ? exp((LOGTEN * 0.05) * (min(f,485.f)-100.)) : 0;}
  
  /* ------------- corresponding objects ----------------------- */
***************
*** 202,219 ****
  static void keyup_float(t_keyup *x, t_floatarg f) {outlet_float(x->outlet, f);}
  
! struct t_keyname : t_object {
!     t_outlet *out1;
!     t_outlet *out2;
! };
  static void *keyname_new() {
      t_keyname *x = (t_keyname *)pd_new(keyname_class);
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_symbol);
      pd_bind(x, keyname_sym);
      return x;
  }
  static void keyname_list(t_keyname *x, t_symbol *s, int ac, t_atom *av) {
!     outlet_symbol(x->out2, atom_getsymbolarg(1, ac, av));
!     outlet_float(x->out1, atom_getfloatarg(0, ac, av));
  }
  static void key_free(t_key *x) {pd_unbind(x, key_sym);}
--- 177,191 ----
  static void keyup_float(t_keyup *x, t_floatarg f) {outlet_float(x->outlet, f);}
  
! struct t_keyname : t_object {};
  static void *keyname_new() {
      t_keyname *x = (t_keyname *)pd_new(keyname_class);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_symbol);
      pd_bind(x, keyname_sym);
      return x;
  }
  static void keyname_list(t_keyname *x, t_symbol *s, int ac, t_atom *av) {
!     outlet_symbol(x->out(1), atom_getsymbolarg(1, ac, av));
!     outlet_float( x->out(0), atom_getfloatarg( 0, ac, av));
  }
  static void key_free(t_key *x) {pd_unbind(x, key_sym);}
***************
*** 455,459 ****
  
  struct t_qlist : t_object {
-     t_outlet *bangout;
      t_binbuf *binbuf;
      int onset;                /* playback position */
--- 427,430 ----
***************
*** 473,477 ****
      x->clock = clock_new(x, (t_method)qlist_tick);
      outlet_new(x, &s_list);
!     x->bangout = outlet_new(x, &s_bang);
      x->onset = 0x7fffffff;
      x->tempo = 1;
--- 444,448 ----
      x->clock = clock_new(x, (t_method)qlist_tick);
      outlet_new(x, &s_list);
!     outlet_new(x, &s_bang);
      x->onset = 0x7fffffff;
      x->tempo = 1;
***************
*** 542,546 ****
  end:
      x->onset = 0x7fffffff;
!     outlet_bang(x->bangout);
      x->whenclockset = 0;
  }
--- 513,517 ----
  end:
      x->onset = 0x7fffffff;
!     outlet_bang(x->out(1));
      x->whenclockset = 0;
  }
***************
*** 611,615 ****
      x->binbuf = binbuf_new();
      outlet_new(x, &s_list);
!     x->bangout = outlet_new(x, &s_bang);
      x->onset = 0x7fffffff;
      x->reentered = 0;
--- 582,586 ----
      x->binbuf = binbuf_new();
      outlet_new(x, &s_list);
!     outlet_new(x, &s_bang);
      x->onset = 0x7fffffff;
      x->reentered = 0;
***************
*** 636,640 ****
      } else {
          x->onset = 0x7fffffff;
!         outlet_bang(x->bangout);
      }
  }
--- 607,611 ----
      } else {
          x->onset = 0x7fffffff;
!         outlet_bang(x->out(1));
      }
  }
***************
*** 806,818 ****
  struct t_list_split : t_object {
      t_float f;
-     t_outlet *out1;
-     t_outlet *out2;
-     t_outlet *out3;
  };
  static t_pd *list_split_new(t_floatarg f) {
      t_list_split *x = (t_list_split *)pd_new(list_split_class);
!     x->out1 = outlet_new(x, &s_list);
!     x->out2 = outlet_new(x, &s_list);
!     x->out3 = outlet_new(x, &s_list);
      floatinlet_new(x, &x->f);
      x->f = f;
--- 777,786 ----
  struct t_list_split : t_object {
      t_float f;
  };
  static t_pd *list_split_new(t_floatarg f) {
      t_list_split *x = (t_list_split *)pd_new(list_split_class);
!     outlet_new(x, &s_list);
!     outlet_new(x, &s_list);
!     outlet_new(x, &s_list);
      floatinlet_new(x, &x->f);
      x->f = f;
***************
*** 823,829 ****
      if (n < 0) n = 0;
      if (argc >= n) {
!         outlet_list(x->out2, &s_list, argc-n, argv+n);
!         outlet_list(x->out1, &s_list, n, argv);
!     } else outlet_list(x->out3, &s_list, argc, argv);
  }
  static void list_split_anything(t_list_split *x, t_symbol *s, int argc, t_atom *argv) {
--- 791,797 ----
      if (n < 0) n = 0;
      if (argc >= n) {
!         outlet_list(x->out(1), &s_list, argc-n, argv+n);
!         outlet_list(x->out(0), &s_list, n, argv);
!     } else outlet_list(x->out(2), &s_list, argc, argv);
  }
  static void list_split_anything(t_list_split *x, t_symbol *s, int argc, t_atom *argv) {
***************
*** 1442,1455 ****
  struct t_sel1 : t_object {
      t_atom atom;
-     t_outlet *out1;
-     t_outlet *out2;
  };
  static void sel1_float(t_sel1 *x, t_float f) {
!     if (x->atom.a_type == A_FLOAT && f == x->atom.a_w.w_float) outlet_bang(x->out1);
!     else outlet_float(x->out2, f);
  }
  static void sel1_symbol(t_sel1 *x, t_symbol *s) {
!     if (x->atom.a_type == A_SYMBOL && s == x->atom.a_w.w_symbol) outlet_bang(x->out1);
!     else outlet_symbol(x->out2, s);
  }
  static t_class *sel2_class;
--- 1410,1419 ----
  struct t_sel1 : t_object {
      t_atom atom;
  };
  static void sel1_float(t_sel1 *x, t_float f) {
!     if (x->atom.a_type==A_FLOAT && f == x->atom.a_w.w_float) outlet_bang(x->out(0)); else outlet_float(x->out(1),f);
  }
  static void sel1_symbol(t_sel1 *x, t_symbol *s) {
!     if (x->atom.a_type==A_SYMBOL && s == x->atom.a_w.w_symbol) outlet_bang(x->out(0)); else outlet_symbol(x->out(1),s);
  }
  static t_class *sel2_class;
***************
*** 1495,1505 ****
          t_sel1 *x = (t_sel1 *)pd_new(sel1_class);
          x->atom = *argv;
!         x->out1 = outlet_new(x, &s_bang);
          if (argv->a_type == A_FLOAT) {
!             floatinlet_new(x, &x->atom.a_w.w_float);
!             x->out2 = outlet_new(x, &s_float);
          } else {
!             symbolinlet_new(x, &x->atom.a_w.w_symbol);
!             x->out2 = outlet_new(x, &s_symbol);
          }
          return x;
--- 1459,1467 ----
          t_sel1 *x = (t_sel1 *)pd_new(sel1_class);
          x->atom = *argv;
!         outlet_new(x, &s_bang);
          if (argv->a_type == A_FLOAT) {
!             floatinlet_new(x, &x->atom.a_w.w_float); outlet_new(x, &s_float);
          } else {
!             symbolinlet_new(x, &x->atom.a_w.w_symbol); outlet_new(x, &s_symbol);
          }
          return x;
***************
*** 1896,1905 ****
  }
  static void trigger_bang(t_trigger *x) {trigger_list(x, 0, 0, 0);}
! static void trigger_pointer(t_trigger *x, t_gpointer *gp) {
!     t_atom at; SETPOINTER(&at, gp); trigger_list(x, 0, 1, &at);}
! static void trigger_float(t_trigger *x, t_float f) {
!     t_atom at; SETFLOAT(&at, f); trigger_list(x, 0, 1, &at);}
! static void trigger_symbol(t_trigger *x, t_symbol *s) {
!     t_atom at; SETSYMBOL(&at, s); trigger_list(x, 0, 1, &at);}
  static void trigger_free(t_trigger *x) {free(x->vec);}
  static void trigger_setup() {
--- 1858,1864 ----
  }
  static void trigger_bang(t_trigger *x) {trigger_list(x, 0, 0, 0);}
! static void trigger_pointer(t_trigger *x, t_gpointer *gp) {t_atom at; SETPOINTER(&at, gp); trigger_list(x, 0, 1, &at);}
! static void trigger_float(t_trigger *x, t_float f) {       t_atom at; SETFLOAT(&at, f);    trigger_list(x, 0, 1, &at);}
! static void trigger_symbol(t_trigger *x, t_symbol *s) {    t_atom at; SETSYMBOL(&at, s);   trigger_list(x, 0, 1, &at);}
  static void trigger_free(t_trigger *x) {free(x->vec);}
  static void trigger_setup() {
***************
*** 1949,1953 ****
  static t_class *moses_class;
  struct t_moses : t_object {
-     t_outlet *out2;
      float y;
  };
--- 1908,1911 ----
***************
*** 1956,1967 ****
      floatinlet_new(x, &x->y);
      outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      x->y = f;
      return x;
  }
! static void moses_float(t_moses *x, t_float f) {
!     if (f < x->y) outlet_float(x->outlet, f);
!     else outlet_float(x->out2, f);
! }
  static void moses_setup() {
      moses_class = class_new2("moses",moses_new,0,sizeof(t_moses),0,"F");
--- 1914,1922 ----
      floatinlet_new(x, &x->y);
      outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      x->y = f;
      return x;
  }
! static void moses_float(t_moses *x, t_float f) {outlet_float(x->out(f>=x->y), f);}
  static void moses_setup() {
      moses_class = class_new2("moses",moses_new,0,sizeof(t_moses),0,"F");
***************
*** 2031,2035 ****
  static t_class *swap_class;
  struct t_swap : t_object {
-     t_outlet *out2;
      t_float f1;
      t_float f2;
--- 1986,1989 ----
***************
*** 2040,2050 ****
      x->f1 = 0;
      outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      floatinlet_new(x, &x->f2);
      return x;
  }
  static void swap_bang(t_swap *x) {
!     outlet_float(x->out2, x->f1);
!     outlet_float(x->outlet, x->f2);
  }
  static void swap_float(t_swap *x, t_float f) {
--- 1994,2004 ----
      x->f1 = 0;
      outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      floatinlet_new(x, &x->f2);
      return x;
  }
  static void swap_bang(t_swap *x) {
!     outlet_float(x->out(1), x->f1);
!     outlet_float(x->out(0), x->f2);
  }
  static void swap_float(t_swap *x, t_float f) {
***************
*** 2163,2174 ****
  static t_symbol *midiin_sym, *sysexin_sym;
  static t_class *midiin_class, *sysexin_class;
! struct t_midiin : t_object {
!     t_outlet *out1;
!     t_outlet *out2;
! };
  static void *midiin_new() {
      t_midiin *x = (t_midiin *)pd_new(midiin_class);
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      pd_bind(x, midiin_sym);
      return x;
--- 2117,2125 ----
  static t_symbol *midiin_sym, *sysexin_sym;
  static t_class *midiin_class, *sysexin_class;
! struct t_midiin : t_object {};
  static void *midiin_new() {
      t_midiin *x = (t_midiin *)pd_new(midiin_class);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      pd_bind(x, midiin_sym);
      return x;
***************
*** 2176,2187 ****
  static void *sysexin_new() {
      t_midiin *x = (t_midiin *)pd_new(sysexin_class);
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      pd_bind(x, sysexin_sym);
      return x;
  }
  static void midiin_list(t_midiin *x, t_symbol *s, int ac, t_atom *av) {
!     outlet_float(x->out2, atom_getfloatarg(1, ac, av) + 1);
!     outlet_float(x->out1, atom_getfloatarg(0, ac, av));
  }
  static void midiin_free(t_midiin *x)  {pd_unbind(x, midiin_sym);}
--- 2127,2138 ----
  static void *sysexin_new() {
      t_midiin *x = (t_midiin *)pd_new(sysexin_class);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      pd_bind(x, sysexin_sym);
      return x;
  }
  static void midiin_list(t_midiin *x, t_symbol *s, int ac, t_atom *av) {
!     outlet_float(x->out(1), atom_getfloatarg(1, ac, av) + 1);
!     outlet_float(x->out(0), atom_getfloatarg(0, ac, av));
  }
  static void midiin_free(t_midiin *x)  {pd_unbind(x, midiin_sym);}
***************
*** 2214,2227 ****
  struct t_notein : t_object {
      t_float ch;
-     t_outlet *out1;
-     t_outlet *out2;
-     t_outlet *out3;
  };
  static void *notein_new(t_floatarg f) {
      t_notein *x = (t_notein *)pd_new(notein_class);
      x->ch = f;
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
!     if (f == 0) x->out3 = outlet_new(x, &s_float);
      pd_bind(x, notein_sym);
      return x;
--- 2165,2175 ----
  struct t_notein : t_object {
      t_float ch;
  };
  static void *notein_new(t_floatarg f) {
      t_notein *x = (t_notein *)pd_new(notein_class);
      x->ch = f;
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
!     if (f == 0) outlet_new(x, &s_float);
      pd_bind(x, notein_sym);
      return x;
***************
*** 2231,2237 ****
      float velo = atom_getfloatarg(1, argc, argv);
      float channel = atom_getfloatarg(2, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out3, channel);
!     outlet_float(x->out2, velo);
!     outlet_float(x->out1, pitch);
  }
  static void notein_free(t_notein *x) {pd_unbind(x, notein_sym);}
--- 2179,2185 ----
      float velo = atom_getfloatarg(1, argc, argv);
      float channel = atom_getfloatarg(2, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(2), channel);
!     outlet_float(x->out(1), velo);
!     outlet_float(x->out(0), pitch);
  }
  static void notein_free(t_notein *x) {pd_unbind(x, notein_sym);}
***************
*** 2257,2263 ****
      t_float ch;
      t_float ctlno;
-     t_outlet *out1;
-     t_outlet *out2;
-     t_outlet *out3;
  };
  static void *ctlin_new(t_symbol *s, int argc, t_atom *argv) {
--- 2205,2208 ----
***************
*** 2267,2274 ****
      x->ch = channel;
      x->ctlno = ctlno;
!     x->out1 = outlet_new(x, &s_float);
      if (!channel) {
!         if (x->ctlno < 0) x->out2 = outlet_new(x, &s_float);
!         x->out3 = outlet_new(x, &s_float);
      }
      pd_bind(x, ctlin_sym);
--- 2212,2219 ----
      x->ch = channel;
      x->ctlno = ctlno;
!     outlet_new(x, &s_float);
      if (!channel) {
!         if (x->ctlno < 0) outlet_new(x, &s_float);
!         outlet_new(x, &s_float);
      }
      pd_bind(x, ctlin_sym);
***************
*** 2281,2287 ****
      if (x->ctlno >= 0 && x->ctlno != ctlnumber) return;
      if (x->ch > 0  && x->ch != channel) return;
!     if (x->ch == 0) outlet_float(x->out3, channel);
!     if (x->ctlno < 0) outlet_float(x->out2, ctlnumber);
!     outlet_float(x->out1, value);
  }
  static void ctlin_free(t_ctlin *x) {pd_unbind(x, ctlin_sym);}
--- 2226,2232 ----
      if (x->ctlno >= 0 && x->ctlno != ctlnumber) return;
      if (x->ch > 0  && x->ch != channel) return;
!     if (x->ch == 0) outlet_float(x->out(2), channel);
!     if (x->ctlno < 0) outlet_float(x->out(1), ctlnumber);
!     outlet_float(x->out(0), value);
  }
  static void ctlin_free(t_ctlin *x) {pd_unbind(x, ctlin_sym);}
***************
*** 2304,2315 ****
  struct t_midi2 : t_object {
      t_float ch;
-     t_outlet *out1;
-     t_outlet *out2;
  };
  static void *midi2_new(t_class *cl, t_floatarg ch) {
      t_midi2 *x = (t_midi2 *)pd_new(cl);
      x->ch = ch;
!     x->out1 = outlet_new(x, &s_float);
!     if (!ch) x->out2 = outlet_new(x, &s_float);
      return x;
  }
--- 2249,2258 ----
  struct t_midi2 : t_object {
      t_float ch;
  };
  static void *midi2_new(t_class *cl, t_floatarg ch) {
      t_midi2 *x = (t_midi2 *)pd_new(cl);
      x->ch = ch;
!     outlet_new(x, &s_float);
!     if (!ch) outlet_new(x, &s_float);
      return x;
  }
***************
*** 2317,2322 ****
      float value = atom_getfloatarg(0, argc, argv);
      float channel = atom_getfloatarg(1, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out2, channel);
!     outlet_float(x->out1, value);
  }
  static t_symbol *pgmin_sym, *bendin_sym, *touchin_sym;
--- 2260,2265 ----
      float value = atom_getfloatarg(0, argc, argv);
      float channel = atom_getfloatarg(1, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(1), channel);
!     outlet_float(x->out(0), value);
  }
  static t_symbol *pgmin_sym, *bendin_sym, *touchin_sym;
***************
*** 2372,2385 ****
  struct t_polytouchin : t_object {
      t_float ch;
-     t_outlet *out1;
-     t_outlet *out2;
-     t_outlet *out3;
  };
  static void *polytouchin_new(t_floatarg f) {
      t_polytouchin *x = (t_polytouchin *)pd_new(polytouchin_class);
      x->ch = f;
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
!     if (f == 0) x->out3 = outlet_new(x, &s_float);
      pd_bind(x, polytouchin_sym);
      return x;
--- 2315,2325 ----
  struct t_polytouchin : t_object {
      t_float ch;
  };
  static void *polytouchin_new(t_floatarg f) {
      t_polytouchin *x = (t_polytouchin *)pd_new(polytouchin_class);
      x->ch = f;
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
!     if (f == 0) outlet_new(x, &s_float);
      pd_bind(x, polytouchin_sym);
      return x;
***************
*** 2387,2393 ****
  static void polytouchin_list(t_polytouchin *x, t_symbol *s, int argc, t_atom *argv) {
      t_float channel = atom_getfloatarg(2, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out3, channel);
!     outlet_float(x->out2, atom_getfloatarg(0, argc, argv)); /*pitch*/
!     outlet_float(x->out1, atom_getfloatarg(1, argc, argv)); /*value*/
  }
  static void polytouchin_free(t_polytouchin *x) {pd_unbind(x, polytouchin_sym);}
--- 2327,2333 ----
  static void polytouchin_list(t_polytouchin *x, t_symbol *s, int argc, t_atom *argv) {
      t_float channel = atom_getfloatarg(2, argc, argv);
!     if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(2), channel);
!     outlet_float(x->out(1), atom_getfloatarg(0, argc, argv)); /*pitch*/
!     outlet_float(x->out(0), atom_getfloatarg(1, argc, argv)); /*value*/
  }
  static void polytouchin_free(t_polytouchin *x) {pd_unbind(x, polytouchin_sym);}
***************
*** 2412,2429 ****
  static t_symbol *midiclkin_sym;
  static t_class *midiclkin_class;
! struct t_midiclkin : t_object {
!     t_outlet *out1;
!     t_outlet *out2;
! };
  static void *midiclkin_new(t_floatarg f) {
      t_midiclkin *x = (t_midiclkin *)pd_new(midiclkin_class);
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      pd_bind(x, midiclkin_sym);
      return x;
  }
  static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv) {
!     outlet_float(x->out2, atom_getfloatarg(1, argc, argv)); /*count*/
!     outlet_float(x->out1, atom_getfloatarg(0, argc, argv)); /*value*/
  }
  static void midiclkin_free(t_midiclkin *x) {pd_unbind(x, midiclkin_sym);}
--- 2352,2366 ----
  static t_symbol *midiclkin_sym;
  static t_class *midiclkin_class;
! struct t_midiclkin : t_object {};
  static void *midiclkin_new(t_floatarg f) {
      t_midiclkin *x = (t_midiclkin *)pd_new(midiclkin_class);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      pd_bind(x, midiclkin_sym);
      return x;
  }
  static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv) {
!     outlet_float(x->out(1), atom_getfloatarg(1, argc, argv)); /*count*/
!     outlet_float(x->out(0), atom_getfloatarg(0, argc, argv)); /*value*/
  }
  static void midiclkin_free(t_midiclkin *x) {pd_unbind(x, midiclkin_sym);}
***************
*** 2452,2469 ****
  static t_symbol *midirealtimein_sym;
  static t_class *midirealtimein_class;
! struct t_midirealtimein : t_object {
!     t_outlet *out1;
!     t_outlet *out2;
! };
  static void *midirealtimein_new() {
      t_midirealtimein *x = (t_midirealtimein *)pd_new(midirealtimein_class);
!     x->out1 = outlet_new(x, &s_float);
!     x->out2 = outlet_new(x, &s_float);
      pd_bind(x, midirealtimein_sym);
      return x;
  }
  static void midirealtimein_list(t_midirealtimein *x, t_symbol *s, int argc, t_atom *argv) {
!     outlet_float(x->out2, atom_getfloatarg(0, argc, argv)); /*portno*/
!     outlet_float(x->out1, atom_getfloatarg(1, argc, argv)); /*byte*/
  }
  static void midirealtimein_free(t_midirealtimein *x) {pd_unbind(x, midirealtimein_sym);}
--- 2389,2403 ----
  static t_symbol *midirealtimein_sym;
  static t_class *midirealtimein_class;
! struct t_midirealtimein : t_object {};
  static void *midirealtimein_new() {
      t_midirealtimein *x = (t_midirealtimein *)pd_new(midirealtimein_class);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      pd_bind(x, midirealtimein_sym);
      return x;
  }
  static void midirealtimein_list(t_midirealtimein *x, t_symbol *s, int argc, t_atom *argv) {
!     outlet_float(x->out(1), atom_getfloatarg(0, argc, argv)); /*portno*/
!     outlet_float(x->out(0), atom_getfloatarg(1, argc, argv)); /*byte*/
  }
  static void midirealtimein_free(t_midirealtimein *x) {pd_unbind(x, midirealtimein_sym);}
***************
*** 2622,2627 ****
      t_float velo;
      t_float dur;
-     t_outlet *pitchout;
-     t_outlet *velout;
      t_hang *hang;
  };
--- 2556,2559 ----
***************
*** 2632,2637 ****
      floatinlet_new(x, &x->velo);
      floatinlet_new(x, &x->dur);
!     x->pitchout = outlet_new(x, &s_float);
!     x->velout = outlet_new(x, &s_float);
      x->hang = 0;
      return x;
--- 2564,2569 ----
      floatinlet_new(x, &x->velo);
      floatinlet_new(x, &x->dur);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      x->hang = 0;
      return x;
***************
*** 2640,2645 ****
      t_makenote *x = hang->owner;
      t_hang *h2, *h3;
!     outlet_float(x->velout, 0);
!     outlet_float(x->pitchout, hang->pitch);
      if (x->hang == hang) x->hang = hang->next;
      else for (h2 = x->hang; (h3 = h2->next); h2 = h3) {
--- 2572,2577 ----
      t_makenote *x = hang->owner;
      t_hang *h2, *h3;
!     outlet_float(x->out(1), 0);
!     outlet_float(x->out(0), hang->pitch);
      if (x->hang == hang) x->hang = hang->next;
      else for (h2 = x->hang; (h3 = h2->next); h2 = h3) {
***************
*** 2655,2660 ****
      t_hang *hang;
      if (!x->velo) return;
!     outlet_float(x->velout, x->velo);
!     outlet_float(x->pitchout, f);
      hang = (t_hang *)getbytes(sizeof *hang);
      hang->next = x->hang;
--- 2587,2592 ----
      t_hang *hang;
      if (!x->velo) return;
!     outlet_float(x->out(1), x->velo);
!     outlet_float(x->out(0), f);
      hang = (t_hang *)getbytes(sizeof *hang);
      hang->next = x->hang;
***************
*** 2668,2673 ****
      t_hang *hang;
      while ((hang = x->hang)) {
!         outlet_float(x->velout, 0);
!         outlet_float(x->pitchout, hang->pitch);
          x->hang = hang->next;
          clock_free(hang->clock);
--- 2600,2605 ----
      t_hang *hang;
      while ((hang = x->hang)) {
!         outlet_float(x->out(1), 0);
!         outlet_float(x->out(0), hang->pitch);
          x->hang = hang->next;
          clock_free(hang->clock);
***************
*** 2693,2710 ****
  struct t_stripnote : t_object {
      t_float velo;
-     t_outlet *pitchout;
-     t_outlet *velout;
  };
  static void *stripnote_new() {
      t_stripnote *x = (t_stripnote *)pd_new(stripnote_class);
      floatinlet_new(x, &x->velo);
!     x->pitchout = outlet_new(x, &s_float);
!     x->velout = outlet_new(x, &s_float);
      return x;
  }
  static void stripnote_float(t_stripnote *x, t_float f) {
      if (!x->velo) return;
!     outlet_float(x->velout, x->velo);
!     outlet_float(x->pitchout, f);
  }
  static void stripnote_setup() {
--- 2625,2640 ----
  struct t_stripnote : t_object {
      t_float velo;
  };
  static void *stripnote_new() {
      t_stripnote *x = (t_stripnote *)pd_new(stripnote_class);
      floatinlet_new(x, &x->velo);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      return x;
  }
  static void stripnote_float(t_stripnote *x, t_float f) {
      if (!x->velo) return;
!     outlet_float(x->out(1), x->velo);
!     outlet_float(x->out(0), f);
  }
  static void stripnote_setup() {
***************
*** 2723,2728 ****
      t_voice *vec;
      float vel;
-     t_outlet *pitchout;
-     t_outlet *velout;
      unsigned long serial;
      int steal;
--- 2653,2656 ----
***************
*** 2740,2745 ****
      floatinlet_new(x, &x->vel);
      outlet_new(x, &s_float);
!     x->pitchout = outlet_new(x, &s_float);
!     x->velout = outlet_new(x, &s_float);
      x->serial = 0;
      return x;
--- 2668,2673 ----
      floatinlet_new(x, &x->vel);
      outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
!     outlet_new(x, &s_float);
      x->serial = 0;
      return x;
***************
*** 2759,2765 ****
          }
          if (firstoff) {
!             outlet_float(x->velout, x->vel);
!             outlet_float(x->pitchout, firstoff->pitch = f);
!             outlet_float(x->outlet, offindex+1);
              firstoff->used = 1;
              firstoff->serial = x->serial++;
--- 2687,2693 ----
          }
          if (firstoff) {
!             outlet_float(x->out(2), x->vel);
!             outlet_float(x->out(1), firstoff->pitch = f);
!             outlet_float(x->out(0), offindex+1);
              firstoff->used = 1;
              firstoff->serial = x->serial++;
***************
*** 2767,2776 ****
          /* if none, steal one */
          else if (firston && x->steal) {
!             outlet_float(x->velout, 0);
!             outlet_float(x->pitchout, firston->pitch);
!             outlet_float(x->outlet, onindex+1);
!             outlet_float(x->velout, x->vel);
!             outlet_float(x->pitchout, firston->pitch = f);
!             outlet_float(x->outlet, onindex+1);
              firston->serial = x->serial++;
          }
--- 2695,2704 ----
          /* if none, steal one */
          else if (firston && x->steal) {
!             outlet_float(x->out(2), 0);
!             outlet_float(x->out(1), firston->pitch);
!             outlet_float(x->out(0), onindex+1);
!             outlet_float(x->out(2), x->vel);
!             outlet_float(x->out(1), firston->pitch = f);
!             outlet_float(x->out(0), onindex+1);
              firston->serial = x->serial++;
          }
***************
*** 2782,2788 ****
              firston->used = 0;
              firston->serial = x->serial++;
!             outlet_float(x->velout, 0);
!             outlet_float(x->pitchout, firston->pitch);
!             outlet_float(x->outlet, onindex+1);
          }
      }
--- 2710,2716 ----
              firston->used = 0;
              firston->serial = x->serial++;
!             outlet_float(x->out(2), 0);
!             outlet_float(x->out(1), firston->pitch);
!             outlet_float(x->out(0), onindex+1);
          }
      }
***************
*** 2791,2797 ****
      t_voice *v = x->vec;
      for (int i = 0; i < x->n; i++, v++) if (v->used) {
!         outlet_float(x->velout, 0L);
!         outlet_float(x->pitchout, v->pitch);
!         outlet_float(x->outlet, i+1);
          v->used = 0;
          v->serial = x->serial++;
--- 2719,2725 ----
      t_voice *v = x->vec;
      for (int i = 0; i < x->n; i++, v++) if (v->used) {
!         outlet_float(x->out(2), 0L);
!         outlet_float(x->out(1), v->pitch);
!         outlet_float(x->out(0), i+1);
          v->used = 0;
          v->serial = x->serial++;
***************
*** 3061,3067 ****
  };
  struct t_pipeout {
!     t_atom p_atom;
!     t_outlet *p_outlet;
! } ;
  struct t_pipe : t_object {
      int n;
--- 2989,2994 ----
  };
  struct t_pipeout {
!     t_atom a;
! };
  struct t_pipe : t_object {
      int n;
***************
*** 3104,3128 ****
      for (i = 0, vp = vec, ap = argv; i < argc; i++, ap++, vp++) {
          if (ap->a_type == A_FLOAT) {
!             vp->p_atom = *ap;
!             vp->p_outlet = outlet_new(x, &s_float);
!             if (i) floatinlet_new(x, &vp->p_atom.a_w.w_float);
          } else if (ap->a_type == A_SYMBOL) {
              char c = *ap->a_w.w_symbol->name;
              if (c == 's') {
!                 SETSYMBOL(&vp->p_atom, &s_symbol);
!                 vp->p_outlet = outlet_new(x, &s_symbol);
!                 if (i) symbolinlet_new(x, &vp->p_atom.a_w.w_symbol);
              } else if (c == 'p') {
!                 vp->p_atom.a_type = A_POINTER;
!                 vp->p_atom.a_w.w_gpointer = gp;
                  gpointer_init(gp);
!                 vp->p_outlet = outlet_new(x, &s_pointer);
                  if (i) pointerinlet_new(x, gp);
                  gp++;
              } else {
                  if (c != 'f') error("pack: %s: bad type", ap->a_w.w_symbol->name);
!                 SETFLOAT(&vp->p_atom, 0);
!                 vp->p_outlet = outlet_new(x, &s_float);
!                 if (i) floatinlet_new(x, &vp->p_atom.a_w.w_float);
              }
          }
--- 3031,3055 ----
      for (i = 0, vp = vec, ap = argv; i < argc; i++, ap++, vp++) {
          if (ap->a_type == A_FLOAT) {
!             vp->a = *ap;
!             outlet_new(x, &s_float);
!             if (i) floatinlet_new(x, &vp->a.a_w.w_float);
          } else if (ap->a_type == A_SYMBOL) {
              char c = *ap->a_w.w_symbol->name;
              if (c == 's') {
!                 SETSYMBOL(&vp->a, &s_symbol);
!                 outlet_new(x, &s_symbol);
!                 if (i) symbolinlet_new(x, &vp->a.a_w.w_symbol);
              } else if (c == 'p') {
!                 vp->a.a_type = A_POINTER;
!                 vp->a.a_w.w_gpointer = gp;
                  gpointer_init(gp);
!                 outlet_new(x, &s_pointer);
                  if (i) pointerinlet_new(x, gp);
                  gp++;
              } else {
                  if (c != 'f') error("pack: %s: bad type", ap->a_w.w_symbol->name);
!                 SETFLOAT(&vp->a, 0);
!                 outlet_new(x, &s_float);
!                 if (i) floatinlet_new(x, &vp->a.a_w.w_float);
              }
          }
***************
*** 3155,3163 ****
      }
      for (i = x->n, p = x->vec + (x->n - 1), w = h->h_vec + (x->n - 1); i--; p--, w--) {
!         switch (p->p_atom.a_type) {
!         case A_FLOAT: outlet_float(p->p_outlet, w->w_float); break;
!         case A_SYMBOL: outlet_symbol(p->p_outlet, w->w_symbol); break;
          case A_POINTER:
!             if (gpointer_check(w->w_gpointer, 1)) outlet_pointer(p->p_outlet, w->w_gpointer);
              else post("pipe: stale pointer");
              break;
--- 3082,3090 ----
      }
      for (i = x->n, p = x->vec + (x->n - 1), w = h->h_vec + (x->n - 1); i--; p--, w--) {
!         switch (p->a.a_type) {
!         case A_FLOAT:  outlet_float( x->out(i),w->w_float); break;
!         case A_SYMBOL: outlet_symbol(x->out(i),w->w_symbol); break;
          case A_POINTER:
!             if (gpointer_check(w->w_gpointer, 1)) outlet_pointer(x->out(i), w->w_gpointer);
              else post("pipe: stale pointer");
              break;
***************
*** 3177,3183 ****
      if (ac > n) ac = n;
      for (i = 0, gp = x->gp, p = x->vec, ap = av; i < ac; i++, p++, ap++) {
!         switch (p->p_atom.a_type) {
!         case A_FLOAT: p->p_atom.a_w.w_float = atom_getfloat(ap); break;
!         case A_SYMBOL: p->p_atom.a_w.w_symbol = atom_getsymbol(ap); break;
          case A_POINTER:
              gpointer_unset(gp);
--- 3104,3110 ----
      if (ac > n) ac = n;
      for (i = 0, gp = x->gp, p = x->vec, ap = av; i < ac; i++, p++, ap++) {
!         switch (p->a.a_type) {
!         case A_FLOAT: p->a.a_w.w_float = atom_getfloat(ap); break;
!         case A_SYMBOL: p->a.a_w.w_symbol = atom_getsymbol(ap); break;
          case A_POINTER:
              gpointer_unset(gp);
***************
*** 3192,3200 ****
      }
      for (i = 0, gp = x->gp, gp2 = h->h_gp, p = x->vec, w = h->h_vec; i < n; i++, p++, w++) {
!         if (p->p_atom.a_type == A_POINTER) {
              if (gp->o) gp->o->refcount++;
              w->w_gpointer = gp2;
              *gp2++ = *gp++;
!         } else *w = p->p_atom.a_w;
      }
      h->h_next = x->hang;
--- 3119,3127 ----
      }
      for (i = 0, gp = x->gp, gp2 = h->h_gp, p = x->vec, w = h->h_vec; i < n; i++, p++, w++) {
!         if (p->a.a_type == A_POINTER) {
              if (gp->o) gp->o->refcount++;
              w->w_gpointer = gp2;
              *gp2++ = *gp++;
!         } else *w = p->a.a_w;
      }
      h->h_next = x->hang;





More information about the Pd-cvs mailing list