private void writeBendEffect(TGEffectBend effect) {
    // escribo la cantidad de puntos
    writeByte(effect.getPoints().size());

    for (TGEffectBend.BendPoint point : effect.getPoints()) {
      // escribo la posicion
      writeByte(point.getPosition());

      // escribo el valor
      writeByte(point.getValue());
    }
  }
  private void readBend(TGNoteEffect effect) throws IOException {
    TGEffectBend bend = getFactory().newEffectBend();
    skip(5);
    int points = readInt();
    for (int i = 0; i < points; i++) {
      int position = readInt();
      int value = readInt();
      readByte();

      int pointPosition =
          Math.round(position * TGEffectBend.MAX_POSITION_LENGTH / GP_BEND_POSITION);
      int pointValue = Math.round(value * TGEffectBend.SEMITONE_LENGTH / GP_BEND_SEMITONE);
      bend.addPoint(pointPosition, pointValue);
    }
    if (!bend.getPoints().isEmpty()) {
      effect.setBend(bend);
    }
  }
Beispiel #3
0
  private TGEffectBend readBendEffect() {
    TGEffectBend bend = this.factory.newEffectBend();

    // leo la cantidad de puntos
    int count = readByte();

    for (int i = 0; i < count; i++) {
      // leo la posicion
      int position = readByte();

      // leo el valor
      int value = readByte();

      // agrego el punto
      bend.addPoint(position, value);
    }
    return bend;
  }