Ejemplo n.º 1
0
 public function __construct(Song $song)
 {
     parent::__construct();
     if ($song->isEmpty()) {
         throw new Exception('Song is empty');
     }
     $this->configureChannelRouter($song);
     $header = $song->getMeasureHeader(0);
     $this->writeStringByte(self::VERSION, 30);
     $this->writeInformations($song);
     $this->writeLyrics($song);
     $this->writeSetup();
     $this->writeInt($header->getTempo()->getValue());
     $this->writeInt(0);
     $this->writeByte(0);
     $this->writeChannels($song);
     for ($i = 0; $i < 42; $i++) {
         $this->writeByte(255);
     }
     $this->writeInt($song->countMeasureHeaders());
     $this->writeInt($song->countTracks());
     $this->writeMeasureHeaders($song);
     $this->writeTracks($song);
     $this->skipBytes(2);
     $this->writeMeasures($song, clone $header->getTempo());
 }
Ejemplo n.º 2
0
 public function __construct(Song $song)
 {
     parent::__construct();
     if ($song->isEmpty()) {
         throw new Exception('Song is empty');
     }
     $this->configureChannelRouter($song);
     $header = $song->getMeasureHeader(0);
     $this->writeStringByte(self::VERSION, 30);
     $this->writeInformations($song);
     $this->writeBoolean($header->getTripletFeel() == MeasureHeader::TRIPLET_FEEL_EIGHTH);
     $this->writeInt($header->getTempo()->getValue());
     $this->writeInt(0);
     $this->writeChannels($song);
     $this->writeInt($song->countMeasureHeaders());
     $this->writeInt($song->countTracks());
     $this->writeMeasureHeaders($song);
     $this->writeTracks($song);
     $this->writeMeasures($song, clone $header->getTempo());
 }