コード例 #1
0
ファイル: GuitarPro5Writer.php プロジェクト: stdtabs/phptabs
 public function __construct(Song $song)
 {
     parent::__construct();
     if ($song->isEmpty()) {
         throw new Exception('Song is empty');
     }
     $this->configureChannelRouter($song);
     $header = $song->getMeasureHeader(0);
     $this->writeStringByte(self::VERSION, 30);
     $this->writeInformations($song);
     $this->writeLyrics($song);
     $this->writeSetup();
     $this->writeInt($header->getTempo()->getValue());
     $this->writeInt(0);
     $this->writeByte(0);
     $this->writeChannels($song);
     for ($i = 0; $i < 42; $i++) {
         $this->writeByte(255);
     }
     $this->writeInt($song->countMeasureHeaders());
     $this->writeInt($song->countTracks());
     $this->writeMeasureHeaders($song);
     $this->writeTracks($song);
     $this->skipBytes(2);
     $this->writeMeasures($song, clone $header->getTempo());
 }
コード例 #2
0
ファイル: GuitarPro3Writer.php プロジェクト: stdtabs/phptabs
 public function __construct(Song $song)
 {
     parent::__construct();
     if ($song->isEmpty()) {
         throw new Exception('Song is empty');
     }
     $this->configureChannelRouter($song);
     $header = $song->getMeasureHeader(0);
     $this->writeStringByte(self::VERSION, 30);
     $this->writeInformations($song);
     $this->writeBoolean($header->getTripletFeel() == MeasureHeader::TRIPLET_FEEL_EIGHTH);
     $this->writeInt($header->getTempo()->getValue());
     $this->writeInt(0);
     $this->writeChannels($song);
     $this->writeInt($song->countMeasureHeaders());
     $this->writeInt($song->countTracks());
     $this->writeMeasureHeaders($song);
     $this->writeTracks($song);
     $this->writeMeasures($song, clone $header->getTempo());
 }