コード例 #1
0
ファイル: GuitarPro5Writer.php プロジェクト: stdtabs/phptabs
 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());
     }
 }
コード例 #2
0
ファイル: GuitarPro3Writer.php プロジェクト: stdtabs/phptabs
 private function writeBeatEffects(Beat $beat, NoteEffect $noteEffect)
 {
     $flags = 0;
     if ($noteEffect->isVibrato()) {
         $flags += 0x1;
     }
     if ($noteEffect->isTremoloBar() || $noteEffect->isTapping() || $noteEffect->isSlapping() || $noteEffect->isPopping()) {
         $flags += 0x20;
     }
     if ($beat->getStroke()->getDirection() != Stroke::STROKE_NONE) {
         $flags |= 0x40;
     }
     if ($noteEffect->isHarmonic() && $noteEffect->getHarmonic()->getType() == EffectHarmonic::TYPE_NATURAL) {
         $flags += 0x4;
     }
     if ($noteEffect->isHarmonic() && $noteEffect->getHarmonic()->getType() != EffectHarmonic::TYPE_NATURAL) {
         $flags += 0x8;
     }
     if ($noteEffect->isFadeIn()) {
         $flags += 0x10;
     }
     $this->writeUnsignedByte($flags);
     if (($flags & 0x20) != 0) {
         if ($noteEffect->isTremoloBar()) {
             $this->writeUnsignedByte(0);
             $this->writeInt(100);
         } else {
             if ($noteEffect->isTapping()) {
                 $this->writeUnsignedByte(1);
                 $this->writeInt(0);
             } else {
                 if ($noteEffect->isSlapping()) {
                     $this->writeUnsignedByte(2);
                     $this->writeInt(0);
                 } else {
                     if ($noteEffect->isPopping()) {
                         $this->writeUnsignedByte(3);
                         $this->writeInt(0);
                     }
                 }
             }
         }
     }
     if (($flags & 0x40) != 0) {
         $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_DOWN ? $this->toStrokeValue($beat->getStroke()) : 0);
         $this->writeUnsignedByte($beat->getStroke()->getDirection() == Stroke::STROKE_UP ? $this->toStrokeValue($beat->getStroke()) : 0);
     }
 }
コード例 #3
0
ファイル: GuitarPro4Writer.php プロジェクト: stdtabs/phptabs
 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);
                 }
             }
         }
     }
 }