Пример #1
0
 /**
  * Reads an artificial harmonic
  * 
  * @param NoteEffect $effect
  */
 private function readArtificialHarmonic(NoteEffect $effect)
 {
     $type = $this->reader->readByte();
     $harmonic = new EffectHarmonic();
     $harmonic->setData(0);
     if ($type == 1) {
         $harmonic->setType(EffectHarmonic::TYPE_NATURAL);
         $effect->setHarmonic($harmonic);
     } else {
         if ($type == 2) {
             $this->reader->skip(3);
             $harmonic->setType(EffectHarmonic::TYPE_ARTIFICIAL);
             $effect->setHarmonic($harmonic);
         } else {
             if ($type == 3) {
                 $this->reader->skip(1);
                 $harmonic->setType(EffectHarmonic::TYPE_TAPPED);
                 $effect->setHarmonic($harmonic);
             } else {
                 if ($type == 4) {
                     $harmonic->setType(EffectHarmonic::TYPE_PINCH);
                     $effect->setHarmonic($harmonic);
                 } else {
                     if ($type == 5) {
                         $harmonic->setType(EffectHarmonic::TYPE_SEMI);
                         $effect->setHarmonic($harmonic);
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 /**
  * Reads beat effects
  * 
  * @param Beat $beat
  * @param NoteEffect $effect
  */
 public function readBeatEffects(Beat $beat, NoteEffect $effect)
 {
     $flags = $this->reader->readUnsignedByte();
     $effect->setVibrato(($flags & 0x1) != 0 || ($flags & 0x2) != 0);
     $effect->setFadeIn(($flags & 0x10) != 0);
     if (($flags & 0x20) != 0) {
         $type = $this->reader->readUnsignedByte();
         if ($type == 0) {
             $this->reader->factory('GuitarPro3Effects')->readTremoloBar($effect);
         } else {
             $effect->setTapping($type == 1);
             $effect->setSlapping($type == 2);
             $effect->setPopping($type == 3);
             $this->reader->readInt();
         }
     }
     if (($flags & 0x40) != 0) {
         $this->reader->factory('GuitarPro3Stroke')->readStroke($beat);
     }
     if (($flags & 0x4) != 0) {
         $harmonic = new EffectHarmonic();
         $harmonic->setType(EffectHarmonic::TYPE_NATURAL);
         $effect->setHarmonic($harmonic);
     }
     if (($flags & 0x8) != 0) {
         $harmonic = new EffectHarmonic();
         $harmonic->setType(EffectHarmonic::TYPE_ARTIFICIAL);
         $harmonic->setData(0);
         $effect->setHarmonic($harmonic);
     }
 }
Пример #3
0
 private function readHarmonic(NoteEffect $noteEffect)
 {
     $harmonic = new EffectHarmonic();
     $type = intval($this->reader->readByte());
     if ($type == 1) {
         $harmonic->setType(EffectHarmonic::TYPE_NATURAL);
     } else {
         if ($type == 3) {
             $harmonic->setType(EffectHarmonic::TYPE_TAPPED);
         } else {
             if ($type == 4) {
                 $harmonic->setType(EffectHarmonic::TYPE_PINCH);
             } else {
                 if ($type == 5) {
                     $harmonic->setType(EffectHarmonic::TYPE_SEMI);
                 } else {
                     if ($type == 15) {
                         $harmonic->setType(EffectHarmonic::TYPE_ARTIFICIAL);
                         $harmonic->setData(2);
                     } else {
                         if ($type == 17) {
                             $harmonic->setType(EffectHarmonic::TYPE_ARTIFICIAL);
                             $harmonic->setData(3);
                         } else {
                             if ($type == 22) {
                                 $harmonic->setType(EffectHarmonic::TYPE_ARTIFICIAL);
                                 $harmonic->setData(0);
                             }
                         }
                     }
                 }
             }
         }
     }
     $noteEffect->setHarmonic($harmonic);
 }