Class MidiEventCollection
A helper class to manage collection of MIDI events It has the ability to organise them in tracks
public class MidiEventCollection : IEnumerable<IList<MidiEvent>>, IEnumerable
- Inheritance
-
MidiEventCollection
- Implements
- Inherited Members
Constructors
MidiEventCollection(int, int)
Creates a new Midi Event collection
public MidiEventCollection(int midiFileType, int deltaTicksPerQuarterNote)
Parameters
Properties
DeltaTicksPerQuarterNote
The number of ticks per quarter note
public int DeltaTicksPerQuarterNote { get; }
Property Value
this[int]
Gets events on a specific track
public IList<MidiEvent> this[int trackNumber] { get; }
Parameters
trackNumberintTrack number
Property Value
MidiFileType
The MIDI file type
public int MidiFileType { get; set; }
Property Value
StartAbsoluteTime
The absolute time that should be considered as time zero Not directly used here, but useful for timeshifting applications
public long StartAbsoluteTime { get; set; }
Property Value
Tracks
The number of tracks
public int Tracks { get; }
Property Value
Methods
AddEvent(MidiEvent, int)
Adds an event to the appropriate track depending on file type
public void AddEvent(MidiEvent midiEvent, int originalTrack)
Parameters
Remarks
When adding events in type 0 mode, the originalTrack parameter is ignored. If in type 1 mode, it will use the original track number to store the new events. If the original track was 0 and this is a channel based event, it will create new tracks if necessary and put it on the track corresponding to its channel number
AddTrack()
Adds a new track
public IList<MidiEvent> AddTrack()
Returns
AddTrack(IList<MidiEvent>)
Adds a new track
public IList<MidiEvent> AddTrack(IList<MidiEvent> initialEvents)
Parameters
Returns
Clear()
Clears all events
public void Clear()
GetEnumerator()
Gets an enumerator for the lists of track events
public IEnumerator<IList<MidiEvent>> GetEnumerator()
Returns
GetTrackEvents(int)
Gets events on a specified track
public IList<MidiEvent> GetTrackEvents(int trackNumber)
Parameters
trackNumberintTrack number
Returns
PrepareForExport()
Sorts, removes empty tracks and adds end track markers
public void PrepareForExport()
RemoveTrack(int)
Removes a track
public void RemoveTrack(int track)
Parameters
trackintTrack number to remove