package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.score.*; /** * This simply uses addNote(dur) to add notes to a Score. Use this if you know * what the duration values of your events are. * * It is *not* a test of the more sophisticated transcriber * * @author Nick Didkovsky and Phil Burk, copyright 2000 Nick Didkovsky and Phil * Burk */ public class TestScoreMemoryLimits { public static void main(String args[]) { long millisBefore = System.currentTimeMillis(); int numNotes = 0; int numMeasures = 80000; int w = 1000; int h = 750; int numStaves = 1; Score score = new Score(numStaves, w, h, "Add " + numMeasures + " measures to a Score"); score.addMeasure(); double[] durations = { .75, .25, .875, .125, .75, .25, .875, .125 }; for (int m = 0; m < numMeasures; m++) { for (int i = 0; i < durations.length; i++) { score.addNote(durations[i], NoteFactory.MIDDLE_C + i, 0.5, durations[i] * 0.8); numNotes++; } } System.out.println(numNotes + " notes"); ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.setVisible(true); long millisAfter = System.currentTimeMillis(); System.out.println((millisAfter - millisBefore) / 1000.0 + " sec"); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { JMSL.closeMusicDevices(); System.exit(0); } }); } }