lib/file/parser/event.js
function parseChannelEvent(delay, type, channel, cursor) {
    var specs = {};

    switch (type) {
    case ChannelEvent.TYPE.NOTE_OFF:
        specs.note = cursor.readUInt8();
        specs.velocity = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.NOTE_ON:
        specs.note = cursor.readUInt8();
        specs.velocity = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.NOTE_AFTERTOUCH:
        specs.note = cursor.readUInt8();
        specs.pressure = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.CONTROLLER:
        specs.controller = cursor.readUInt8();
        specs.value = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.PROGRAM_CHANGE:
        specs.program = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.CHANNEL_AFTERTOUCH:
        specs.pressure = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.PITCH_BEND:
        specs.value = cursor.readUInt8() +
            (cursor.readUInt8() << 7) - 8192;
        break;
    }

    return new ChannelEvent(type, specs, channel, delay);
}
function parseChannelEvent(delay, type, channel, cursor) {
    var specs = {};

    switch (type) {
    case ChannelEvent.TYPE.NOTE_OFF:
        specs.note = cursor.readUInt8();
        specs.velocity = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.NOTE_ON:
        specs.note = cursor.readUInt8();
        specs.velocity = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.NOTE_AFTERTOUCH:
        specs.note = cursor.readUInt8();
        specs.pressure = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.CONTROLLER:
        specs.controller = cursor.readUInt8();
        specs.value = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.PROGRAM_CHANGE:
        specs.program = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.CHANNEL_AFTERTOUCH:
        specs.pressure = cursor.readUInt8();
        break;
    case ChannelEvent.TYPE.PITCH_BEND:
        specs.value = cursor.readUInt8() +
            (cursor.readUInt8() << 7) - 8192;
        break;
    }

    return new ChannelEvent(type, specs, channel, delay);
}
function parseChannelEvent ( delay , type , channel , cursor ) { var specs = { } ; switch ( type ) { case ChannelEvent . TYPE . NOTE_OFF : specs . note = cursor . readUInt8 ( ) ; specs . velocity = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . NOTE_ON : specs . note = cursor . readUInt8 ( ) ; specs . velocity = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . NOTE_AFTERTOUCH : specs . note = cursor . readUInt8 ( ) ; specs . pressure = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . CONTROLLER : specs . controller = cursor . readUInt8 ( ) ; specs . value = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . PROGRAM_CHANGE : specs . program = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . CHANNEL_AFTERTOUCH : specs . pressure = cursor . readUInt8 ( ) ; break ; case ChannelEvent . TYPE . PITCH_BEND : specs . value = cursor . readUInt8 ( ) + ( cursor . readUInt8 ( ) << 7 ) - 8192 ; break ; } return new ChannelEvent ( type , specs , channel , delay ) ; }
Parse a channel event

@private
@param {number} delay Event delay in ticks
@param {number} type Event subtype
@param {number} channel Channel number
@param {module:buffercursor} cursor Buffer to parse
@return {module:midijs/lib/file/event~ChannelEvent} Parsed channel event
Parse a channel event