lib/file/event.js
function ChannelEvent(type, props, channel, delay) {
    var defaults = {};

    switch (type) {
    case ChannelEvent.TYPE.NOTE_OFF:
        defaults.note = 0;
        defaults.velocity = 127;
        break;
    case ChannelEvent.TYPE.NOTE_ON:
        defaults.note = 0;
        defaults.velocity = 127;
        break;
    case ChannelEvent.TYPE.NOTE_AFTERTOUCH:
        defaults.note = 0;
        defaults.pressure = 0;
        break;
    case ChannelEvent.TYPE.CONTROLLER:
        defaults.controller = 0;
        defaults.value = 127;
        break;
    case ChannelEvent.TYPE.PROGRAM_CHANGE:
        defaults.program = 0;
        break;
    case ChannelEvent.TYPE.CHANNEL_AFTERTOUCH:
        defaults.pressure = 0;
        break;
    case ChannelEvent.TYPE.PITCH_BEND:
        defaults.value = 0;
        break;
    default:
        throw new error.MIDIInvalidEventError(
            'Invalid ChannelEvent type "' + type + '"'
        );
    }

    this.type = type;
    this.channel = channel || 0;
    Event.call(this, props, defaults, delay);
}
function ChannelEvent(type, props, channel, delay) {
    var defaults = {};

    switch (type) {
    case ChannelEvent.TYPE.NOTE_OFF:
        defaults.note = 0;
        defaults.velocity = 127;
        break;
    case ChannelEvent.TYPE.NOTE_ON:
        defaults.note = 0;
        defaults.velocity = 127;
        break;
    case ChannelEvent.TYPE.NOTE_AFTERTOUCH:
        defaults.note = 0;
        defaults.pressure = 0;
        break;
    case ChannelEvent.TYPE.CONTROLLER:
        defaults.controller = 0;
        defaults.value = 127;
        break;
    case ChannelEvent.TYPE.PROGRAM_CHANGE:
        defaults.program = 0;
        break;
    case ChannelEvent.TYPE.CHANNEL_AFTERTOUCH:
        defaults.pressure = 0;
        break;
    case ChannelEvent.TYPE.PITCH_BEND:
        defaults.value = 0;
        break;
    default:
        throw new error.MIDIInvalidEventError(
            'Invalid ChannelEvent type "' + type + '"'
        );
    }

    this.type = type;
    this.channel = channel || 0;
    Event.call(this, props, defaults, delay);
}
function ChannelEvent ( type , props , channel , delay ) { var defaults = { } ; switch ( type ) { case ChannelEvent . TYPE . NOTE_OFF : defaults . note = 0 ; defaults . velocity = 127 ; break ; case ChannelEvent . TYPE . NOTE_ON : defaults . note = 0 ; defaults . velocity = 127 ; break ; case ChannelEvent . TYPE . NOTE_AFTERTOUCH : defaults . note = 0 ; defaults . pressure = 0 ; break ; case ChannelEvent . TYPE . CONTROLLER : defaults . controller = 0 ; defaults . value = 127 ; break ; case ChannelEvent . TYPE . PROGRAM_CHANGE : defaults . program = 0 ; break ; case ChannelEvent . TYPE . CHANNEL_AFTERTOUCH : defaults . pressure = 0 ; break ; case ChannelEvent . TYPE . PITCH_BEND : defaults . value = 0 ; break ; default : throw new error . MIDIInvalidEventError ( 'Invalid ChannelEvent type "' + type + '"' ) ; } this . type = type ; this . channel = channel || 0 ; Event . call ( this , props , defaults , delay ) ; }
Construct a ChannelEvent

@class ChannelEvent
@extends Event
@classdesc A channel MIDI event. This kind of event is the most important
one, it describes the state of the instruments, relative to the previous
state. Channel events can be transmitted between devices and can
also be present in Standard MIDI files.

@param {ChannelEvent.TYPE} type Type of channel event
@param {Object} [props={}] Event properties
@param {number} [channel=0] Channel to which the event applies
@param {number} [delay=0] Channel event delay in ticks
@throws {module:midijs/lib/error~MIDIInvalidEventError}
Invalid channel event type
Construct a ChannelEvent