Is it possible to cancel a host.scheduleTask once it's been scheduled?

Post Reply New Topic
RELATED
PRODUCTS

Post

I'd like to be able to optimize how often certain functions can get called by cancelling the scheduled task if the same function gets called again before the scheduled task is performed.

This functionality in the browser would usually be achieved using setTimout() and clearTimeout().

Is this possible with the api?

And FYI, I'm in the process of building a controller script for Maschine MK2 with the goal of making it feel as much like the Maschine work flow as possible, shying away from the more Ableton type used by Maschine4Bitwig (which is great). It's not ready for prime time, but you can follow the development here:

https://github.com/joelarson/maschine-mk2-bitwig

Post

Can you explain why M4B is an Ableton implementation?

I ported a lot of code from Push but it doesn't mean there can't be multiple implementations.

As far as not feature complete, I was waiting for Bitwig's full implementation of the drum bank and sub device layer navigation to finish the code. Which is in 1.2.

As far as your question, you need to actually set an interval for your "frame rate" and then call another setInterval(). there is no way to cancel a setInterval() call.

Mike
Michael Schmalle
http://www.teotigraphix.com
Surfing on sine waves

Maschine4Bitwig - Studio, MK2, MikroMK2, MK1
http://www.teotigraphix.com/bitwig/maschine

Post

Interesting, thanks for the reply. Sorry for the confusion, I meant that my script isn't ready for prime time. Maschine4Bitwig absolutely is, and it's great. And when I said it was like Ableton I was just talking about how it has a clip trigger grid that is track clips on one axis and scene clips on the other, something originally common of Ableton controllers (but of course also in Bitwig controllers too). I instead have implemented it like Maschine's workflow, where Pattern Mode just gives you clips 1-16 of the selected track.

Post

After I posted I figured you were talking about your script when I checked out your repo.

I can easily add that as a function if you would like?

Mike
Michael Schmalle
http://www.teotigraphix.com
Surfing on sine waves

Maschine4Bitwig - Studio, MK2, MikroMK2, MK1
http://www.teotigraphix.com/bitwig/maschine

Post

larson.joseph wrote:I'd like to be able to optimize how often certain functions can get called by cancelling the scheduled task if the same function gets called again before the scheduled task is performed.

This functionality in the browser would usually be achieved using setTimout() and clearTimeout().

Is this possible with the api?
You can work around this by wrapping your callback function into another one which checks a cancellation-status-variable. Just some quick & dirty example (should be put into a class):

var hasBeenCancelled = false;

function cancelDaStuff ()
{
hasBeenCancelled = true;
}

function myCallbackWrapper ()
{
if (hasBeenCancelled)
hasBeenCancelled = false;
else
callTheRealCallback();
}

Post

Nice approach, thanks.

Post Reply

Return to “Controller Scripting”