/** * Creates the TGChord ArrayList out of StringValue's ArrayLists * * @param Highest rated StringValues * @return TGChord collection */ private ArrayList createChords(ArrayList top) { if (!isValidProcess()) { return null; } ArrayList chords = new ArrayList(top.size()); Iterator it = top.iterator(); while (it.hasNext()) { TGChord chord = TuxGuitar.instance().getSongManager().getFactory().newChord(this.tuning.length); Iterator it2 = ((ArrayList) it.next()).iterator(); while (it2.hasNext()) { StringValue stringValue = (StringValue) it2.next(); int string = ((chord.getStrings().length - 1) - (stringValue.getString())); int fret = stringValue.getFret(); chord.addFretValue(string, fret); chord.setName(this.chordName); } chords.add(chord); } return chords; }
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(" "); } }
public void addItems() { this.disposeItems(); this.subMenuItems = new MenuItem[TuxGuitar.instance().getCustomChordManager().countChords()]; for (int i = 0; i < this.subMenuItems.length; i++) { TGChord chord = TuxGuitar.instance().getCustomChordManager().getChord(i); Map actionData = new HashMap(); actionData.put(InsertChordAction.PROPERTY_CHORD, chord); this.subMenuItems[i] = new MenuItem(this.menu, SWT.PUSH); this.subMenuItems[i].setData(actionData); this.subMenuItems[i].setText(chord.getName()); this.subMenuItems[i].addSelectionListener(new TGActionProcessor(InsertChordAction.NAME)); } }
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 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); } }
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); } }