function called when dsp is turned off

charly's icon

Hi,

is their any message that is sent from max to the externals when the dsp is turned off? In other words I am looking for the equivalent of addmess(myexternal_dsp,"dsp", A_CANT, 0); to call a function when the user turn the dsp off.
Does it exist?

Cheers,

Charly

Shakeeb Alireza's icon

I have the same question for Max 8. Is there a method that get's called when DSP is off so that I can hook some cleanup functions to it?

I know there's the dsp_state~ object, but is there anything at the Max c-api level that does the same?

volker böhm's icon

In your main function add a 'dspstate' method, then add a function that handles the call and does whatever you want to happen.
hth

class_addmethod(c, (method)myObj_dspstate, "dspstate", A_CANT, 0);
...

void myObj_dspstate(t_myObj *x, long n) 
{
    if(n) ...
    else ...
}