API for finding out if overdrive is on?

AlexHarker's icon

Hi,

I'm coding an external that moves any message it receives into the high priority thread (if it exists) - everything is working but at the moment I am suffering unnecessary message delay when overdrive is off.

Here's what I'm doing:

If message is in the high priority thread output now (pass through) - if not schedule with a delay of zero.

That's fine, but when overdrive is off, all messages are in the low priority thread. The object is designed to serialise messages into one thread, so it's preferable not to use a delay when only one thread exists.

In order to determine this I just need to know whether or not overdrive is on - but I can't find anything in the API about this.

FWIW here's the main function:

void schedulemessage_anything (t_schedulemessage *x, t_symbol *msg, short argc, t_atom *argv)
{
    if (!isr())
        schedule_delay(x, (method) schedulemessage_output, 0, msg, argc, argv);
    else
        schedulemessage_output(x, msg, argc, argv);
}

Also in case anyone knows - should I be worried about the performance of calls to isr() at all, or can I assume this is trivial?

Thanks

Alex

Timothy Place's icon

You could send the 'checkpreempt' message to Max. As documented in Max's reference, it takes a symbol argument that defines a receive object's name to get the value. However, you could pass any symbol, whose s_thing member is an object with an int method (e.g. your object).

Hope this helps