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