These constructors initialize the object with a delta time and an event.
Equality and hash methods.
deltaTime is the time between the previous event and this event.
Here is an example of how to use TrackEvent.
auto statusByte = cast(ubyte) ((ChannelMessageType.noteOn << 4) | 0x7); auto event = TrackEvent( 200, MIDIEvent(statusByte, [0x0F, 0x00]), ); // get underlying value assert(event.asSysExEvent() is null); assert(event.asMetaEvent() is null); const message = event.asMIDIEvent(); assert(message !is null); // MIDI event = either a channel message or a system message assert(message.isChannelMessage()); assert(!message.isSystemMessage()); // since it's a channel message, we can use these properties of the // `MIDIEvent` struct: assert(message.getChannelMessageType() == ChannelMessageType.noteOn); assert(message.getChannelNumber() == 0x7); assert(message.data == [0x0F, 0x00]);
A TrackEvent is a delta time coupled with either a MIDI event, a system exclusive event or a meta event.
TrackEvent has an underlying union that uses the status byte to discriminate (which cannot be changed after construction). Use asMIDIEvent(), asSysExEvent() or asMetaEvent() to access the underlying values from the union.
See the documentation of mididi.def.isMIDIEvent() to see what each type of message means. Note: system exclusive events ARE also semantically system common messages. The confusing thing is that all other system common messages are syntactically MIDI events, but system exclusive events are not MIDI events.