Example #1
0
 private TGTrack readTrack(int number, List<TGChannel> channels, TGLyric lyrics)
     throws IOException {
   readUnsignedByte();
   if (number == 1 || getVersionIndex() == 0) {
     skip(1);
   }
   TGTrack track = new TGTrackImpl();
   track.setNumber(number);
   track.setLyrics(lyrics);
   track.setName(readStringByte(40));
   int stringCount = readInt();
   for (int i = 0; i < 7; i++) {
     int tuning = readInt();
     if (stringCount > i) {
       track.getStrings().add(new TGString(i + 1, tuning));
     }
   }
   readInt();
   final TGChannel newChannel = this.readChannel(channels);
   if (newChannel != null) {
     track.setChannel(newChannel);
   }
   // readChannel(track.getChannel(), channels);
   readInt();
   track.setOffset(readInt());
   track.setColor(readColor());
   skip((getVersionIndex() > 0) ? 49 : 44);
   if (getVersionIndex() > 0) {
     readStringByteSizeOfInteger();
     readStringByteSizeOfInteger();
   }
   return track;
 }
Example #2
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 TGTrack readTrack(TGSong song) {
    TGTrack track = this.factory.newTrack();

    // leo el numero
    track.setNumber((int) readLong());

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

    // leo el canal
    readChannel(track);

    // leo la cantidad de compases
    int measureCount = readInt();

    if (song.countMeasureHeaders() == 0) {
      for (int i = 0; i < measureCount; i++) {
        TGMeasureHeader header = this.factory.newHeader();
        song.addMeasureHeader(header);
      }
    }

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

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

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

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

    return track;
  }
 private TGTrack readTrack(TGSong song, int number, List channels, TGLyric lyrics)
     throws IOException {
   TGTrack track = getFactory().newTrack();
   track.setNumber(number);
   track.setLyrics(lyrics);
   readUnsignedByte();
   track.setName(readStringByte(40));
   int stringCount = readInt();
   for (int i = 0; i < 7; i++) {
     int tuning = readInt();
     if (stringCount > i) {
       TGString string = getFactory().newString();
       string.setNumber(i + 1);
       string.setValue(tuning);
       track.getStrings().add(string);
     }
   }
   readInt();
   readChannel(song, track, channels);
   readInt();
   track.setOffset(readInt());
   readColor(track.getColor());
   return track;
 }