JMSL Tutorial: MusicJob

We now have a Playable that prints a message in its play() method. We add unique messages to two stock MusicJobs' start, repeat, and stop playables. Essential code except is below.
   // initialize a couple of stock MusicJobs
      spot = new MusicJob();
      puff = new MusicJob();

      // set their durations
      spot.setRepeatPause(2.0);
      puff.setRepeatPause(1.0);

      // set their repeat counts
      spot.setRepeats(5);
      puff.setRepeats(10);

      // Now build some custom Playables and plug them in!
      puff.addStartPlayable(new MessagePrintingPlayable("Puff Starting"));
      puff.addRepeatPlayable(new MessagePrintingPlayable("Puff Repeating (meow)"));
      puff.addStopPlayable(new MessagePrintingPlayable("Puff Stopped"));

      spot.addStartPlayable(new MessagePrintingPlayable("Spot Starting"));
      spot.addRepeatPlayable(new MessagePrintingPlayable("Spot Repeating (bow-wow)"));
      spot.addStopPlayable(new MessagePrintingPlayable("Spot Stopped"));
  
      spot.launch(JMSL.now());
      puff.launch(JMSL.now());

   

Here's the complete source
Here's this example in action:


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