/** JMSL MusicJob Tutorial Override repeat() of MusicJob to add your own functionality. This class prints a message on a repeating schedule.
@author Nick Didkovsky */ package jmsltutorial; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.MusicJob; public class PrintingJob extends MusicJob { private String msg = "uninitialized"; /* Constructor that initializes the message */ PrintingJob(String s) { super(); msg = s; } /** Override MusicJob's repeat() to do what you want */ public double repeat(double playTime) { JMSL.out.println(msg); return playTime; // always return the same or an updated completion time } /** Testing method when run as a stand-alone application */ public static void main(String args[]) { PrintingJob spot = new PrintingJob("Bow-wow"); PrintingJob puff = new PrintingJob("Meow"); spot.setRepeatPause(2.0); puff.setRepeatPause(1.0); spot.setRepeats(5); puff.setRepeats(10); spot.launch(JMSL.now()); puff.launch(JMSL.now()); } }