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

    switch (type) {
    case MetaEvent.TYPE.SEQUENCE_NUMBER:
        defaults.number = 0;
        break;
    case MetaEvent.TYPE.TEXT:
    case MetaEvent.TYPE.COPYRIGHT_NOTICE:
    case MetaEvent.TYPE.SEQUENCE_NAME:
    case MetaEvent.TYPE.INSTRUMENT_NAME:
    case MetaEvent.TYPE.LYRICS:
    case MetaEvent.TYPE.MARKER:
    case MetaEvent.TYPE.CUE_POINT:
    case MetaEvent.TYPE.PROGRAM_NAME:
    case MetaEvent.TYPE.DEVICE_NAME:
        defaults.text = '';
        break;
    case MetaEvent.TYPE.MIDI_CHANNEL:
        defaults.channel = 0;
        break;
    case MetaEvent.TYPE.MIDI_PORT:
        defaults.port = 0;
        break;
    case MetaEvent.TYPE.END_OF_TRACK:
        break;
    case MetaEvent.TYPE.SET_TEMPO:
        defaults.tempo = 120;
        break;
    case MetaEvent.TYPE.SMPTE_OFFSET:
        defaults.rate = 24;
        defaults.hours = 0;
        defaults.minutes = 0;
        defaults.seconds = 0;
        defaults.frames = 0;
        defaults.subframes = 0;
        break;
    case MetaEvent.TYPE.TIME_SIGNATURE:
        defaults.numerator = 4;
        defaults.denominator = 4;
        defaults.metronome = 24;
        defaults.clockSignalsPerBeat = 24;
        break;
    case MetaEvent.TYPE.KEY_SIGNATURE:
        defaults.note = 0;
        defaults.major = true;
        break;
    case MetaEvent.TYPE.SEQUENCER_SPECIFIC:
        defaults.data = new buffer.Buffer(0);
        break;
    default:
        throw new error.MIDIInvalidEventError(
            'Invalid MetaEvent type "' + type + '"'
        );
    }

    this.type = type;
    Event.call(this, props, defaults, delay);
}
function MetaEvent(type, props, delay) {
    var defaults = {};

    switch (type) {
    case MetaEvent.TYPE.SEQUENCE_NUMBER:
        defaults.number = 0;
        break;
    case MetaEvent.TYPE.TEXT:
    case MetaEvent.TYPE.COPYRIGHT_NOTICE:
    case MetaEvent.TYPE.SEQUENCE_NAME:
    case MetaEvent.TYPE.INSTRUMENT_NAME:
    case MetaEvent.TYPE.LYRICS:
    case MetaEvent.TYPE.MARKER:
    case MetaEvent.TYPE.CUE_POINT:
    case MetaEvent.TYPE.PROGRAM_NAME:
    case MetaEvent.TYPE.DEVICE_NAME:
        defaults.text = '';
        break;
    case MetaEvent.TYPE.MIDI_CHANNEL:
        defaults.channel = 0;
        break;
    case MetaEvent.TYPE.MIDI_PORT:
        defaults.port = 0;
        break;
    case MetaEvent.TYPE.END_OF_TRACK:
        break;
    case MetaEvent.TYPE.SET_TEMPO:
        defaults.tempo = 120;
        break;
    case MetaEvent.TYPE.SMPTE_OFFSET:
        defaults.rate = 24;
        defaults.hours = 0;
        defaults.minutes = 0;
        defaults.seconds = 0;
        defaults.frames = 0;
        defaults.subframes = 0;
        break;
    case MetaEvent.TYPE.TIME_SIGNATURE:
        defaults.numerator = 4;
        defaults.denominator = 4;
        defaults.metronome = 24;
        defaults.clockSignalsPerBeat = 24;
        break;
    case MetaEvent.TYPE.KEY_SIGNATURE:
        defaults.note = 0;
        defaults.major = true;
        break;
    case MetaEvent.TYPE.SEQUENCER_SPECIFIC:
        defaults.data = new buffer.Buffer(0);
        break;
    default:
        throw new error.MIDIInvalidEventError(
            'Invalid MetaEvent type "' + type + '"'
        );
    }

    this.type = type;
    Event.call(this, props, defaults, delay);
}
function MetaEvent ( type , props , delay ) { var defaults = { } ; switch ( type ) { case MetaEvent . TYPE . SEQUENCE_NUMBER : defaults . number = 0 ; break ; case MetaEvent . TYPE . TEXT : case MetaEvent . TYPE . COPYRIGHT_NOTICE : case MetaEvent . TYPE . SEQUENCE_NAME : case MetaEvent . TYPE . INSTRUMENT_NAME : case MetaEvent . TYPE . LYRICS : case MetaEvent . TYPE . MARKER : case MetaEvent . TYPE . CUE_POINT : case MetaEvent . TYPE . PROGRAM_NAME : case MetaEvent . TYPE . DEVICE_NAME : defaults . text = '' ; break ; case MetaEvent . TYPE . MIDI_CHANNEL : defaults . channel = 0 ; break ; case MetaEvent . TYPE . MIDI_PORT : defaults . port = 0 ; break ; case MetaEvent . TYPE . END_OF_TRACK : break ; case MetaEvent . TYPE . SET_TEMPO : defaults . tempo = 120 ; break ; case MetaEvent . TYPE . SMPTE_OFFSET : defaults . rate = 24 ; defaults . hours = 0 ; defaults . minutes = 0 ; defaults . seconds = 0 ; defaults . frames = 0 ; defaults . subframes = 0 ; break ; case MetaEvent . TYPE . TIME_SIGNATURE : defaults . numerator = 4 ; defaults . denominator = 4 ; defaults . metronome = 24 ; defaults . clockSignalsPerBeat = 24 ; break ; case MetaEvent . TYPE . KEY_SIGNATURE : defaults . note = 0 ; defaults . major = true ; break ; case MetaEvent . TYPE . SEQUENCER_SPECIFIC : defaults . data = new buffer . Buffer ( 0 ) ; break ; default : throw new error . MIDIInvalidEventError ( 'Invalid MetaEvent type "' + type + '"' ) ; } this . type = type ; Event . call ( this , props , defaults , delay ) ; }
Construct a new MetaEvent

@class MetaEvent
@extends Event
@classdesc A meta MIDI event, only encountered in Standard MIDI files
as holds information about the file

@param {MetaEvent.TYPE} type Type of meta event
@param {Object} [props={}] Event properties (@see MetaEvent.TYPE)
@param {number} [delay=0] Meta info delay in ticks
@throws {module:midijs/lib/error~MIDIInvalidEventError}
Invalid meta event type
Construct a new MetaEvent