Revision: 10026 http://pure-data.svn.sourceforge.net/pure-data/?rev=10026&view=rev Author: zmoelnig Date: 2008-06-18 08:58:57 -0700 (Wed, 18 Jun 2008)
Log Message: ----------- [route~] for separating signals from messages
Added Paths: ----------- trunk/externals/zexy/reference/route~-help.pd trunk/externals/zexy/src/route~.c
Added: trunk/externals/zexy/reference/route~-help.pd =================================================================== --- trunk/externals/zexy/reference/route~-help.pd (rev 0) +++ trunk/externals/zexy/reference/route~-help.pd 2008-06-18 15:58:57 UTC (rev 10026) @@ -0,0 +1,21 @@ +#N canvas 304 271 597 497 10; +#X obj 65 172 osc~ 440; +#X floatatom 65 141 0 0 0 0 - - -; +#X text 442 11 part of zexy; +#X msg 82 361 bang; +#X obj 125 42 route~; +#X text 177 41 separate signals from messages; +#X obj 65 384 print~ signal; +#X obj 104 303 print message; +#X obj 65 280 route~; +#X msg 107 208 2; +#X symbolatom 127 235 10 0 0 0 - - -; +#X msg 130 257 whatever; +#X connect 0 0 8 0; +#X connect 1 0 0 0; +#X connect 3 0 6 0; +#X connect 8 0 6 0; +#X connect 8 1 7 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 8 0;
Added: trunk/externals/zexy/src/route~.c =================================================================== --- trunk/externals/zexy/src/route~.c (rev 0) +++ trunk/externals/zexy/src/route~.c 2008-06-18 15:58:57 UTC (rev 10026) @@ -0,0 +1,75 @@ +/****************************************************** + * + * zexy - implementation file + * + * copyleft (c) IOhannes m zm\xF6lnig + * + * 1999:forum::f\xFCr::uml\xE4ute:2004 + * + * institute of electronic music and acoustics (iem) + * + ****************************************************** + * + * license: GNU General Public License v.2 + ******************************************************/ + +/* route_tilde :: get the route_tilde of a list */ + + +#include "zexy.h" + +static t_class *route_tilde_class; +typedef struct _route_tilde +{ + t_object x_obj; + + t_outlet*x_sigout, *x_msgout; +} t_route_tilde; + +static void route_tilde_any(t_route_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + outlet_anything(x->x_msgout, s, argc, argv); +} + +t_int *route_tilde_perform(t_int *w) +{ + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); + int n = (int)(w[3]); + while (n--) *out++ = *in++; + return (w+4); +} + +static void route_tilde_dsp(t_route_tilde *x, t_signal **sp) +{ + if(sp) + dsp_add(route_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); + else { + route_tilde_any(x, gensym("dsp"), 0, 0); + } +} + +static void route_tilde_free(t_route_tilde *x) +{ + outlet_free(x->x_sigout); + outlet_free(x->x_msgout); +} +static void *route_tilde_new(void) +{ + t_route_tilde *x = (t_route_tilde *)pd_new(route_tilde_class); + x->x_sigout=outlet_new(&x->x_obj, &s_signal); + x->x_msgout=outlet_new(&x->x_obj, 0); + return (x); +} + +void route_tilde_setup(void) +{ + route_tilde_class = class_new(gensym("route~"), (t_newmethod)route_tilde_new, (t_method)route_tilde_free, + sizeof(t_route_tilde), 0, A_DEFFLOAT, 0); + + class_addanything(route_tilde_class, (t_method)route_tilde_any); + class_addmethod(route_tilde_class, nullfn, gensym("signal"), 0); + class_addmethod(route_tilde_class, (t_method)route_tilde_dsp, gensym("dsp"), A_CANT, 0); + + zexy_register("route~"); +}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.