How to send a bang to an outlet from DSP process routine (using C code))

Jan 8, 2008 at 3:35pm

How to send a bang to an outlet from DSP process routine (using C code))

Hi,

I am working on an object that processes some audio and based upon that processing, occasionally sends a bang to an outlet. I am trying to send out the bang but the DSP process routine does not recognise the struct object that contains the variable used in outletting a bang. So for the code below I get an error saying that ‘mo’ (my struct object variable) has not been declared in this scope:

t_int* Perform(t_int *parameters) {
long pcount = (long) (parameters[1]);
t_float *input = (t_float*)(parameters[2]);
t_float *output = (t_float*)(parameters[3]);
long count = (long) (parameters[4]);
long i;
float frame[count];

for (i=0; i
frame[i] = input[i];
}

///////////////////////////////////////////////
////////////// Some Processing ////////////////
///////////////////////////////////////////////

outlet_bang(mo->output); /* Problem line */

for (i=0; i
output[i] = frame[i];
}

return parameters+pcount+1;
}

I can create a normal function that will for example output a bang when a bang is received in an inlet. This works fine. It is only in the DSP processing routine that I have a problem.

I would be very appreciative of any help,

Thanks,

Adam

#35267
Jan 8, 2008 at 8:32pm

You need to make sure that your mo struct is passed as one of your
t_int * parameters into your Perform routine.

On Jan 8, 2008, at 7:35 AM, Adam Stark wrote:

>
> Hi,
>
> I am working on an object that processes some audio and based upon
> that processing, occasionally sends a bang to an outlet. I am
> trying to send out the bang but the DSP process routine does not
> recognise the struct object that contains the variable used in
> outletting a bang. So for the code below I get an error saying that
> ‘mo’ (my struct object variable) has not been declared in this scope:
>
> t_int* Perform(t_int *parameters) {
> long pcount = (long) (parameters[1]);
> t_float *input = (t_float*)(parameters[2]);
> t_float *output = (t_float*)(parameters[3]);
> long count = (long) (parameters[4]);
> long i;
> float frame[count];
>
> for (i=0; i
> frame[i] = input[i];
> }
>
> ///////////////////////////////////////////////
> ////////////// Some Processing ////////////////
> ///////////////////////////////////////////////
>
> outlet_bang(mo->output); /* Problem line */
>
>
> for (i=0; i
> output[i] = frame[i];
> }
>
> return parameters+pcount+1;
> }
>
> I can create a normal function that will for example output a bang
> when a bang is received in an inlet. This works fine. It is only in
> the DSP processing routine that I have a problem.
>
> I would be very appreciative of any help,
>
> Thanks,
>
> Adam

Be seeing you

grrr waaa
http://www.grahamwakefield.net

#120042
Jan 8, 2008 at 9:57pm

Quote: Adam wrote on Tue, 08 January 2008 08:35

> I am working on an object that processes some audio and based upon that processing, occasionally sends a bang to an outlet. I am trying to send out the bang but the DSP process routine does not recognise the struct object that contains the variable used in outletting a bang.

Actually this is not recommended by c74 at all (sending messages to outlets in the perform routine). I was sure this is mentioned in the writing externals pdf somewhere, but I can’t find it, so probably I remember it from the below thread. This instance relates to floats not bangs, but is otherwise the same principle:

http://www.cycling74.com/forums/index.php?t=msg&goto=103347&rid=0&srch=outlet+perform+routine#msg_103347

Regards,

Alex

#120043

You must be logged in to reply to this topic.