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:
- startPlayables.play() optional
- repeatPlayables.play() optional
- repeatPause (loop back to repeat() for getRepeats() times)
- stopPlayables.play() optional
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
HOW IT WORKS:
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.
JobDemo1 source (this applet)
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.