Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18868
Modified Files:
Tag: desiredata
builtins.c
Log Message:
interleaved [midiin] [sysexin] [notein] [ctlin] classes together
Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.49
retrieving revision 1.1.2.50
diff -C2 -d -r1.1.2.49 -r1.1.2.50
*** builtins.c 24 Jul 2007 23:09:40 -0000 1.1.2.49
--- builtins.c 30 Jul 2007 03:02:44 -0000 1.1.2.50
***************
*** 1820,1856 ****
void outmidi_mclk(int portno);
! 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;
! }
! 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);}
- static void sysexin_free(t_midiin *x) {pd_unbind(x, sysexin_sym);}
- static void midiin_setup() {
- midiin_class = class_new2("midiin",midiin_new,midiin_free,sizeof(t_midiin),CLASS_NOINLET,"F");
- sysexin_class = class_new2("sysexin",sysexin_new,sysexin_free,sizeof(t_midiin),CLASS_NOINLET,"F");
- class_addlist(midiin_class, midiin_list);
- class_addlist(sysexin_class, midiin_list);
- class_sethelpsymbol(midiin_class, gensym("midi"));
- class_sethelpsymbol(sysexin_class, gensym("midi"));
- midiin_sym = gensym("#midiin");
- sysexin_sym = gensym("#sysexin");
- }
void inmidi_byte(int portno, int byte) {
if ( midiin_sym->thing) {t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno+1); pd_list( midiin_sym->thing, 0, 2, at);}
--- 1820,1833 ----
void outmidi_mclk(int portno);
! static t_symbol *midiin_sym, *sysexin_sym, *notein_sym, *ctlin_sym;
! static t_class *midiin_class, *sysexin_class, *notein_class, *ctlin_class;
struct t_midiin : t_object {};
! struct t_notein : t_object {t_float ch;};
! struct t_ctlin : t_object {t_float ch; t_float ctlno;};
!
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));
}
void inmidi_byte(int portno, int byte) {
if ( midiin_sym->thing) {t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno+1); pd_list( midiin_sym->thing, 0, 2, at);}
***************
*** 1860,1877 ****
}
- static t_symbol *notein_sym;
- static t_class *notein_class;
- 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;
- }
static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) {
float pitch = atom_getfloatarg(0, argc, argv);
--- 1837,1840 ----
***************
*** 1882,1892 ****
outlet_float(x->out(0), pitch);
}
! static void notein_free(t_notein *x) {pd_unbind(x, notein_sym);}
! static void notein_setup() {
! notein_class = class_new2("notein",notein_new,notein_free,sizeof(t_notein),CLASS_NOINLET,"F");
! class_addlist(notein_class, notein_list);
! class_sethelpsymbol(notein_class, gensym("midi"));
! notein_sym = gensym("#notein");
! }
void inmidi_noteon(int portno, int channel, int pitch, int velo) {
if (notein_sym->thing) {
--- 1845,1849 ----
outlet_float(x->out(0), pitch);
}
!
void inmidi_noteon(int portno, int channel, int pitch, int velo) {
if (notein_sym->thing) {
***************
*** 1899,1908 ****
}
! static t_symbol *ctlin_sym;
! static t_class *ctlin_class;
! struct t_ctlin : t_object {
! t_float ch;
! t_float ctlno;
! };
static void *ctlin_new(t_symbol *s, int argc, t_atom *argv) {
t_ctlin *x = (t_ctlin *)pd_new(ctlin_class);
--- 1856,1882 ----
}
! 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;
! }
! 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 *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;
! }
static void *ctlin_new(t_symbol *s, int argc, t_atom *argv) {
t_ctlin *x = (t_ctlin *)pd_new(ctlin_class);
***************
*** 1929,1939 ****
outlet_float(x->out(0), value);
}
! static void ctlin_free(t_ctlin *x) {pd_unbind(x, ctlin_sym);}
! static void ctlin_setup() {
! ctlin_class = class_new2("ctlin",ctlin_new,ctlin_free,sizeof(t_ctlin),CLASS_NOINLET,"*");
! class_addlist(ctlin_class, ctlin_list);
! class_sethelpsymbol(ctlin_class, gensym("midi"));
! ctlin_sym = gensym("#ctlin");
! }
void inmidi_controlchange(int portno, int channel, int ctlnumber, int value) {
if (ctlin_sym->thing) {
--- 1903,1912 ----
outlet_float(x->out(0), value);
}
!
! static void midiin_free(t_midiin *x) {pd_unbind(x, midiin_sym);}
! static void sysexin_free(t_midiin *x) {pd_unbind(x, sysexin_sym);}
! static void notein_free(t_notein *x) {pd_unbind(x, notein_sym);}
! static void ctlin_free(t_ctlin *x) {pd_unbind(x, ctlin_sym);}
!
void inmidi_controlchange(int portno, int channel, int ctlnumber, int value) {
if (ctlin_sym->thing) {
***************
*** 1962,1967 ****
static t_symbol *pgmin_sym, *bendin_sym, *touchin_sym;
static t_class *pgmin_class, *bendin_class, *touchin_class;
! struct t_pgmin : t_midi2 {};
! struct t_bendin : t_midi2 {};
struct t_touchin : t_midi2 {};
static void *pgmin_new(t_floatarg f) {
--- 1935,1940 ----
static t_symbol *pgmin_sym, *bendin_sym, *touchin_sym;
static t_class *pgmin_class, *bendin_class, *touchin_class;
! struct t_pgmin : t_midi2 {};
! struct t_bendin : t_midi2 {};
struct t_touchin : t_midi2 {};
static void *pgmin_new(t_floatarg f) {
***************
*** 1971,1991 ****
static void *touchin_new(t_floatarg f) {
t_touchin *x = (t_touchin *)midi2_new(touchin_class,f); pd_bind(x, touchin_sym); return x;}
! static void pgmin_free( t_pgmin *x) {pd_unbind(x, pgmin_sym);}
! static void bendin_free( t_bendin *x) {pd_unbind(x, bendin_sym);}
static void touchin_free(t_touchin *x) {pd_unbind(x, touchin_sym);}
- static void midi2_setup() {
- pgmin_class = class_new2("pgmin",pgmin_new,pgmin_free,sizeof(t_pgmin),CLASS_NOINLET,"F");
- class_addlist(pgmin_class,midi2_list);
- bendin_class = class_new2("bendin",bendin_new,bendin_free,sizeof(t_bendin),CLASS_NOINLET,"F");
- class_addlist(bendin_class,midi2_list);
- touchin_class = class_new2("touchin",touchin_new,touchin_free,sizeof(t_touchin),CLASS_NOINLET,"F");
- class_addlist(touchin_class,midi2_list);
- class_sethelpsymbol(pgmin_class, gensym("midi"));
- class_sethelpsymbol(bendin_class, gensym("midi"));
- class_sethelpsymbol(touchin_class, gensym("midi"));
- pgmin_sym = gensym("#pgmin");
- bendin_sym = gensym("#bendin");
- touchin_sym = gensym("#touchin");
- }
void inmidi_programchange(int portno, int channel, int value) {
if (pgmin_sym->thing) {
--- 1944,1950 ----
static void *touchin_new(t_floatarg f) {
t_touchin *x = (t_touchin *)midi2_new(touchin_class,f); pd_bind(x, touchin_sym); return x;}
! static void pgmin_free( t_pgmin *x) {pd_unbind(x, pgmin_sym);}
! static void bendin_free( t_bendin *x) {pd_unbind(x, bendin_sym);}
static void touchin_free(t_touchin *x) {pd_unbind(x, touchin_sym);}
void inmidi_programchange(int portno, int channel, int value) {
if (pgmin_sym->thing) {
***************
*** 2461,2465 ****
}
void midi_setup() {
! midiin_setup(); notein_setup(); ctlin_setup(); midi2_setup(); /*pgmin,bendin,touchin*/
polytouchin_setup(); midirealtimein_setup(); midiclkin_setup();
midiout_class = class_new2("midiout", midiout_new, 0, sizeof(t_midiout), 0,"FF");
--- 2420,2445 ----
}
void midi_setup() {
! midiin_class = class_new2( "midiin", midiin_new, midiin_free,sizeof(t_midiin),CLASS_NOINLET,"F");
! sysexin_class = class_new2("sysexin",sysexin_new,sysexin_free,sizeof(t_midiin),CLASS_NOINLET,"F");
! notein_class = class_new2( "notein", notein_new, notein_free,sizeof(t_notein),CLASS_NOINLET,"F");
! ctlin_class = class_new2( "ctlin", ctlin_new, ctlin_free,sizeof( t_ctlin),CLASS_NOINLET,"*");
! class_addlist( midiin_class, midiin_list); midiin_sym = gensym( "#midiin"); class_sethelpsymbol( midiin_class, gensym("midi"));
! class_addlist(sysexin_class, midiin_list); sysexin_sym = gensym("#sysexin"); class_sethelpsymbol(sysexin_class, gensym("midi"));
! class_addlist( notein_class, notein_list); notein_sym = gensym( "#notein"); class_sethelpsymbol( notein_class, gensym("midi"));
! class_addlist( ctlin_class, ctlin_list); ctlin_sym = gensym( "#ctlin"); class_sethelpsymbol( ctlin_class, gensym("midi"));
!
! pgmin_class = class_new2("pgmin", pgmin_new, pgmin_free, sizeof(t_pgmin), CLASS_NOINLET,"F");
! bendin_class = class_new2("bendin", bendin_new, bendin_free, sizeof(t_bendin), CLASS_NOINLET,"F");
! touchin_class = class_new2("touchin",touchin_new,touchin_free,sizeof(t_touchin),CLASS_NOINLET,"F");
! class_addlist( pgmin_class,midi2_list);
! class_addlist( bendin_class,midi2_list);
! class_addlist(touchin_class,midi2_list);
! class_sethelpsymbol( pgmin_class, gensym("midi"));
! class_sethelpsymbol( bendin_class, gensym("midi"));
! class_sethelpsymbol(touchin_class, gensym("midi"));
! pgmin_sym = gensym("#pgmin");
! bendin_sym = gensym("#bendin");
! touchin_sym = gensym("#touchin");
!
polytouchin_setup(); midirealtimein_setup(); midiclkin_setup();
midiout_class = class_new2("midiout", midiout_new, 0, sizeof(t_midiout), 0,"FF");