Пример #1
0
  public static Score createScore() {
    final Score score = new Score();
    final Part part = new Part();
    // part.add(new Note(60, 32));
    // part.add(new Note(70, 32));
    /*for(int i=0; i<1000; i++) {
       part.add(new Note(60, Note.WHOLE_LENGTH/8));
    }*/
    score.add(part);
    // score.add(new Part());
    score.setLogging(true);

    // [ debug
    //      score.addScoreChangeListener(new ScoreChangeListener() {
    //         public void scoreChanged(ScoreChangeEvent e) {
    //            System.out.println(e.getScore());
    //         }
    //      });
    // part.add(new Note(60, 32));
    // score.undo();
    // part.add(new Note(90, 32));

    // System.err.println(score.get(0).notes);
    return score;
  }
Пример #2
0
  public void importMidi() {
    final JFileChooser jfc = new JFileChooser(Util.curDir);
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    jfc.setFileFilter(new FileNameExtensionFilter("midi files", "mid"));

    final int ret = jfc.showOpenDialog(this);

    if (ret == JFileChooser.APPROVE_OPTION) {
      this.addScore(Score.fromFile(jfc.getSelectedFile()));
    }
  }
Пример #3
0
 public void importMidiFromFile(File file) {
   this.addScore(Score.fromFile(file));
 }