Schedule [js] Task in absolute ticks?

    Apr 10 2013 | 5:57 am
    I see that JS Tasks can be scheduled in millisecond delays, but can they be scheduled to fire when the transport reaches an absolute time in ticks?
    Flipping through the SDK, I figure I can probably mash up the delay2 and simplejs examples to do something like what I'd like—although I'm not completely certain how to call a JS callback from C.
    This is for a Max For Live project. If there's any other way to have a JS callback fire when the Live transport reaches a specific time, that would work, too.

    • Apr 10 2013 | 6:31 am
      Quick follow-up question: If there's a way to schedule events to fire at an absolute tick value in Java with [mxj], that would also be of interest to me.
      For what it's worth, I already have a system for this purpose working using [timepoint], but I'd love to push this scheduling functionality into procedural code—either Java or JavaScript—if possible.
    • Apr 10 2013 | 8:19 am
      You'll be lucky to get millisecond timing accuracy in Javascript because it only runs in the UI thread; Java is a better bet.
    • Apr 15 2013 | 11:49 pm
      Thanks, Nick. I'm actually getting really good results from [js] right now—turnaround times in microseconds. Will persist and post here if I see any major performance problems.
      FWIW, I also tried making a system to schedule arbitrary messages at specific times in the future with patcher scripting, by creating instances of a patcher that used [timepoint] and [pv], then removed itself with [thispatcher]. This system is way too slow for my purposes, though—several milliseconds in either [js] or [mxj jruby], mainly caused by presence of [thispatcher]. I'll revert to my original system, which involves a single event loop feeding upcoming events through a single [timepoint] + [pv] combo.