/* * Created on May 18, 2006 * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.didkovsky.portview.swing.ViewFactorySwing; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.score.*; public class MultiTrackExpressionMarks { public static void main(String[] args) { JMSL.setViewFactory(new ViewFactorySwing()); // one staff, 800x600 pixel canvas Score score = new Score(1, 1200, 600); // IMPORTANT!!! Call setNumTracksPerStaff() right after the constructor and before adding // measures. Else you will need to manage heterogenous numbers of tracks in the staves of // various measures yourself score.setNumTracksPerStaff(2); double zoom = 1.0; score.getScoreLayoutManager().setZoom(zoom); // score.getControlPanel().setZoom(zoom); score.addMeasure(4, 4); Score.setInstrumentNamesVisible(false); int[] marks = { Note.MARK_ACCENT, Note.MARK_ACCENT_STACCATO, Note.MARK_ACCENT_TENUTO, Note.MARK_FERMATA, Note.MARK_HARMONIC, Note.MARK_INVERTED_MORDANT, Note.MARK_MORDANT, Note.MARK_STACCATO, Note.MARK_TENUTO, Note.MARK_TRILL, Note.MARK_TRILL_FLAT, Note.MARK_TRILL_NATURAL, Note.MARK_TRILL_SHARP, Note.MARK_WEDGE, Note.MARK_WEDGE_STACCATO, Note.MARK_NONE }; double basePitch = 60; int numNotes = marks.length; for (int t = 0; t < score.getNumTracksPerStaff(); t++) { score.setCurrentTrackNumber(t); score.rewind(); double pitch = basePitch + t * 19; double duration = 1.0; Note note = null; for (int noteKounter = 0; noteKounter < numNotes; noteKounter++) { note = score.addNote(duration, pitch, 0.5, duration * 0.8); note.setMark(marks[noteKounter]); if (noteKounter % 4 < 3) { if (t == 0) note.setCrescOut(true); else note.setDecrescOut(true); } } note.setCrescOut(false); note.setDecrescOut(false); } final ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.setVisible(true); score.getControlPanel().setZoom(1); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { scoreFrame.quit(); } }); } }