private void readGrace(TGNoteEffect effect) throws IOException { int fret = readUnsignedByte(); int dynamic = readUnsignedByte(); int transition = readByte(); int duration = readUnsignedByte(); int flags = readUnsignedByte(); TGEffectGrace grace = new TGEffectGrace(); grace.setFret(fret); grace.setDynamic( (TGVelocities.MIN_VELOCITY + (TGVelocities.VELOCITY_INCREMENT * dynamic)) - TGVelocities.VELOCITY_INCREMENT); grace.setDuration(duration); grace.setDead((flags & 0x01) != 0); grace.setOnBeat((flags & 0x02) != 0); if (transition == 0) { grace.setTransition(Transition.NONE); } else if (transition == 1) { grace.setTransition(Transition.SLIDE); } else if (transition == 2) { grace.setTransition(Transition.BEND); } else if (transition == 3) { grace.setTransition(Transition.HAMMER); } effect.setGrace(grace); }
private TGEffectGrace readGraceEffect() { int header = readHeader(); TGEffectGrace effect = this.factory.newEffectGrace(); effect.setDead((header & GRACE_FLAG_DEAD) != 0); effect.setOnBeat((header & GRACE_FLAG_ON_BEAT) != 0); // leo el fret effect.setFret(readByte()); // leo la duracion effect.setDuration(readByte()); // leo el velocity effect.setDynamic(readByte()); // leo la transicion effect.setTransition(readByte()); return effect; }
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); }