Ejemplo n.º 1
0
 private void readMeasureHeaders(TGSong song, int count) throws IOException {
   TGTimeSignature timeSignature = new TGTimeSignature();
   for (int i = 0; i < count; i++) {
     if (i > 0) {
       skip(1);
     }
     song.addMeasureHeader(readMeasureHeader(i, timeSignature));
   }
 }
Ejemplo n.º 2
0
  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;
  }
Ejemplo n.º 3
0
  private TGSong read() {
    TGSong song = this.factory.newSong();

    // leo el nombre
    song.setName(readUnsignedByteString());

    // leo el artista
    song.setArtist(readUnsignedByteString());

    // leo el album
    song.setAlbum(readUnsignedByteString());

    // leo el autor
    song.setAuthor(readUnsignedByteString());

    // leo la cantidad de measure headers
    int headerCount = readShort();

    // leo las pistas
    TGMeasureHeader lastHeader = null;
    long headerStart = TGDuration.QUARTER_TIME;
    for (int i = 0; i < headerCount; i++) {
      TGMeasureHeader header = readMeasureHeader(i + 1, headerStart, lastHeader);
      song.addMeasureHeader(header);
      headerStart += header.getLength();
      lastHeader = header;
    }

    // leo la cantidad de pistas
    int trackCount = readByte();

    // leo las pistas
    for (int i = 0; i < trackCount; i++) {
      song.addTrack(readTrack(i + 1, song));
    }

    return song;
  }
Ejemplo n.º 4
0
 private void readMeasureHeaders(TGSong song, int count) throws IOException {
   TGTimeSignature timeSignature = getFactory().newTimeSignature();
   for (int i = 0; i < count; i++) {
     song.addMeasureHeader(readMeasureHeader((i + 1), song, timeSignature));
   }
 }