/**
  * Gets a binary representation of this event
  *
  * @since 1.0
  * @uses  Util::getDeltaByteSequence()
  * @uses  getType()
  * @uses  Util::pack()
  * 
  * @return Midi
  */
 public function toBinary()
 {
     $delta = Util::getDeltaByteSequence($this->length);
     return Util::pack($this->getType()) . $delta . implode('', $this->data);
 }
Example #2
0
 /**
  * Gets the binary representation of this meta event
  *
  * @since 1.0
  * @uses  Util::pack()
  * @uses  Util::getDeltaByteSequence()
  * @uses  getSubtype()
  * 
  * @return binary
  */
 public function toBinary()
 {
     if (is_array($this->data)) {
         $data = '';
         foreach ($this->data as $datum) {
             $data .= Util::pack($datum);
         }
     } else {
         $data = $this->data;
     }
     return Util::pack($this->getType(), $this->getSubtype()) . Util::getDeltaByteSequence($this->length) . $data;
 }