[PD] variable signal outlets and inlets?

David Medine dmedine at ucsd.edu
Sun Aug 30 21:09:24 CEST 2015


Does any one know how to write a ~ object that has a variable number 
signal outlets and inlets? The only thing I've been able to come up with 
is to have a dsp routine that looks like:

switch(x->n_sigs){
     case 3:
       dsp_add(whatever_tilde_perform,
       5,
       x,
       sp[0]->s_vec,
       sp[1]->s_vec,
       sp[2]->s_vec,
       sp[0]->s_n);
       break;

     case 4:
       dsp_add(whatever_tilde_perform,
       6,
       x,
       sp[0]->s_vec,
       sp[1]->s_vec,
       sp[2]->s_vec,
sp[3]->s_vec,
       sp[0]->s_n);
       break;
// so on and so forth...

}

It feels like there should be a better way to do this.
Thanks,
David



More information about the Pd-list mailing list