Perform method - inlet connection state

    Nov 23 2013 | 2:34 pm
    Hello folks,
    I know I should be ashamed for such a question, however I am no longer sure if I can do something like this:
    void mydspobject_dsp64(t_mydspobject *x, t_object *dsp64, short *count, double samplerate, long vectorsize, long flags) {     dsp_add64(dsp64, (t_object *)x, (t_perfroutine64)mydspobject_perform64, 0, (void *)count); }
    void mydspobject_perform64(t_mydspobject *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam) {     short *count = (short *)userparam;     long i;     for (i = 0; i < numins; i++) {         if (count[i]) { // only process audio vector if there is a connection             // DSP processing…         }     } }
    Is the pointer to the ‘count’ array guaranteed to keep pointing to valid memory across subsequent calls to the perform method?
    This is an attempt to pass the state of inlet connections to the perform routine in order to optimize the DSP processing. I am trying to reduce the size of my object struct and the above code would save me the allocation of an array of shorts.
    - Luigi

    • Jan 16 2014 | 5:15 pm
      Yes -- you can use the 'count' array. Your configuration will not change between calls to your perform method without your dsp method being called first.
    • Jan 16 2014 | 9:41 pm
      Good to know... Thanks Tim.
      - Luigi