/**
  * Reads grace
  * 
  * @param NoteEffect $effect
  */
 private function readGrace(NoteEffect $effect)
 {
     $fret = $this->reader->readUnsignedByte();
     $grace = new EffectGrace();
     $grace->setOnBeat(false);
     $grace->setDead($fret == 255);
     $grace->setFret(!$grace->isDead() ? $fret : 0);
     $grace->setDynamic(Velocities::MIN_VELOCITY + Velocities::VELOCITY_INCREMENT * $this->reader->readUnsignedByte() - Velocities::VELOCITY_INCREMENT);
     $transition = $this->reader->readUnsignedByte();
     if ($transition == 0) {
         $grace->setTransition(EffectGrace::TRANSITION_NONE);
     } else {
         if ($transition == 1) {
             $grace->setTransition(EffectGrace::TRANSITION_SLIDE);
         } else {
             if ($transition == 2) {
                 $grace->setTransition(EffectGrace::TRANSITION_BEND);
             } else {
                 if ($transition == 3) {
                     $grace->setTransition(EffectGrace::TRANSITION_HAMMER);
                 }
             }
         }
     }
     $grace->setDuration($this->reader->readUnsignedByte());
     $effect->setGrace($grace);
 }
 /**
  * Reads EffectGrace
  * 
  * @param NoteEffect $effect
  */
 private function readGrace(NoteEffect $effect)
 {
     $fret = $this->reader->readUnsignedByte();
     $dynamic = $this->reader->readUnsignedByte();
     $transition = $this->reader->readByte();
     $duration = $this->reader->readUnsignedByte();
     $flags = $this->reader->readUnsignedByte();
     $grace = new EffectGrace();
     $grace->setFret($fret);
     $grace->setDynamic(Velocities::MIN_VELOCITY + Velocities::VELOCITY_INCREMENT * $dynamic - Velocities::VELOCITY_INCREMENT);
     $grace->setDuration($duration);
     $grace->setDead(($flags & 0x1) != 0);
     $grace->setOnBeat(($flags & 0x2) != 0);
     if ($transition == 0) {
         $grace->setTransition(EffectGrace::TRANSITION_NONE);
     } else {
         if ($transition == 1) {
             $grace->setTransition(EffectGrace::TRANSITION_SLIDE);
         } else {
             if ($transition == 2) {
                 $grace->setTransition(EffectGrace::TRANSITION_BEND);
             } else {
                 if ($transition == 3) {
                     $grace->setTransition(EffectGrace::TRANSITION_HAMMER);
                 }
             }
         }
     }
     $effect->setGrace($grace);
 }