Problem with multiple MSP inlets/outlets in C API

bolau's icon

Hi folks,

I'm an MSP newbie and got stuck with a two-in two-out object. I've got weird interactions between the ins and outs. When printing out the pointer addresses of the ins and outs I saw they're the same?!

Here's an excerpt from my code (just looking at the 64bit part):
void *bl_slicer_new(t_symbol *s, long argc, t_atom *argv)
{
    t_bl_slicer *x = (t_bl_slicer *)object_alloc(bl_slicer_class);
    if (x) {
        dsp_setup((t_pxobject *)x, 2);
        outlet_new((t_object*)x, "signal");
        outlet_new((t_object*)x, "signal");
    }
    return (x);
}

void bl_slicer_dsp64(t_bl_slicer *x, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags)
{
    post("my sample rate is: %f, count: %d", samplerate, *count);
    object_method(dsp64, gensym("dsp_add64"), x, bl_slicer_perform64, 0, NULL);
}

void bl_slicer_perform64(t_bl_slicer *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam)
{
    t_double *inL = ins[0];
    t_double *inR = ins[1];
    t_double *outL = outs[0];
    t_double *outR = outs[1];
    post("ins: %d %d, outs: %d %d", ins[0], ins[1], outs[0], outs[1]);
}

Here's the print out:
ins: 315077024 315085280, outs: 315085280 315077024
You see that ins[0]==outs[1], and ins[1]==outs[0]. But why is this? I would assume the addresses to be different.

Thanks for any help...

Luigi Castelli's icon
bolau's icon

Hey Luigi, thank you very much! I didn't discover these threads when searching. Now it's all clear :)
Best, Boris