示例#1
0
 private void readNoteEffects(TGNoteEffect noteEffect) throws IOException {
   int flags1 = readUnsignedByte();
   int flags2 = readUnsignedByte();
   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) {
     readArtificialHarmonic(noteEffect);
   }
   if ((flags2 & 0x20) != 0) {
     readTrill(noteEffect);
   }
   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));
 }
示例#2
0
  private void writeNoteEffect(TGNoteEffect effect) {
    int header = 0;

    header = (effect.isBend()) ? header |= EFFECT_BEND : header;
    header = (effect.isTremoloBar()) ? header |= EFFECT_TREMOLO_BAR : header;
    header = (effect.isHarmonic()) ? header |= EFFECT_HARMONIC : header;
    header = (effect.isGrace()) ? header |= EFFECT_GRACE : header;
    header = (effect.isTrill()) ? header |= EFFECT_TRILL : header;
    header = (effect.isTremoloPicking()) ? header |= EFFECT_TREMOLO_PICKING : header;
    header = (effect.isVibrato()) ? header |= EFFECT_VIBRATO : header;
    header = (effect.isDeadNote()) ? header |= EFFECT_DEAD : header;
    header = (effect.isSlide()) ? header |= EFFECT_SLIDE : header;
    header = (effect.isHammer()) ? header |= EFFECT_HAMMER : header;
    header = (effect.isGhostNote()) ? header |= EFFECT_GHOST : header;
    header = (effect.isAccentuatedNote()) ? header |= EFFECT_ACCENTUATED : header;
    header = (effect.isHeavyAccentuatedNote()) ? header |= EFFECT_HEAVY_ACCENTUATED : header;
    header = (effect.isPalmMute()) ? header |= EFFECT_PALM_MUTE : header;
    header = (effect.isStaccato()) ? header |= EFFECT_STACCATO : header;
    header = (effect.isTapping()) ? header |= EFFECT_TAPPING : header;
    header = (effect.isSlapping()) ? header |= EFFECT_SLAPPING : header;
    header = (effect.isPopping()) ? header |= EFFECT_POPPING : header;
    header = (effect.isFadeIn()) ? header |= EFFECT_FADE_IN : header;

    writeHeader(header, 3);

    // escribo el bend
    if (((header & EFFECT_BEND) != 0)) {
      writeBendEffect(effect.getBend());
    }

    // leo el tremolo bar
    if (((header & EFFECT_TREMOLO_BAR) != 0)) {
      writeTremoloBarEffect(effect.getTremoloBar());
    }

    // leo el harmonic
    if (((header & EFFECT_HARMONIC) != 0)) {
      writeHarmonicEffect(effect.getHarmonic());
    }

    // leo el grace
    if (((header & EFFECT_GRACE) != 0)) {
      writeGraceEffect(effect.getGrace());
    }

    // leo el trill
    if (((header & EFFECT_TRILL) != 0)) {
      writeTrillEffect(effect.getTrill());
    }

    // leo el tremolo picking
    if (((header & EFFECT_TREMOLO_PICKING) != 0)) {
      writeTremoloPickingEffect(effect.getTremoloPicking());
    }
  }
 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);
     }
   }
 }