hello
i'm stuck.
say i create an arbitrary number of in/outlets with something like...
for (i = 0; i < arg; i++)
{
x->x_outlet[i] = outlet_new(&x->x_ob, &s_float);
if (i)
{
sprintf(tempStr, "ft%d", i);
inlet_new(&x->x_ob, &x->x_ob.ob_pd, &s_float, gensym(tempStr));
}
}
how can i avoid writing an unknown number of methods (i.e. one for each inlet) and instead having one function that handles all inlets with some kind of index attached to each message? what i'm looking for is something like proxy_new() in max, which i belive is lacking in pd - right?
#| Fredrik Olofsson http://olofsson.da.ru |#
hi fredrik !
unfortunately i do not know an easy way to solve your problem but since you are using only float-inlets (hope that i am right (?)) you still have a chance
create your inlets/outlets like
for (i=0;i<arg;i++) { x->x_outlet[i] = outlet_new(&x->x_ob, &s_float); floatinlet_new(&x->x_obj, &(x->x_f[i])); x->x_f[i]=0; }
when you send a float to one of your (right) inlets, its value will be written directly into memory (x->x_f[n]), to routine will be executed. getting something on the first inlet will start your procedure and you then can access all the floats that were set before. this will do most of the times.
for is something like proxy_new() in max, which i belive is lacking in pd - right?
being no max-user i never heard of this
mgf.fd.asdf IOhannes
ok. i actually wanted the inlets to understand both floats and 'bang' but i guess i'll settle with just floats. thanks Miller/IOhannes
Hi Fredrik,
Well, I've never written a "proxy" object, but I should someday... In the meantime, if all you want to do is to set a floating-point value you can use floatinlet_new (you can send each one a different pointer.) If you need to attach C code to it, well, you need the proxy object...
cheers Miller
hi fredrik !
unfortunately i do not know an easy way to solve your problem but since you are using only float-inlets (hope that i am right (?)) you still have a chance
create your inlets/outlets like
for (i=0;i<arg;i++) { x->x_outlet[i] = outlet_new(&x->x_ob, &s_float); floatinlet_new(&x->x_obj, &(x->x_f[i])); x->x_f[i]=0; }
when you send a float to one of your (right) inlets, its value will be written directly into memory (x->x_f[n]), to routine will be executed. getting something on the first inlet will start your procedure and you then can access all the floats that were set before. this will do most of the times.
for is something like proxy_new() in max, which i belive is lacking in pd - right?
being no max-user i never heard of this
mgf.fd.asdf IOhannes