JMSL MusicJob: a root Composable Class
You have seen MusicShapes and Collections at work.
A MusicJob does something repeatedly over time. What does it do? Anything you can write in Java!
MusicJob can send a Midi note, print a message, do some drawing, set SynthPorts on a JSyn SynthCircuit, etc.
In fact, MusicJob does more than one thing. It has actions scheduled for when it starts, others for when
it repeats, and others when it stops. It puts delays before some of these actions, and pauses after others. You have control over these durations, and of course you have
control over the actions themselves.
A MusicJob schedules itself as follows:
- startDelay
- start()
- startPlayables.play() optional
- startPause
- repeat()
- repeatPlayables.play() optional
- repeatPause (loop back to repeat() for getRepeats() times)
- stopDelay
- stopPlayables.play() optional
- stop()
You can override start(), repeat(), and stop() to do whatever you like.
In the next example, repeat() will generate data on the fly and perform
a JSyn SynthCircuit. But first we will look at some helpful tools for generating data.