| Class | MIDI::Track |
| In: |
lib/midilib/track.rb
|
| Parent: | Object |
A Track is a list of events.
When you modify the events array, make sure to call recalc_times so each Event gets its time_from_start recalculated.
A Track also holds a bitmask that specifies the channels used by the track. This bitmask is set when the track is read from the MIDI file by an IO::SeqReader but is not kept up to date by any other methods.
| UNNAMED | = | 'Unnamed' |
| channels_used | [RW] | |
| events | [RW] | |
| instrument | [RW] | |
| sequence | [R] |
Merges an array of events into our event list. After merging, the events’ time_from_start values are correct so you don’t need to worry about calling recalc_times.
Quantize every event. length_or_note is either a length (1 = quarter, 0.25 = sixteenth, 4 = whole note) or a note name ("sixteenth", "32nd", "8th triplet", "dotted quarter").
Since each event’s time_from_start is modified, we call recalc_delta_from_times after each event quantizes itself.
The opposite of recalc_times: recalculates delta_time for each event from each event’s time_from_start. This is useful, for example, when merging two event lists. As a side-effect, elements from starting_at are sorted by time_from_start.
Sort events by their time_from_start. After sorting, recalc_delta_from_times is called to make sure that the delta times reflect the possibly new event order.