Example #1
0
  private TGEffectTrill readTrillEffect() {
    TGEffectTrill effect = this.factory.newEffectTrill();

    // leo el fret
    effect.setFret(readByte());

    // leo la duracion
    effect.getDuration().setValue(readByte());

    return effect;
  }
Example #2
0
 private void readTrill(TGNoteEffect effect) throws IOException {
   byte fret = readByte();
   byte period = readByte();
   TGEffectTrill trill = new TGEffectTrill();
   trill.setFret(fret);
   if (period == 1) {
     trill.getDuration().setValue(TGDuration.SIXTEENTH);
     effect.setTrill(trill);
   } else if (period == 2) {
     trill.getDuration().setValue(TGDuration.THIRTY_SECOND);
     effect.setTrill(trill);
   } else if (period == 3) {
     trill.getDuration().setValue(TGDuration.SIXTY_FOURTH);
     effect.setTrill(trill);
   }
 }
 private void readNoteEffects(TGNoteEffect noteEffect) throws IOException {
   int flags1 = readUnsignedByte();
   int flags2 = readUnsignedByte();
   noteEffect.setHammer(((flags1 & 0x02) != 0));
   noteEffect.setLetRing(((flags1 & 0x08) != 0));
   noteEffect.setVibrato(((flags2 & 0x40) != 0) || noteEffect.isVibrato());
   noteEffect.setPalmMute(((flags2 & 0x02) != 0));
   noteEffect.setStaccato(((flags2 & 0x01) != 0));
   if ((flags1 & 0x01) != 0) {
     readBend(noteEffect);
   }
   if ((flags1 & 0x10) != 0) {
     readGrace(noteEffect);
   }
   if ((flags2 & 0x04) != 0) {
     readTremoloPicking(noteEffect);
   }
   if ((flags2 & 0x08) != 0) {
     noteEffect.setSlide(true);
     readByte();
   }
   if ((flags2 & 0x10) != 0) {
     TGEffectHarmonic harmonic = getFactory().newEffectHarmonic();
     int type = readByte();
     if (type == 1) {
       harmonic.setType(TGEffectHarmonic.TYPE_NATURAL);
     } else if (type == 3) {
       harmonic.setType(TGEffectHarmonic.TYPE_TAPPED);
     } else if (type == 4) {
       harmonic.setType(TGEffectHarmonic.TYPE_PINCH);
     } else if (type == 5) {
       harmonic.setType(TGEffectHarmonic.TYPE_SEMI);
     } else if (type == 15) {
       harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL);
       harmonic.setData(2);
     } else if (type == 17) {
       harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL);
       harmonic.setData(3);
     } else if (type == 22) {
       harmonic.setType(TGEffectHarmonic.TYPE_ARTIFICIAL);
       harmonic.setData(0);
     }
     noteEffect.setHarmonic(harmonic);
   }
   if ((flags2 & 0x20) != 0) {
     byte fret = readByte();
     byte period = readByte();
     TGEffectTrill trill = getFactory().newEffectTrill();
     trill.setFret(fret);
     if (period == 1) {
       trill.getDuration().setValue(TGDuration.SIXTEENTH);
       noteEffect.setTrill(trill);
     } else if (period == 2) {
       trill.getDuration().setValue(TGDuration.THIRTY_SECOND);
       noteEffect.setTrill(trill);
     } else if (period == 3) {
       trill.getDuration().setValue(TGDuration.SIXTY_FOURTH);
       noteEffect.setTrill(trill);
     }
   }
 }