Exemplo n.º 1
0
 private function writeBeatEffects(Beat $beat, NoteEffect $noteEffect)
 {
     $flags1 = 0;
     $flags2 = 0;
     if ($noteEffect->isFadeIn()) {
         $flags1 |= 0x10;
     }
     if ($noteEffect->isTapping() || $noteEffect->isSlapping() || $noteEffect->isPopping()) {
         $flags1 |= 0x20;
     }
     if ($noteEffect->isTremoloBar()) {
         $flags2 |= 0x4;
     }
     if ($beat->getStroke()->getDirection() != Stroke::STROKE_NONE) {
         $flags1 |= 0x40;
     }
     $this->writeUnsignedByte($flags1);
     $this->writeUnsignedByte($flags2);
     if (($flags1 & 0x20) != 0) {
         if ($noteEffect->isTapping()) {
             $this->writeUnsignedByte(1);
         } else {
             if ($noteEffect->isSlapping()) {
                 $this->writeUnsignedByte(2);
             } else {
                 if ($noteEffect->isPopping()) {
                     $this->writeUnsignedByte(3);
                 }
             }
         }
     }
     if (($flags2 & 0x4) != 0) {
         $this->writeTremoloBar($noteEffect->getTremoloBar());
     }
     if (($flags1 & 0x40) != 0) {
         $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_UP ? $this->toStrokeValue($beat->getStroke()) : 0);
         $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_DOWN ? $this->toStrokeValue($beat->getStroke()) : 0);
     }
 }