コード例 #1
0
 /**
  * Reads mix change informations
  * 
  * @param Tempo $tempo
  */
 public function readMixChange(Tempo $tempo)
 {
     $this->reader->readByte();
     //instrument
     $volume = $this->reader->readByte();
     $pan = $this->reader->readByte();
     $chorus = $this->reader->readByte();
     $reverb = $this->reader->readByte();
     $phaser = $this->reader->readByte();
     $tremolo = $this->reader->readByte();
     $tempoValue = $this->reader->readInt();
     if ($volume >= 0) {
         $this->reader->readByte();
     }
     if ($pan >= 0) {
         $this->reader->readByte();
     }
     if ($chorus >= 0) {
         $this->reader->readByte();
     }
     if ($reverb >= 0) {
         $this->reader->readByte();
     }
     if ($phaser >= 0) {
         $this->reader->readByte();
     }
     if ($tremolo >= 0) {
         $this->reader->readByte();
     }
     if ($tempoValue >= 0) {
         $tempo->setValue($tempoValue);
         $this->reader->readByte();
     }
 }
コード例 #2
0
 /**
  * Loops on mesures to read
  * 
  * @param Song $song
  * @param integer $measures
  * @param integer $tracks
  * @param integer $tempoValue
  */
 public function readMeasures(Song $song, $measures, $tracks, $tempoValue)
 {
     $tempo = new Tempo();
     $tempo->setValue($tempoValue);
     $start = Duration::QUARTER_TIME;
     for ($i = 0; $i < $measures; $i++) {
         $header = $song->getMeasureHeader($i);
         $header->setStart($start);
         for ($j = 0; $j < $tracks; $j++) {
             $track = $song->getTrack($j);
             $measure = new Measure($header);
             $track->addMeasure($measure);
             $this->reader->factory('GuitarPro3Measure')->readMeasure($measure, $track, $tempo);
         }
         $header->getTempo()->copyFrom($tempo);
         $start += $header->getLength();
     }
 }
コード例 #3
0
 /**
  * Reads mix change
  * 
  * @param Tempo $tempo
  */
 public function readMixChange(Tempo $tempo)
 {
     $this->reader->readByte();
     $this->reader->skip(16);
     $volume = $this->reader->readByte();
     $pan = $this->reader->readByte();
     $chorus = $this->reader->readByte();
     $reverb = $this->reader->readByte();
     $phaser = $this->reader->readByte();
     $tremolo = $this->reader->readByte();
     $this->reader->readStringByteSizeOfInteger();
     $tempoValue = $this->reader->readInt();
     if ($volume >= 0) {
         $this->reader->readByte();
     }
     if ($pan >= 0) {
         $this->reader->readByte();
     }
     if ($chorus >= 0) {
         $this->reader->readByte();
     }
     if ($reverb >= 0) {
         $this->reader->readByte();
     }
     if ($phaser >= 0) {
         $this->reader->readByte();
     }
     if ($tremolo >= 0) {
         $this->reader->readByte();
     }
     if ($tempoValue >= 0) {
         $tempo->setValue($tempoValue);
         $this->reader->readByte();
         if ($this->reader->getVersionIndex() > 0) {
             $this->reader->skip();
         }
     }
     $this->reader->skip(2);
     if ($this->reader->getVersionIndex() > 0) {
         $this->reader->readStringByteSizeOfInteger();
         $this->reader->readStringByteSizeOfInteger();
     }
 }
コード例 #4
0
ファイル: GuitarPro3Writer.php プロジェクト: stdtabs/phptabs
 private function writeMeasures(Song $song, Tempo $tempo)
 {
     for ($i = 0; $i < $song->countMeasureHeaders(); $i++) {
         $header = $song->getMeasureHeader($i);
         for ($j = 0; $j < $song->countTracks(); $j++) {
             $track = $song->getTrack($j);
             $measure = $track->getMeasure($i);
             $this->writeMeasure($measure, $header->getTempo()->getValue() != $tempo->getValue());
         }
         $tempo->copyFrom($header->getTempo());
     }
 }
コード例 #5
0
 private function applyStaticDuration(Tempo $tempo, $duration, $maximum)
 {
     $value = $tempo->getValue() * $duration / 60;
     return $value < $maximum ? $value : $maximum;
 }
コード例 #6
0
ファイル: MidiReader.php プロジェクト: stdtabs/phptabs
 private function parseTempo($tick, array $data)
 {
     if (count($data) >= 3) {
         $tempo = Tempo::fromTPQ($data[2] & 0xff | ($data[1] & 0xff) << 8 | ($data[0] & 0xff) << 16);
         $this->getHeader($tick)->setTempo($tempo);
     }
 }
コード例 #7
0
ファイル: GuitarPro5Writer.php プロジェクト: stdtabs/phptabs
 private function writeMixChange(Tempo $tempo)
 {
     for ($i = 0; $i < 23; $i++) {
         $this->writeByte(0xff);
     }
     $this->writeStringByteSizeOfInteger('');
     $this->writeInt($tempo !== null ? $tempo->getValue() : -1);
     if ($tempo !== null) {
         $this->skipBytes(1);
     }
     $this->writeByte(0x1);
     $this->writeByte(0xff);
 }
コード例 #8
0
ファイル: GuitarPro4Writer.php プロジェクト: stdtabs/phptabs
 private function writeMixChange(Tempo $tempo)
 {
     for ($i = 0; $i < 7; $i++) {
         $this->writeByte(-1);
     }
     $this->writeInt($tempo->getValue());
     $this->writeByte(0);
     $this->writeUnsignedByte(1);
 }