/* * Created on Jan 4, 2005 * */ package jmslexamples.simple; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JLabel; import com.softsynth.jmsl.JMSLRandom; import com.softsynth.jmsl.UniformRandomBehavior; /** * Same as JSynSong except the verse, chorus, and rest will come in an * unpredictable order * * @author Nick Didkovsky, nick@didkovsky.com * */ public class UnpredictableSong extends JSynSong { protected void buildSong() { super.buildSong(); mySong.setBehavior(new UniformRandomBehavior()); mySong.setRepeats(15); } public static void main(String[] args) { JMSLRandom.randomize(); UnpredictableSong demo = new UnpredictableSong(); demo.add(new JLabel("There is no GUI for this example", JLabel.CENTER)); demo.setSize(800, 200); demo.setVisible(true); demo.start(); demo.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { demo.stop(); System.exit(0); } }); } }