<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">hi dave!</div><div class="">check out the dsp_addv function, I think it’s meant for exactly this. I don’t have any code right in front of me… oh wait, I do …  I’m pretty sure this works:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">void grans_dsp(t_grans *x, t_signal **sp)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    int num = x->numinlets + x->numoutlets;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    t_int **w = x->w;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    w[0] = (t_int *)x;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    w[1] = (t_int *)sp[0]->s_n;</div><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class="">    <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    int i;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    for (i = 0; i < num; i++) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">        w[i+2] = (t_int *)sp[i]->s_vec;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    }</div><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class="">    <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    dsp_addv(grans_perform, num+2, (t_int *)w);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">hope that’s useful!</div><div class=""><br class=""></div><div class="">cheers,</div><div class="">rama</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 30, 2015, at 12:09 PM, David Medine <<a href="mailto:dmedine@ucsd.edu" class="">dmedine@ucsd.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">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:<br class=""><br class="">switch(x->n_sigs){<br class="">    case 3:<br class="">      dsp_add(whatever_tilde_perform,<br class="">      5,<br class="">      x,<br class="">      sp[0]->s_vec,<br class="">      sp[1]->s_vec,<br class="">      sp[2]->s_vec,<br class="">      sp[0]->s_n);<br class="">      break;<br class=""><br class="">    case 4:<br class="">      dsp_add(whatever_tilde_perform,<br class="">      6,<br class="">      x,<br class="">      sp[0]->s_vec,<br class="">      sp[1]->s_vec,<br class="">      sp[2]->s_vec,<br class="">sp[3]->s_vec,<br class="">      sp[0]->s_n);<br class="">      break;<br class="">// so on and so forth...<br class=""><br class="">}<br class=""><br class="">It feels like there should be a better way to do this.<br class="">Thanks,<br class="">David<br class=""><br class="">_______________________________________________<br class=""><a href="mailto:Pd-list@lists.iem.at" class="">Pd-list@lists.iem.at</a> mailing list<br class="">UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" class="">http://lists.puredata.info/listinfo/pd-list</a><br class=""></div></blockquote></div><br class=""></body></html>