private function writeGrace(EffectGrace $grace) { if ($grace->isDead()) { $this->writeUnsignedByte(255); } else { $this->writeUnsignedByte($grace->getFret()); } $this->writeUnsignedByte(intval(($grace->getDynamic() - Velocities::MIN_VELOCITY) / Velocities::VELOCITY_INCREMENT + 1)); if ($grace->getTransition() == EffectGrace::TRANSITION_NONE) { $this->writeUnsignedByte(0); } else { if ($grace->getTransition() == EffectGrace::TRANSITION_SLIDE) { $this->writeUnsignedByte(1); } else { if ($grace->getTransition() == EffectGrace::TRANSITION_BEND) { $this->writeUnsignedByte(2); } else { if ($grace->getTransition() == EffectGrace::TRANSITION_HAMMER) { $this->writeUnsignedByte(3); } } } } $this->writeUnsignedByte($grace->getDuration()); }