/* * Created on Jun 28, 2009 by Nick * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Enumeration; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.score.*; import com.softsynth.jmsl.score.util.GraceNoteMaxRollbackCalculator; public class GraceNoteTest3 { public static void main(String[] args) { System.out.println("JMSL version=" + JMSL.JMSL_VERSION); int w = 800; int h = 350; int numStaves = 1; Score score = new Score(numStaves, w, h); score.addMeasure(); score.setInstrumentNamesVisible(false); Note note0 = score.addNote(1, 74, 0.5, 0.8); Note graceNote = note0.addGraceNote(0.5, 69, 0.5, 0.4, true, false, false, false, false, Note.MARK_NONE); note0.addInterval(37); Note.resortChord(note0); note0 = score.addNote(1, 74, 0.5, 0.8); note0.addInterval(55); // Note.resortChord(note0); note0.addInterval(44); Note.resortChord(note0); ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); scoreFrame.setVisible(true); GraceNoteMaxRollbackCalculator graceNoteMaxRollbackCalculator = new GraceNoteMaxRollbackCalculator(); graceNoteMaxRollbackCalculator.calcMaxGraceNoteRollback(score); double maxRollback = graceNoteMaxRollbackCalculator.getMaxRollback(); System.out.println("max grace note rollback for this score=" + maxRollback); } }