/* * Created on Dec 3, 2005 * */ package jmsltestsuite; import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.JMSLRandom; import com.softsynth.jmsl.score.*; /** * Put two tracks of music on one staff hihats with stems up. kick&snare pattern with stems down. * Also shows X noteheads * * @author Nick Didkovsky, nick@didkovsky.com * */ public class TwoTracksPerStaff { public static void main(String[] args) { Score score = new Score(1, 800, 600); score.addMeasure(4, 4); score.addMeasure(4, 4); // add qtr notes to default track 0 for (int i = 0; i < 4; i++) { Note n = score.addNote(1.0, 62 + (i % 2) * 10, 0.5, 0.8); Note n2 = n.addInterval(75); n.setNoteheadColor(Color.ORANGE); n2.setNoteheadColor(Color.CYAN); } // add some 8th notes to track 1 score.setCurrentTrackNumber(1); for (int i = 0; i < 8; i++) { Note n = score.addNote(0.5, 79, 0.5, 0.4); n.setBeamedOut(i % 2 == 0); n.setNoteHeadType(Note.NOTEHEAD_X); } for (int i = 0; i < 8; i++) { Note n = score.addNote(0.5, 79, 0.5, 0.4); n.setBeamedOut(i % 2 == 0); n.setNoteheadColor(new Color(JMSLRandom.choose(256), JMSLRandom.choose(256), JMSLRandom.choose(256))); } final ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { scoreFrame.quit(); } }); } }