MIDI-CTRL -> Developer Manual -> Library Reference -> GUI

GUI Tasks

Task Class Reference
Sourcecode: source:hardware/libraries/CommonTools/Task.hh

GUI tasks are used to run an object method at a regular interval. An example of a task is the MDTask or the MNMTask, which is used to poll the MachineDrum at regular intervals to spot kit, global or pattern changes. To create a Task, you need to subclass the Task class, and either subclass the run() method, or pass the Task a function to be called back on construction. The interval field sets how often the run() method is called in GUI ticks.

Once the task object has been created, it needs to be added to the GUI runloop to be called at regular intervals.

class MyTask : public Task { 
   MyTask() {
      interval = 100;
   }

   virtual void run() {
     doSomething();
   }
}

MyTask myTask;

void setup() {
   GUI.addTask(&myTask);
}

task-class.png (29.7 KB) Manuel Odendahl, 07/06/2010 11:14 pm

Also available in: HTML TXT