Esempio n. 1
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);
     }
 }
Esempio n. 2
0
 /**
  * Reads NoteEffect
  * 
  * @param NoteEffect $noteEffect
  */
 public function readNoteEffects(NoteEffect $noteEffect)
 {
     $flags1 = intval($this->reader->readUnsignedByte());
     $flags2 = intval($this->reader->readUnsignedByte());
     $noteEffect->setHammer(($flags1 & 0x2) != 0);
     $noteEffect->setLetRing(($flags1 & 0x8) != 0);
     $noteEffect->setVibrato(($flags2 & 0x40) != 0 || $noteEffect->isVibrato());
     $noteEffect->setPalmMute(($flags2 & 0x2) != 0);
     $noteEffect->setStaccato(($flags2 & 0x1) != 0);
     if (($flags1 & 0x1) != 0) {
         $this->reader->factory('GuitarPro3Effects')->readBend($noteEffect);
     }
     if (($flags1 & 0x10) != 0) {
         $this->reader->readGrace($noteEffect);
     }
     if (($flags2 & 0x4) != 0) {
         $this->reader->factory('GuitarPro4Effects')->readTremoloPicking($noteEffect);
     }
     if (($flags2 & 0x8) != 0) {
         $noteEffect->setSlide(true);
         $this->reader->readByte();
     }
     if (($flags2 & 0x10) != 0) {
         $this->readHarmonic($noteEffect);
     }
     if (($flags2 & 0x20) != 0) {
         $this->readTrill($noteEffect);
     }
 }
Esempio n. 3
0
 /**
  * Reads some NoteEffect informations
  * 
  * @param Beat $beat
  * @param NoteEffect $effect
  */
 public function readBeatEffects(Beat $beat, NoteEffect $noteEffect)
 {
     $flags1 = $this->reader->readUnsignedByte();
     $flags2 = $this->reader->readUnsignedByte();
     $noteEffect->setFadeIn(($flags1 & 0x10) != 0);
     $noteEffect->setVibrato(($flags1 & 0x2) != 0);
     if (($flags1 & 0x20) != 0) {
         $effect = $this->reader->readUnsignedByte();
         $noteEffect->setTapping($effect == 1);
         $noteEffect->setSlapping($effect == 2);
         $noteEffect->setPopping($effect == 3);
     }
     if (($flags2 & 0x4) != 0) {
         $this->reader->factory('GuitarPro4Effects')->readTremoloBar($noteEffect);
     }
     if (($flags1 & 0x40) != 0) {
         $factory = $this->getParserName() == 'GuitarPro5' ? 'GuitarPro5' : 'GuitarPro3';
         $this->reader->factory($factory . 'Stroke')->readStroke($beat);
     }
     if (($flags2 & 0x2) != 0) {
         $this->reader->readByte();
     }
 }