private void readChord(int strings, TGBeat beat) throws IOException { TGChord chord = getFactory().newChord(strings); if ((readUnsignedByte() & 0x01) == 0) { chord.setName(readStringByteSizeOfInteger()); chord.setFirstFret(readInt()); if (chord.getFirstFret() != 0) { for (int i = 0; i < 6; i++) { int fret = readInt(); if (i < chord.countStrings()) { chord.addFretValue(i, fret); } } } } else { skip(16); chord.setName(readStringByte(21)); skip(4); chord.setFirstFret(readInt()); for (int i = 0; i < 7; i++) { int fret = readInt(); if (i < chord.countStrings()) { chord.addFretValue(i, fret); } } skip(32); } if (chord.countNotes() > 0) { beat.setChord(chord); } }
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)); } }
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(" "); } }
private void readChord(TGBeat beat) { TGChord chord = this.factory.newChord(readByte()); // leo el nombre chord.setName(readUnsignedByteString()); // leo el primer fret chord.setFirstFret(readByte()); // leo las cuerdas for (int string = 0; string < chord.countStrings(); string++) { chord.addFretValue(string, readByte()); } beat.setChord(chord); }
private void readChord(int strings, TGBeat beat) throws IOException { TGChord chord = new TGChordImpl(strings); this.skip(17); chord.setName(readStringByte(21)); this.skip(4); chord.setFirstFret(readInt()); for (int i = 0; i < 7; i++) { int fret = readInt(); if (i < chord.countStrings()) { chord.addFretValue(i, fret); } } this.skip(32); if (chord.countNotes() > 0) { beat.setChord(chord); } }