private void writeGraceEffect(TGEffectGrace effect) { int header = 0; header = (effect.isDead()) ? header |= GRACE_FLAG_DEAD : header; header = (effect.isOnBeat()) ? header |= GRACE_FLAG_ON_BEAT : header; // excribo el header writeHeader(header); // excribo el fret writeByte(effect.getFret()); // excribo la duracion writeByte(effect.getDuration()); // excribo el velocity writeByte(effect.getDynamic()); // excribo la transicion writeByte(effect.getTransition()); }
private void readGrace(TGNoteEffect effect) throws IOException { int fret = readUnsignedByte(); TGEffectGrace grace = getFactory().newEffectGrace(); grace.setOnBeat(false); grace.setDead((fret == 255)); grace.setFret(((!grace.isDead()) ? fret : 0)); grace.setDynamic( (TGVelocities.MIN_VELOCITY + (TGVelocities.VELOCITY_INCREMENT * readUnsignedByte())) - TGVelocities.VELOCITY_INCREMENT); int transition = readUnsignedByte(); if (transition == 0) { grace.setTransition(TGEffectGrace.TRANSITION_NONE); } else if (transition == 1) { grace.setTransition(TGEffectGrace.TRANSITION_SLIDE); } else if (transition == 2) { grace.setTransition(TGEffectGrace.TRANSITION_BEND); } else if (transition == 3) { grace.setTransition(TGEffectGrace.TRANSITION_HAMMER); } grace.setDuration(readUnsignedByte()); effect.setGrace(grace); }