Exemplo n.º 1
0
 private function writeNoteEffects(NoteEffect $effect)
 {
     $flags1 = 0;
     $flags2 = 0;
     if ($effect->isBend()) {
         $flags1 |= 0x1;
     }
     if ($effect->isHammer()) {
         $flags1 |= 0x2;
     }
     if ($effect->isLetRing()) {
         $flags1 |= 0x8;
     }
     if ($effect->isGrace()) {
         $flags1 |= 0x10;
     }
     if ($effect->isStaccato()) {
         $flags2 |= 0x1;
     }
     if ($effect->isPalmMute()) {
         $flags2 |= 0x2;
     }
     if ($effect->isTremoloPicking()) {
         $flags2 |= 0x4;
     }
     if ($effect->isSlide()) {
         $flags2 |= 0x8;
     }
     if ($effect->isHarmonic()) {
         $flags2 |= 0x10;
     }
     if ($effect->isTrill()) {
         $flags2 |= 0x20;
     }
     if ($effect->isVibrato()) {
         $flags2 |= 0x40;
     }
     $this->writeUnsignedByte($flags1);
     $this->writeUnsignedByte($flags2);
     if (($flags1 & 0x1) != 0) {
         $this->writeBend($effect->getBend());
     }
     if (($flags1 & 0x10) != 0) {
         $this->writeGrace($effect->getGrace());
     }
     if (($flags2 & 0x4) != 0) {
         $this->writeTremoloPicking($effect->getTremoloPicking());
     }
     if (($flags2 & 0x8) != 0) {
         $this->writeByte(1);
     }
     if (($flags2 & 0x10) != 0) {
         $this->writeByte(1);
     }
     if (($flags2 & 0x20) != 0) {
         $this->writeTrill($effect->getTrill());
     }
 }
Exemplo n.º 2
0
 private function writeNoteEffects(NoteEffect $effect)
 {
     $flags = 0;
     if ($effect->isBend()) {
         $flags |= 0x1;
     }
     if ($effect->isHammer()) {
         $flags |= 0x2;
     }
     if ($effect->isSlide()) {
         $flags |= 0x4;
     }
     if ($effect->isLetRing()) {
         $flags |= 0x8;
     }
     if ($effect->isGrace()) {
         $flags |= 0x10;
     }
     $this->writeUnsignedByte($flags);
     if (($flags & 0x1) != 0) {
         $this->writeBend($effect->getBend());
     }
     if (($flags & 0x10) != 0) {
         $this->writeGrace($effect->getGrace());
     }
 }
Exemplo n.º 3
0
 private function writeNoteEffects(NoteEffect $effect)
 {
     $flags1 = 0;
     $flags2 = 0;
     if ($effect->isBend()) {
         $flags1 |= 0x1;
     }
     if ($effect->isHammer()) {
         $flags1 |= 0x2;
     }
     if ($effect->isLetRing()) {
         $flags1 |= 0x8;
     }
     if ($effect->isGrace()) {
         $flags1 |= 0x10;
     }
     if ($effect->isStaccato()) {
         $flags2 |= 0x1;
     }
     if ($effect->isPalmMute()) {
         $flags2 |= 0x2;
     }
     if ($effect->isTremoloPicking()) {
         $flags2 |= 0x4;
     }
     if ($effect->isSlide()) {
         $flags2 |= 0x8;
     }
     if ($effect->isVibrato()) {
         $flags2 |= 0x40;
     }
     if ($effect->isHarmonic()) {
         $flags2 |= 0x10;
     }
     if ($effect->isTrill()) {
         $flags2 |= 0x20;
     }
     $this->writeUnsignedByte($flags1);
     $this->writeUnsignedByte($flags2);
     if (($flags1 & 0x1) != 0) {
         $this->writeBend($effect->getBend());
     }
     if (($flags1 & 0x10) != 0) {
         $this->writeGrace($effect->getGrace());
     }
     if (($flags2 & 0x4) != 0) {
         $this->writeTremoloPicking($effect->getTremoloPicking());
     }
     if (($flags2 & 0x8) != 0) {
         $this->writeByte(1);
     }
     if (($flags2 & 0x10) != 0) {
         if ($effect->getHarmonic()->getType() == EffectHarmonic::TYPE_NATURAL) {
             $this->writeByte(1);
         } else {
             if ($effect->getHarmonic()->getType() == EffectHarmonic::TYPE_TAPPED) {
                 $this->writeByte(3);
             } else {
                 if ($effect->getHarmonic()->getType() == EffectHarmonic::TYPE_PINCH) {
                     $this->writeByte(4);
                 } else {
                     if ($effect->getHarmonic()->getType() == EffectHarmonic::TYPE_SEMI) {
                         $this->writeByte(5);
                     } else {
                         if ($effect->getHarmonic()->getType() == EffectHarmonic::TYPE_ARTIFICIAL) {
                             $this->writeByte(15);
                         }
                     }
                 }
             }
         }
     }
     if (($flags2 & 0x20) != 0) {
         $this->writeByte($effect->getTrill()->getFret());
         if ($effect->getTrill()->getDuration()->getValue() == Duration::SIXTEENTH) {
             $this->writeByte(1);
         } else {
             if ($effect->getTrill()->getDuration()->getValue() == Duration::THIRTY_SECOND) {
                 $this->writeByte(2);
             } else {
                 if ($effect->getTrill()->getDuration()->getValue() == Duration::SIXTY_FOURTH) {
                     $this->writeByte(3);
                 }
             }
         }
     }
 }