JMSL MusicJob Demo

MusicJob is the root executable class in JMSL. It does something repeatedly over time. It could send a MIDI event, for example, or parameters to a JSyn circuit, or do some drawing, or sample input data from a device, etc. This demo shows two MusicJobs which change colors on a schedule.

A MusicJob is scheduled as follows:
  1. [startDelay]
  2. start()
  3. optional
  4. [startPause]
  5. repeat()
  6. optional
  7. repeatPause (loop back to repeat() for getRepeats() times)
  8. [stopDelay]
  9. optional
  10. stop()

You can customize a MusicJob by either subclassing and overriding start(), repeat(), and stop() methods, or by plugging custom PlayListeners into a stock MusicJob's startPlayables, repeatPlayables, and stopPlayables. Or a combination of these techniques.

TextJob is a subclass of MusicJob which owns a DrawingCanvas and has a method for printing a custom message to this canvas. DrawingCanvas is simply a subclass of Canvas which has a printMsg(String s, Color color) method (which prints text in the canvas with the indicated color). FlasherFunction implements the Playable interface, which means it can be added to TextJob's repeatPlayables. FlasherFunction reverses the "color state" of the TextJob and tells it to prints itrs custom message. It does this every repeat.

You need a Java-enabled browser to view this applet.

JobDemo1 source (this applet)
TextJob source
FlasherFunction source
DrawingCanvas source

(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.
JMSL Examples