コード例 #1
0
ファイル: GuitarPro3Effects.php プロジェクト: stdtabs/phptabs
 /**
  * Reads bend
  *
  * @param NoteEffect $effect
  */
 public function readBend(NoteEffect $effect)
 {
     $bend = new EffectBend();
     $this->reader->skip(5);
     $points = $this->reader->readInt();
     for ($i = 0; $i < $points; $i++) {
         $bendPosition = $this->reader->readInt();
         $bendValue = $this->reader->readInt();
         $this->reader->readByte();
         //vibrato
         $pointPosition = round($bendPosition * EffectBend::MAX_POSITION_LENGTH / GuitarProReaderInterface::GP_BEND_POSITION);
         $pointValue = round($bendValue * EffectBend::SEMITONE_LENGTH / GuitarProReaderInterface::GP_BEND_SEMITONE);
         $bend->addPoint($pointPosition, $pointValue);
     }
     if (count($bend->getPoints())) {
         $effect->setBend($bend);
     }
 }