Esempio n. 1
0
 /**
  * @param File $file input file to read
  */
 public function __construct(File $file)
 {
     parent::__construct($file);
     $this->readVersion();
     if (!$this->isSupportedVersion($this->getVersion())) {
         $this->closeStream();
         throw new Exception(sprintf('Version "%s" is not supported', $this->getVersion()));
     }
     $song = new Song();
     $this->setTablature($song);
     $this->factory('GuitarPro3Informations')->readInformations($song);
     $this->tripletFeel = $this->readBoolean() ? MeasureHeader::TRIPLET_FEEL_EIGHTH : MeasureHeader::TRIPLET_FEEL_NONE;
     $tempoValue = $this->readInt();
     $this->keySignature = $this->factory('GuitarProKeySignature')->readKeySignature();
     $this->skip(3);
     # Meta only
     if (Config::get('type') == 'meta') {
         $this->closeStream();
         return;
     }
     $channels = $this->factory('GuitarProChannels')->readChannels();
     $measures = $this->readInt();
     $tracks = $this->readInt();
     $this->readMeasureHeaders($song, $measures);
     $this->readTracks($song, $tracks, $channels);
     # Meta+channels+tracks+measure headers only
     if (Config::get('type') == 'channels') {
         $this->closeStream();
         return;
     }
     $this->factory('GuitarPro3Measures')->readMeasures($song, $measures, $tracks, $tempoValue);
     $this->closeStream();
 }
Esempio n. 2
0
 /**
  * @param File $file input file to read
  */
 public function __construct(File $file)
 {
     parent::__construct($file);
     $this->readVersion();
     if (!$this->isSupportedVersion($this->getVersion())) {
         $this->closeStream();
         throw new Exception(sprintf('Version "%s" is not supported', $this->getVersion()));
     }
     $song = new Song();
     $this->setTablature($song);
     $this->factory('GuitarPro5Informations')->readInformations($song);
     # Meta only
     if (Config::get('type') == 'meta') {
         $this->closeStream();
         return;
     }
     $lyricTrack = $this->readInt();
     $lyric = $this->factory('GuitarProLyric')->readLyrics();
     $this->readSetup();
     $tempoValue = $this->readInt();
     if ($this->getVersionIndex() > 0) {
         $this->skip(1);
     }
     $this->keySignature = $this->factory('GuitarProKeySignature')->readKeySignature();
     $this->skip(3);
     $this->readByte();
     $channels = $this->factory('GuitarProChannels')->readChannels();
     $this->skip(42);
     $measures = $this->readInt();
     $tracks = $this->readInt();
     $this->readMeasureHeaders($song, $measures);
     $this->readTracks($song, $tracks, $channels, $lyric, $lyricTrack);
     $this->skip($this->getVersionIndex() == 0 ? 2 : 1);
     # Meta+channels+tracks+measure headers only
     if (Config::get('type') == 'channels') {
         $this->closeStream();
         return;
     }
     $this->factory('GuitarPro5Measures')->readMeasures($song, $measures, $tracks, $tempoValue);
     $this->closeStream();
 }