/** * Parses the buffer stream for a channel event * * @since 1.0 * @uses Util::unpack() * @uses getChannelEvent() * @uses ChannelEvent::setContinuation() * @uses EventFactory::createChannelEvent() * * @param int $eventType See {@link EventType} * @param bool $isContinuation Whether the event is a continuation of a previous event * @return ChannelEvent */ protected function parseChannelEvent($eventType, $isContinuation) { $type = $eventType & 0xf0; if ($type === 0xc0 || $type === 0xd0) { $data = Util::unpack($this->read(1, true)); $data[1] = null; } else { $data = Util::unpack($this->read(2, true)); } $event = $this->eventFactory->createChannelEvent($eventType & 0xf0, $eventType & 0xf, $data[0], $data[1]); if ($isContinuation) { $event->setContinuation(true); } return $event; }
public function testCreateChannelEventWithInvalidEventType() { $this->setExpectedException('Tmont\\Midi\\MidiException', 'Invalid channel event'); $this->obj->createChannelEvent(-1, 1, 1, 1); }