private void addTabStaff(TGTrack track, String id) {
    boolean addLyrics = (this.settings.isLyricsEnabled() && !track.getLyrics().isEmpty());
    boolean addChordDiagrams =
        (this.settings.isChordDiagramEnabled() && !this.settings.isScoreEnabled());
    boolean addTexts = (this.settings.isTextEnabled() && !this.settings.isScoreEnabled());

    this.writer.println(
        id
            + "TabStaff = \\new "
            + (addLyrics ? "TabVoice = \"" + id + "TabStaff\" <<" : "TabStaff {"));

    this.addTuning(track, 1);

    if (!addChordDiagrams) {
      this.writer.println(indent(1) + "\\removeWithTag #'chords");
    }
    if (!addTexts) {
      this.writer.println(indent(1) + "\\removeWithTag #'texts");
    }
    this.writer.println(indent(1) + "\\" + id + "Music #" + getLilypondBoolean(true));
    if (addLyrics) {
      this.writer.println(
          indent(1) + "\\new Lyrics \\lyricsto \"" + id + "TabStaff\" \\" + id + "Lyrics");
    }
    this.writer.println((addLyrics ? ">>" : "}"));
  }
  private void writeTrack(TGTrack track) {
    // header
    int header = 0;
    if (!track.getLyrics().isEmpty()) {
      header |= TRACK_LYRICS;
    }
    writeHeader(header);

    // escribo el nombre
    writeUnsignedByteString(track.getName());

    // escribo el canal
    writeChannel(track);

    // escribo los compases
    TGMeasure lastMeasure = null;
    for (TGMeasure measure : track.getMeasures()) {
      writeMeasure(measure, lastMeasure);
      lastMeasure = measure;
    }

    // escribo la cantidad de cuerdas
    writeByte(track.getStrings().size());

    // escribo las cuerdas
    for (TGString string : track.getStrings()) {
      writeInstrumentString(string);
    }

    // escribo el offset
    writeByte(track.getOffset() - TGTrack.MIN_OFFSET);

    // escribo el color
    writeRGBColor(track.getColor());

    // escribo el lyrics
    if (((header & TRACK_LYRICS) != 0)) {
      writeLyrics(track.getLyrics());
    }
  }
Exemple #3
0
  private TGTrack readTrack(int number, TGSong song) {
    // header
    int header = readHeader();

    TGTrack track = this.factory.newTrack();

    track.setNumber(number);

    // leo el nombre
    track.setName(readUnsignedByteString());

    // leo el solo
    track.setSolo((header & TRACK_SOLO) != 0);

    // leo el mute
    track.setMute((header & TRACK_MUTE) != 0);

    // leo el canal
    readChannel(song, track);

    // leo la cantidad de compases
    int measureCount = song.countMeasureHeaders();

    // leo los compases
    TGMeasure lastMeasure = null;
    for (int i = 0; i < measureCount; i++) {
      TGMeasure measure = readMeasure(song.getMeasureHeader(i), lastMeasure);
      track.addMeasure(measure);
      lastMeasure = measure;
    }

    // leo la cantidad de cuerdas
    int stringCount = readByte();

    // leo las cuerdas
    for (int i = 0; i < stringCount; i++) {
      track.getStrings().add(readInstrumentString(i + 1));
    }

    // leo el offset
    track.setOffset(TGTrack.MIN_OFFSET + readByte());

    // leo el color
    readRGBColor(track.getColor());

    // leo el lyrics
    if (((header & TRACK_LYRICS) != 0)) {
      readLyrics(track.getLyrics());
    }

    return track;
  }
 private void addLyrics(TGTrack track, String id) {
   this.writer.println(id + "Lyrics = \\lyricmode {");
   this.writer.println(indent(1) + "\\set ignoreMelismata = #" + getLilypondBoolean(true));
   int skippedCount = this.temp.getSkippedLyricBeats().size();
   if (skippedCount > 0) {
     this.writer.print(indent(1));
     for (int i = 0; i < skippedCount; i++) {
       this.writer.print("\\skip " + ((String) this.temp.getSkippedLyricBeats().get(i)) + " ");
     }
     this.writer.println();
   }
   this.writer.println(indent(1) + track.getLyrics().getLyrics());
   this.writer.println(indent(1) + "\\unset ignoreMelismata");
   this.writer.println("}");
 }