Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * @since 1.0
  * @uses  Util::getDeltaByteSequence()
  * 
  * @return binary
  */
 public function toBinary()
 {
     return Util::getDeltaByteSequence($this->ticks);
 }
Exemplo n.º 4
0
 public function testGetDeltaByteSequence()
 {
     $this->assertEquals(pack('C2', 0x81, 0x7f), Util::getDeltaByteSequence(0xff));
     $this->assertEquals(pack('C', 0x69), Util::getDeltaByteSequence(0x69));
 }
Exemplo n.º 5
0
 public function testToBinary()
 {
     $binary = Util::pack(EventType::SYSTEM_EXCLUSIVE) . Util::getDeltaByteSequence(255) . str_repeat('x', 255);
     $this->assertEquals($binary, $this->obj->toBinary());
 }