コード例 #1
0
  private void addBeat(int key, TGBeat beat) {
    if (beat.isRestBeat()) {
      this.writer.print("r");
      this.addDuration(beat.getDuration());
    } else {
      int size = beat.countNotes();
      if (size > 1) {
        this.writer.print("<");
      }
      for (int i = 0; i < size; i++) {
        TGNote note = beat.getNote(i);

        int note_value =
            (note.getBeat().getMeasure().getTrack().getString(note.getString()).getValue()
                + note.getValue());
        this.addKey(key, note_value);
        if (!(size > 1)) {
          this.addDuration(beat.getDuration());
        }
        this.addString(note.getString());
        if (this.isAnyTiedTo(note)) {
          this.writer.print("~");
        }

        if (size > 1) {
          this.writer.print(" ");
        }
      }
      if (size > 1) {
        this.writer.print(">");
        this.addDuration(beat.getDuration());
      }

      if (beat.isChordBeat()) {
        this.writer.print("-\\tag #'chords ^\\markup \\fret-diagram #\"");
        TGChord chord = beat.getChord();
        for (int i = 0; i < chord.countStrings(); i++) {
          this.writer.print((i + 1) + "-" + getLilypondChordFret(chord.getFretValue(i)) + ";");
        }
        this.writer.print("\"");
      }

      if (beat.isTextBeat()) {
        this.writer.print("-\\tag #'texts ^\\markup {" + beat.getText().getValue() + "}");
      }

      if (beat.getMeasure().getTrack().getLyrics().getFrom() > beat.getMeasure().getNumber()) {
        this.temp.addSkippedLyricBeat(getLilypondDuration(beat.getDuration()));
      }

      this.writer.print(" ");
    }
  }
コード例 #2
0
  private void writeChord(TGChord chord) {
    // escribo la cantidad de cuerdas
    writeByte(chord.countStrings());

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

    // escribo el primer fret
    writeByte(chord.getFirstFret());

    // escribo el valor de cada cuerda
    for (int string = 0; string < chord.countStrings(); string++) {
      writeByte(chord.getFretValue(string));
    }
  }