here's some code i'm messing with. i want to get the second argument from an external declaration, and then use that number to create a certain amount of inlets. here' the code, and there's some shit commented out that i was just playing around with but couldn't get to work.
static void *multi_source_convolution_tilde_new(t_floatarg f, int argc, t_atom *argv) {
int a = (int)atom_getintarg(0, argc, argv); int i = (int)atom_getintarg(1, argc, argv);
t_multi_source_convolution_tilde *x = (t_multi_source_convolution_tilde *)pd_new(multi_source_convolution_tilde_class);
x->f_multi_source_convolution = f;
//additional signal and float inlets
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("first")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("bound"));
//i = argv[2].a_w.w_float;
//i = argv[2].a_w->w_float;
/* i = atom_getintarg(2, argc, argv); if(argc == 2) { for(a = 0; a < i; a++) { inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); } } */ post("OUTSIDE");
if(i == 0) { post("zero"); }
if(i == 1) { post("one"); }
if(i == 2) { post("two"); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); }
else if( (argc == 1) || (argc > 2) ) { inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); }
//two signal outlets for stereo outlet_new(&x->x_obj, &s_signal); outlet_new(&x->x_obj, &s_signal);
return (void *)x; }
"640K ought to be enough for anybody." -- Bill Gates, 1981