scheduler


The scheduler is a class which can be used to schedule tasks. (see task_data.) There is only one scheduler, it is created by Rogus, and it can be accessed through the global pointer schedp.

class scheduler {
public:
  scheduler();
  ~scheduler();
  void init( OMS_app * = NULL );
  err_ind play_note( const MIDI_msg& on, ScheduleTime dur );
  err_ind insert( const task_data& td );
  err_ind insert( const task_data& td, task** task_return );
  err_ind cancel(task* t);
  void processQueue();
};
scheduler()
Creates a scheduler. You should never do this, since Rogus creates a scheduler for you, and there should only be one scheduler.
~scheduler()
Destroys a scheduler. You should never do this either.
void init( OMS_app * = NULL )
This is a function used internally by Rogus. It really shouldn't be a public function, but I haven't gotten around to cleaning it up.
err_ind play_note( const MIDI_msg& on, ScheduleTime dur )
Yes! This is actually a function which you can call. play_note immediately sends out on which it assumes to be a note-on. The scheduler will send out the same message, with the velocity changed to zero, dur half-milliseconds later.
err_ind insert( const task_data& td )
This is used to schedule a task_data. If you schedule a task this way, there is no way to cancel it.
err_ind insert( const task_data& td, task** task_return )
This is as above, except that you should use this version of insert if you might want to cancel the task before it happens. You should provide the address of a task*, which the scheduler will then write the address of a task into. You can pass this pointer to cancel to cancel the task.
err_ind cancel(task* t)
Cancels the task t. Returns err if t is not a valid task or if it is a task which has already happened.
void processQueue()
This is another function which is used internally that you shouldn't call. See apology for init, above.

Modified 29 March 1996 pepellet@mit.edu