Holiday notice: Cycling '74 will be closed Monday, October 9th. Manual authorization, support cases, and manual order processing will be delayed.

Oct 27 2009 | 11:59 am

Hi all,

Just exploring the porting of a few SC UGens to Max/MSP this week. I've read the API help and hunted through this forum, but haven't found any discussion of the following. So I appeal for assistance...

I'm building an external which might end up with 11 inlets. I've reduced my problem to just the case of 1 in, 1 out, but I need to find a solution to this to get back to lots of inlets. I'm trying to avoid explicitly passing all the sp[i]->s_vec in the dsp function. hopefully code prototypes below make sense. I get a crash when I try to pass sp itself, but it's fine if I am explicit about them all. So my question is whether it is valid to go about things this way, whether I should switch to using dsp_addv or some other method...

best,
Nick

Code excerpts:
this crashes randomly, due to NULL pointer turning up:

void weakly_dsp(t_weakly *unit, t_signal **sp, short *count)
{

...

//can't guarantee sp will still be around? seems to end up as nil sometimes!

dsp_add(weakly_perform, 4, unit, sp, sp[0]->s_n, count);
}

t_int *weakly_perform(t_int *w)
{
t_weakly *unit = (t_weakly *)(w[1]);

//all ins then outs
if (unit->ob.z_disabled) // check for object being disabled
return w + 5;

int inNumSamples = (int)w[3];

//short * count= (short *)w[4];

t_signal ** sig= (t_signal**)w[2];

//get NULLs here occasionally!
if(!sig)
return w+5;

t_float *in = (t_float *)(sig[0]->s_vec);
t_float *out = (t_float *)(sig[1]->s_vec);

...

}

this is fine:

void weakly_dsp(t_weakly *unit, t_signal **sp, short *count)
{

...

//everything explicitly passed
dsp_add(weakly_perform, 4, unit, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}

t_int *weakly_perform(t_int *w)
{
t_weakly *unit = (t_weakly *)(w[1]);

//all ins then outs
if (unit->ob.z_disabled) // check for object being disabled
return w + 5;

int inNumSamples = (int)w[4];

//all works fine
t_float *in = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);

...

}