/* * Created on Aug 27, 2017 by Nick * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.score.*; public class PlayheadPositionTest { Score score; ScoreFrame scoreFrame; void biold() { score = new Score(1, 400, 200); score.addMeasure(); for (int i = 0; i < 32; i++) { score.addNote(1, 60 + i, 0.5, 0.8); } scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); scoreFrame.pack(); scoreFrame.setVisible(true); } public static void main(String[] args) { PlayheadPositionTest test = new PlayheadPositionTest(); test.biold(); PlayheadDispatcher.addPlayheadListener(new PlayheadListener() { public void notifyPlayhead(Score score, Note note, double zoom) { System.out.println("PLAYHEAD POSITION, pitch=" + note.getPitchData() + " x=" + note.getDrawingAnchor().getX() + ", y=" + note.getDrawingAnchor().getY()); } }); } }