DSP off message

babazaroni's icon

Hello,

I'm using the 'dsp' message to know when the audio has been turned on in dsp status.

Is there a way to know when the audio has been turned off?

Thanks

Emmanuel Jourdan's icon

Look at Christopher's repsonse:

The dev forum is for developing C externals.

babazaroni's icon

Sorry, I should have said I am writing an external.

I use the addmethod routine to cause me to be notified when the 'dsp' message is sent.

Is there another message, like 'dspoff' that I can use in exactly the same way?

Or is the only way to set up some kind of polling of the adstatus object?

Thanks again.

Luigi Castelli's icon

Hi there,

JKC wrote this a while ago, however I am not sure if it still applies with the new SDK.
You might want to try it anyway:

addmess((method)foo_dspstate, "dspstate", A_CANT, 0);

void foo_dspstate(t_foo *x, long n)
{
if (n) {
//dsp has been turned on
} else {
//dsp has been turned off
}
}

Hope this helps.

- Luigi

babazaroni's icon

Thanks,Luigi,

Worth a try, but did not work. I'm using 4.6 btw.

I'll have to use the [adstatus switch] external and prepend 'dspstate' to generate the msg to my external.

babazaroni's icon

Oops, 'dspstate' does work!

I changed the addmess call to:

    class_addmethod(c, (method) foo_dspstate, "dspstate", A_LONG, 0);

Very cool. Thanks.

Luigi Castelli's icon

Yes, of course.... my bad.
It should be declared as A_LONG type.

Well, if it still works then that's the way to do it...

Cheers.

- Luigi