/** * 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(); } }
/** * 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(); } }
/** * 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(); } }
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()); } }
private function applyStaticDuration(Tempo $tempo, $duration, $maximum) { $value = $tempo->getValue() * $duration / 60; return $value < $maximum ? $value : $maximum; }
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); } }
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); }
private function writeMixChange(Tempo $tempo) { for ($i = 0; $i < 7; $i++) { $this->writeByte(-1); } $this->writeInt($tempo->getValue()); $this->writeByte(0); $this->writeUnsignedByte(1); }