Esempio n. 1
0
 private function getTrack($number)
 {
     foreach ($this->tracks as $track) {
         if ($track->getNumber() == $number) {
             return $track;
         }
     }
     $track = new Track();
     $track->setNumber($number);
     $track->setChannelId(-1);
     $track->getColor()->setR(Color::$red[0]);
     $track->getColor()->setG(Color::$red[1]);
     $track->getColor()->setB(Color::$red[2]);
     $this->tracks[] = $track;
     return $track;
 }
Esempio n. 2
0
 private function writeTrack(Track $track)
 {
     $channel = $this->getChannelRoute($track->getChannelId());
     $flags = 0;
     if ($this->isPercussionChannel($track->getSong(), $track->getChannelId())) {
         $flags |= 0x1;
     }
     $this->writeUnsignedByte($flags);
     $this->writeStringByte($track->getName(), 40);
     $this->writeInt(count($track->getStrings()));
     for ($i = 0; $i < 7; $i++) {
         $value = 0;
         if (count($track->getStrings()) > $i) {
             $string = $track->getStrings()[$i];
             $value = $string->getValue();
         }
         $this->writeInt($value);
     }
     $this->writeInt(1);
     $this->writeInt($channel->getChannel1() + 1);
     $this->writeInt($channel->getChannel2() + 1);
     $this->writeInt(24);
     $this->writeInt(min(max($track->getOffset(), 0), 12));
     $this->writeColor($track->getColor());
 }
Esempio n. 3
0
 private function writeTrack(Track $track)
 {
     $channel = $this->getChannelRoute($track->getChannelId());
     $flags = 0;
     if ($this->isPercussionChannel($track->getSong(), $track->getChannelId())) {
         $flags |= 0x1;
     }
     $this->writeUnsignedByte($flags);
     $this->writeUnsignedByte(8 | $flags);
     $this->writeStringByte($track->getName(), 40);
     $this->writeInt(count($track->getStrings()));
     for ($i = 0; $i < 7; $i++) {
         $value = 0;
         if (count($track->getStrings()) > $i) {
             $string = $track->getStrings()[$i];
             $value = $string->getValue();
         }
         $this->writeInt($value);
     }
     $this->writeInt(1);
     $this->writeInt($channel->getChannel1() + 1);
     $this->writeInt($channel->getChannel2() + 1);
     $this->writeInt(24);
     $this->writeInt($track->getOffset());
     $this->writeColor($track->getColor());
     $this->writeBytes(array(67, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1));
 }