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);
   }
 }
  /**
   * 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;
  }
示例#3
0
  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);
  }
示例#4
0
 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);
   }
 }