private function writeMeasure(Measure $measure, $changeTempo) { for ($v = 0; $v < 2; $v++) { $voices = array(); for ($m = 0; $m < $measure->countBeats(); $m++) { $beat = $measure->getBeat($m); if ($v < $beat->countVoices()) { $voice = $beat->getVoice($v); if (!$voice->isEmpty()) { $voices[] = $voice; } } } if (count($voices) > 0) { $this->writeInt(count($voices)); for ($i = 0; $i < count($voices); $i++) { $voice = $voices[$i]; $this->writeBeat($voice, $voice->getBeat(), $measure, $changeTempo && $i == 0); } } else { $count = $measure->getTimeSignature()->getNumerator(); $beat = new Beat(); if ($v < $beat->countVoices()) { $voice = $beat->getVoice($v); $voice->getDuration()->setValue($measure->getTimeSignature()->getDenominator()->getValue()); $voice->setEmpty(true); $this->writeInt($count); for ($i = 0; $i < $count; $i++) { $this->writeBeat($voice, $voice->getBeat(), $measure, $changeTempo && $i == 0); } } } } }
private function makeBeats(MidiSequenceHelper $helper, Channel $channel, Track $track, Measure $measure, $mIndex, $startMove) { $stroke = array(); for ($i = 0; $i < $track->countStrings(); $i++) { $stroke[] = 0; } $track->getStrings(); $previous = null; for ($bIndex = 0; $bIndex < $measure->countBeats(); $bIndex++) { $beat = $measure->getBeat($bIndex); $this->makeNotes($helper, $channel, $track, $beat, $measure->getTempo(), $mIndex, $bIndex, $startMove, $this->getStroke($beat, $previous, $stroke)); $previous = $beat; } }
private function adjustBeatsStrings(Measure $measure) { for ($i = 0; $i < $measure->countBeats(); $i++) { $beat = $measure->getBeat($i); $this->adjustStrings($beat); } }