private void addSong(TGSong song) {
    int trackCount = song.countTracks();
    if (this.settings.isTrackGroupEnabled() && trackCount > 1) {
      this.writer.println("\\score {");
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS) {
        this.writer.println(indent(1) + "<<");
      }
    }

    for (int i = 0; i < trackCount; i++) {
      TGTrack track = song.getTrack(i);
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS
          || this.settings.getTrack() == track.getNumber()) {
        if (!this.settings.isTrackGroupEnabled() || trackCount == 1) {
          this.writer.println("\\score {");
        }
        this.writer.println(indent(1) + "\\" + this.trackID(i, "StaffGroup"));
        if (!this.settings.isTrackGroupEnabled() || trackCount == 1) {
          this.addHeader(song, track.getName(), 1);
          this.writer.println("}");
        }
      }
    }

    if (this.settings.isTrackGroupEnabled() && trackCount > 1) {
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS) {
        this.writer.println(indent(1) + ">>");
      }
      this.addHeader(song, null, 1);
      this.writer.println("}");
    }
  }
Example #2
0
  private void write(TGSong song) {
    // escribo el nombre
    writeUnsignedByteString(song.getName());

    // escribo el artista
    writeUnsignedByteString(song.getArtist());

    // escribo el album
    writeUnsignedByteString(song.getAlbum());

    // escribo el autor
    writeUnsignedByteString(song.getAuthor());

    // escribo la cantidad de measure headers
    writeShort((short) song.countMeasureHeaders());

    // escribo las pistas
    TGMeasureHeader lastHeader = null;
    for (TGMeasureHeader header : song.getMeasureHeaders()) {
      writeMeasureHeader(header, lastHeader);
      lastHeader = header;
    }

    // escribo la cantidad de pistas
    writeByte(song.countTracks());

    // escribo las pistas
    for (int i = 0; i < song.countTracks(); i++) {
      TGTrack track = song.getTrack(i);
      writeTrack(track);
    }
  }
 private void addSongDefinitions(TGSong song) {
   for (int i = 0; i < song.countTracks(); i++) {
     TGTrack track = song.getTrack(i);
     String id = this.trackID(i, "");
     this.temp.reset();
     this.addMusic(track, id);
     this.addLyrics(track, id);
     this.addScoreStaff(track, id);
     this.addTabStaff(track, id);
     this.addStaffGroup(track, id);
   }
 }
 private void readMeasures(TGSong song, int measures, int tracks, int tempoValue)
     throws IOException {
   TGTempo tempo = getFactory().newTempo();
   tempo.setValue(tempoValue);
   long start = TGDuration.QUARTER_TIME;
   for (int i = 0; i < measures; i++) {
     TGMeasureHeader header = song.getMeasureHeader(i);
     header.setStart(start);
     for (int j = 0; j < tracks; j++) {
       TGTrack track = song.getTrack(j);
       TGMeasure measure = getFactory().newMeasure(header);
       track.addMeasure(measure);
       readMeasure(measure, track, tempo);
     }
     tempo.copy(header.getTempo());
     start += header.getLength();
   }
 }