midilib 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +9 -4
- data/Rakefile +2 -6
- data/examples/from_scratch.rb +3 -5
- data/examples/measures_mbt.rb +4 -4
- data/examples/print_program_changes.rb +9 -9
- data/examples/reader2text.rb +188 -188
- data/examples/seq2text.rb +17 -17
- data/examples/split.rb +19 -19
- data/examples/strings.rb +14 -14
- data/examples/transpose.rb +31 -31
- data/html/IO.html +65 -169
- data/html/MIDI.html +138 -256
- data/html/MIDI/ActiveSense.html +89 -178
- data/html/MIDI/ChannelEvent.html +95 -183
- data/html/MIDI/ChannelPressure.html +105 -190
- data/html/MIDI/Clock.html +89 -178
- data/html/MIDI/Continue.html +89 -178
- data/html/MIDI/Controller.html +107 -192
- data/html/MIDI/Event.html +138 -222
- data/html/MIDI/IO.html +45 -157
- data/html/MIDI/IO/MIDIFile.html +596 -568
- data/html/MIDI/IO/SeqReader.html +272 -314
- data/html/MIDI/IO/SeqWriter.html +229 -305
- data/html/MIDI/KeySig.html +129 -211
- data/html/MIDI/MIDI.html +45 -154
- data/html/MIDI/MIDI/MIDI.html +45 -154
- data/html/MIDI/MIDI/MIDI/Array.html +87 -185
- data/html/MIDI/Marker.html +71 -170
- data/html/MIDI/Measure.html +95 -190
- data/html/MIDI/Measures.html +103 -193
- data/html/MIDI/MetaEvent.html +180 -253
- data/html/MIDI/NoteEvent.html +118 -204
- data/html/MIDI/NoteOff.html +95 -183
- data/html/MIDI/NoteOn.html +95 -183
- data/html/MIDI/PitchBend.html +106 -191
- data/html/MIDI/PolyPressure.html +106 -189
- data/html/MIDI/ProgramChange.html +105 -190
- data/html/MIDI/Realtime.html +98 -184
- data/html/MIDI/Sequence.html +246 -311
- data/html/MIDI/SongPointer.html +106 -191
- data/html/MIDI/SongSelect.html +105 -190
- data/html/MIDI/Start.html +89 -178
- data/html/MIDI/Stop.html +89 -178
- data/html/MIDI/SystemCommon.html +71 -170
- data/html/MIDI/SystemExclusive.html +108 -193
- data/html/MIDI/SystemReset.html +89 -178
- data/html/MIDI/Tempo.html +135 -213
- data/html/MIDI/TimeSig.html +135 -214
- data/html/MIDI/Track.html +217 -291
- data/html/MIDI/TuneRequest.html +98 -184
- data/html/MIDI/Utils.html +89 -189
- data/html/README_rdoc.html +237 -257
- data/html/TODO_rdoc.html +64 -139
- data/html/created.rid +14 -14
- data/html/css/fonts.css +167 -0
- data/html/{rdoc.css → css/rdoc.css} +265 -218
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/index.html +187 -169
- data/html/js/darkfish.js +41 -33
- data/html/js/jquery.js +4 -18
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +20 -5
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +1111 -498
- data/install.rb +43 -32
- data/lib/midilib/consts.rb +407 -407
- data/lib/midilib/event.rb +295 -294
- data/lib/midilib/info.rb +5 -5
- data/lib/midilib/io/midifile.rb +266 -267
- data/lib/midilib/io/seqreader.rb +106 -106
- data/lib/midilib/io/seqwriter.rb +59 -60
- data/lib/midilib/measure.rb +69 -69
- data/lib/midilib/sequence.rb +68 -70
- data/lib/midilib/track.rb +96 -102
- data/lib/midilib/utils.rb +15 -15
- data/test/event_equality.rb +50 -50
- data/test/test_event.rb +120 -122
- data/test/test_io.rb +35 -48
- data/test/test_sequence.rb +60 -60
- data/test/test_track.rb +154 -154
- data/test/test_varlen.rb +23 -25
- metadata +65 -57
data/test/test_sequence.rb
CHANGED
@@ -8,72 +8,72 @@ require 'midilib'
|
|
8
8
|
|
9
9
|
class SequenceTester < Test::Unit::TestCase
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
def setup
|
12
|
+
@seq = MIDI::Sequence.new
|
13
|
+
@track = MIDI::Track.new(@seq)
|
14
|
+
@seq.tracks << @track
|
15
|
+
3.times { @track.events << MIDI::NoteOn.new(0, 64, 64, 100) }
|
16
|
+
@track.recalc_times
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
def test_basics
|
20
|
+
assert_equal(120, @seq.beats_per_minute)
|
21
|
+
assert_equal(1, @seq.tracks.length)
|
22
|
+
assert_equal(MIDI::Track::UNNAMED, @seq.name)
|
23
|
+
assert_equal(MIDI::Sequence::DEFAULT_TEMPO, @seq.bpm)
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def test_pulses_to_seconds
|
27
|
+
# At a tempo of 120 BPM 480 pulses (one quarter note) should take 0.5 seconds
|
28
|
+
assert_in_delta 0.5, @seq.pulses_to_seconds(480), 0.00001
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# A half note should take one second
|
31
|
+
assert_in_delta 1.0, @seq.pulses_to_seconds(480*2), 0.00001
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
# An eight note should take 0.25 seconds
|
34
|
+
assert_in_delta 0.25, @seq.pulses_to_seconds(480/2), 0.00001
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def test_length_to_delta
|
38
|
+
assert_equal(480, @seq.ppqn)
|
39
|
+
assert_equal(480, @seq.length_to_delta(1))
|
40
|
+
assert_equal(240, @seq.length_to_delta(0.5))
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
@seq.ppqn = 12
|
43
|
+
assert_equal(12, @seq.ppqn)
|
44
|
+
assert_equal(12, @seq.length_to_delta(1))
|
45
|
+
assert_equal(6, @seq.length_to_delta(0.5))
|
46
|
+
assert_equal(5, @seq.length_to_delta(0.49))
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
49
|
+
def test_note_to_length
|
50
|
+
assert_equal(1, @seq.note_to_length('quarter'))
|
51
|
+
assert_equal(4, @seq.note_to_length('whole'))
|
52
|
+
assert_equal(1.5, @seq.note_to_length('dotted quarter'))
|
53
|
+
assert_equal(1.0 / 3.0, @seq.note_to_length('quarter triplet'))
|
54
|
+
assert_equal(0.5, @seq.note_to_length('dotted quarter triplet'))
|
55
|
+
assert_equal(1.0 / 4, @seq.note_to_length('sixteenth'))
|
56
|
+
assert_equal(1.0 / 4, @seq.note_to_length('16th'))
|
57
|
+
assert_equal(1.0 / 8, @seq.note_to_length('thirty second'))
|
58
|
+
assert_equal(1.0 / 8, @seq.note_to_length('32nd'))
|
59
|
+
assert_equal(1.0 / 16, @seq.note_to_length('sixty fourth'))
|
60
|
+
assert_equal(1.0 / 16, @seq.note_to_length('sixtyfourth'))
|
61
|
+
assert_equal(1.0 / 16, @seq.note_to_length('64th'))
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
64
|
+
def test_note_to_delta
|
65
|
+
assert_equal(480, @seq.note_to_delta('quarter'))
|
66
|
+
assert_equal(480 * 4, @seq.note_to_delta('whole'))
|
67
|
+
assert_equal(720, @seq.note_to_delta('dotted quarter'))
|
68
|
+
assert_equal(480 / 3.0, @seq.note_to_delta('quarter triplet'))
|
69
|
+
assert_equal((480 / 3.0) * 1.5,
|
70
|
+
@seq.note_to_delta('dotted quarter triplet'))
|
71
|
+
assert_equal(480 / 4, @seq.note_to_delta('sixteenth'))
|
72
|
+
assert_equal(480 / 4, @seq.note_to_delta('16th'))
|
73
|
+
assert_equal(480 / 8, @seq.note_to_delta('thirty second'))
|
74
|
+
assert_equal(480 / 8, @seq.note_to_delta('32nd'))
|
75
|
+
assert_equal(480 / 16, @seq.note_to_delta('sixty fourth'))
|
76
|
+
assert_equal(480 / 16, @seq.note_to_delta('sixtyfourth'))
|
77
|
+
assert_equal(480 / 16, @seq.note_to_delta('64th'))
|
78
|
+
end
|
79
79
|
end
|
data/test/test_track.rb
CHANGED
@@ -8,165 +8,165 @@ require 'midilib'
|
|
8
8
|
|
9
9
|
class TrackTester < Test::Unit::TestCase
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
def setup
|
12
|
+
@seq = MIDI::Sequence.new
|
13
|
+
@track = MIDI::Track.new(@seq)
|
14
|
+
@seq.tracks << @track
|
15
|
+
3.times { @track.events << MIDI::NoteOn.new(0, 64, 64, 100) }
|
16
|
+
@track.recalc_times
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_basics
|
20
|
+
assert_equal(3, @track.events.length)
|
21
|
+
3.times do |i|
|
22
|
+
assert_equal(100, @track.events[i].delta_time)
|
23
|
+
assert_equal((i+1) * 100, @track.events[i].time_from_start)
|
17
24
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def test_append_event
|
29
|
-
@track.events << MIDI::NoteOn.new(0, 64, 64, 100)
|
30
|
-
@track.recalc_times
|
31
|
-
assert_equal(4, @track.events.length)
|
32
|
-
4.times { | i |
|
33
|
-
assert_equal((i+1) * 100, @track.events[i].time_from_start)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_append_list
|
38
|
-
@track.events +=
|
39
|
-
(1..12).collect { | i | MIDI::NoteOn.new(0, 64, 64, 3) }
|
40
|
-
@track.recalc_times
|
41
|
-
|
42
|
-
3.times { | i |
|
43
|
-
assert_equal(100, @track.events[i].delta_time)
|
44
|
-
assert_equal((i+1) * 100, @track.events[i].time_from_start)
|
45
|
-
}
|
46
|
-
12.times { | i |
|
47
|
-
assert_equal(3, @track.events[3 + i].delta_time)
|
48
|
-
assert_equal(300 + ((i+1) * 3),
|
49
|
-
@track.events[3 + i].time_from_start)
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_insert
|
54
|
-
@track.events[1,0] = MIDI::NoteOn.new(0, 64, 64, 3)
|
55
|
-
@track.recalc_times
|
56
|
-
assert_equal(100, @track.events[0].time_from_start)
|
57
|
-
assert_equal(103, @track.events[1].time_from_start)
|
58
|
-
assert_equal(203, @track.events[2].time_from_start)
|
59
|
-
assert_equal(303, @track.events[3].time_from_start)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_merge
|
63
|
-
list = (1..12).collect { | i | MIDI::NoteOn.new(0, 64, 64, 10) }
|
64
|
-
@track.merge(list)
|
65
|
-
assert_equal(15, @track.events.length)
|
66
|
-
assert_equal(10, @track.events[0].time_from_start)
|
67
|
-
assert_equal(10, @track.events[0].delta_time)
|
68
|
-
assert_equal(20, @track.events[1].time_from_start)
|
69
|
-
assert_equal(10, @track.events[1].delta_time)
|
70
|
-
assert_equal(30, @track.events[2].time_from_start)
|
71
|
-
assert_equal(40, @track.events[3].time_from_start)
|
72
|
-
assert_equal(50, @track.events[4].time_from_start)
|
73
|
-
assert_equal(60, @track.events[5].time_from_start)
|
74
|
-
assert_equal(70, @track.events[6].time_from_start)
|
75
|
-
assert_equal(80, @track.events[7].time_from_start)
|
76
|
-
assert_equal(90, @track.events[8].time_from_start)
|
77
|
-
assert_equal(100, @track.events[9].time_from_start)
|
78
|
-
assert_equal(100, @track.events[10].time_from_start)
|
79
|
-
assert_equal(110, @track.events[11].time_from_start)
|
80
|
-
assert_equal(120, @track.events[12].time_from_start)
|
81
|
-
assert_equal(200, @track.events[13].time_from_start)
|
82
|
-
assert_equal(300, @track.events[14].time_from_start)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_recalc_delta_from_times
|
86
|
-
@track.each { | event | event.delta_time = 0 }
|
87
|
-
@track.recalc_delta_from_times
|
88
|
-
@track.each { | event | assert_equal(100, event.delta_time) }
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_recalc_delta_from_times_unsorted
|
92
|
-
@track.events[0].time_from_start = 100
|
93
|
-
@track.events[1].time_from_start = 50
|
94
|
-
@track.events[2].time_from_start = 150
|
95
|
-
@track.recalc_delta_from_times
|
96
|
-
prev_start_time = 0
|
97
|
-
@track.each { | event |
|
98
|
-
assert(prev_start_time <= event.time_from_start)
|
99
|
-
assert(event.delta_time > 0)
|
100
|
-
prev_start_time = event.time_from_start
|
101
|
-
}
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_sort
|
105
|
-
e = @track.events[0]
|
106
|
-
e.time_from_start = 300
|
107
|
-
e = @track.events[1]
|
108
|
-
e.time_from_start = 100
|
109
|
-
e = @track.events[2]
|
110
|
-
e.time_from_start = 200
|
111
|
-
|
112
|
-
@track.sort
|
113
|
-
|
114
|
-
assert_equal(100, @track.events[0].time_from_start)
|
115
|
-
assert_equal(100, @track.events[0].delta_time)
|
116
|
-
|
117
|
-
assert_equal(200, @track.events[1].time_from_start)
|
118
|
-
assert_equal(100, @track.events[1].delta_time)
|
119
|
-
|
120
|
-
assert_equal(300, @track.events[2].time_from_start)
|
121
|
-
assert_equal(100, @track.events[2].delta_time)
|
25
|
+
assert_equal(MIDI::Track::UNNAMED, @track.name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_append_event
|
29
|
+
@track.events << MIDI::NoteOn.new(0, 64, 64, 100)
|
30
|
+
@track.recalc_times
|
31
|
+
assert_equal(4, @track.events.length)
|
32
|
+
4.times do |i|
|
33
|
+
assert_equal((i+1) * 100, @track.events[i].time_from_start)
|
122
34
|
end
|
35
|
+
end
|
123
36
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
assert_equal(80, @track.events[0].time_from_start) # was 100
|
129
|
-
assert_equal(240, @track.events[1].time_from_start) # was 200
|
130
|
-
assert_equal(320, @track.events[2].time_from_start) # was 300
|
131
|
-
end
|
37
|
+
def test_append_list
|
38
|
+
@track.events +=
|
39
|
+
(1..12).collect { |i| MIDI::NoteOn.new(0, 64, 64, 3) }
|
40
|
+
@track.recalc_times
|
132
41
|
|
133
|
-
|
134
|
-
|
135
|
-
|
42
|
+
3.times do |i|
|
43
|
+
assert_equal(100, @track.events[i].delta_time)
|
44
|
+
assert_equal((i+1) * 100, @track.events[i].time_from_start)
|
136
45
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
x = MIDI::NoteOff.new(0, 64, 64, 10)
|
142
|
-
assert(x.kind_of?(MIDI::NoteOffEvent)) # old name
|
46
|
+
12.times do |i|
|
47
|
+
assert_equal(3, @track.events[3 + i].delta_time)
|
48
|
+
assert_equal(300 + ((i+1) * 3),
|
49
|
+
@track.events[3 + i].time_from_start)
|
143
50
|
end
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_insert
|
54
|
+
@track.events[1,0] = MIDI::NoteOn.new(0, 64, 64, 3)
|
55
|
+
@track.recalc_times
|
56
|
+
assert_equal(100, @track.events[0].time_from_start)
|
57
|
+
assert_equal(103, @track.events[1].time_from_start)
|
58
|
+
assert_equal(203, @track.events[2].time_from_start)
|
59
|
+
assert_equal(303, @track.events[3].time_from_start)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_merge
|
63
|
+
list = (1..12).collect { |i| MIDI::NoteOn.new(0, 64, 64, 10) }
|
64
|
+
@track.merge(list)
|
65
|
+
assert_equal(15, @track.events.length)
|
66
|
+
assert_equal(10, @track.events[0].time_from_start)
|
67
|
+
assert_equal(10, @track.events[0].delta_time)
|
68
|
+
assert_equal(20, @track.events[1].time_from_start)
|
69
|
+
assert_equal(10, @track.events[1].delta_time)
|
70
|
+
assert_equal(30, @track.events[2].time_from_start)
|
71
|
+
assert_equal(40, @track.events[3].time_from_start)
|
72
|
+
assert_equal(50, @track.events[4].time_from_start)
|
73
|
+
assert_equal(60, @track.events[5].time_from_start)
|
74
|
+
assert_equal(70, @track.events[6].time_from_start)
|
75
|
+
assert_equal(80, @track.events[7].time_from_start)
|
76
|
+
assert_equal(90, @track.events[8].time_from_start)
|
77
|
+
assert_equal(100, @track.events[9].time_from_start)
|
78
|
+
assert_equal(100, @track.events[10].time_from_start)
|
79
|
+
assert_equal(110, @track.events[11].time_from_start)
|
80
|
+
assert_equal(120, @track.events[12].time_from_start)
|
81
|
+
assert_equal(200, @track.events[13].time_from_start)
|
82
|
+
assert_equal(300, @track.events[14].time_from_start)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_recalc_delta_from_times
|
86
|
+
@track.each { |event| event.delta_time = 0 }
|
87
|
+
@track.recalc_delta_from_times
|
88
|
+
@track.each { |event| assert_equal(100, event.delta_time) }
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_recalc_delta_from_times_unsorted
|
92
|
+
@track.events[0].time_from_start = 100
|
93
|
+
@track.events[1].time_from_start = 50
|
94
|
+
@track.events[2].time_from_start = 150
|
95
|
+
@track.recalc_delta_from_times
|
96
|
+
prev_start_time = 0
|
97
|
+
@track.each do |event|
|
98
|
+
assert(prev_start_time <= event.time_from_start)
|
99
|
+
assert(event.delta_time > 0)
|
100
|
+
prev_start_time = event.time_from_start
|
171
101
|
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_sort
|
105
|
+
e = @track.events[0]
|
106
|
+
e.time_from_start = 300
|
107
|
+
e = @track.events[1]
|
108
|
+
e.time_from_start = 100
|
109
|
+
e = @track.events[2]
|
110
|
+
e.time_from_start = 200
|
111
|
+
|
112
|
+
@track.sort
|
113
|
+
|
114
|
+
assert_equal(100, @track.events[0].time_from_start)
|
115
|
+
assert_equal(100, @track.events[0].delta_time)
|
116
|
+
|
117
|
+
assert_equal(200, @track.events[1].time_from_start)
|
118
|
+
assert_equal(100, @track.events[1].delta_time)
|
119
|
+
|
120
|
+
assert_equal(300, @track.events[2].time_from_start)
|
121
|
+
assert_equal(100, @track.events[2].delta_time)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_quantize
|
125
|
+
@seq.ppqn = 80
|
126
|
+
|
127
|
+
@track.quantize(1) # Quantize to a quarter note
|
128
|
+
assert_equal(80, @track.events[0].time_from_start) # was 100
|
129
|
+
assert_equal(240, @track.events[1].time_from_start) # was 200
|
130
|
+
assert_equal(320, @track.events[2].time_from_start) # was 300
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_instrument
|
134
|
+
@track.instrument = 'foo'
|
135
|
+
assert_equal('foo', @track.instrument)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_old_note_class_names
|
139
|
+
x = MIDI::NoteOn.new(0, 64, 64, 10)
|
140
|
+
assert(x.kind_of?(MIDI::NoteOnEvent)) # old name
|
141
|
+
x = MIDI::NoteOff.new(0, 64, 64, 10)
|
142
|
+
assert(x.kind_of?(MIDI::NoteOffEvent)) # old name
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_mergesort
|
146
|
+
@track.events = []
|
147
|
+
|
148
|
+
# Two events with later start times but earlier in the event list
|
149
|
+
e2 = MIDI::NoteOff.new(0, 64, 64, 100)
|
150
|
+
e2.time_from_start = 100
|
151
|
+
@track.events << e2
|
152
|
+
|
153
|
+
e3 = MIDI::NoteOn.new(0, 64, 64, 100)
|
154
|
+
e3.time_from_start = 100
|
155
|
+
@track.events << e3
|
156
|
+
|
157
|
+
# Earliest start time, latest in the list of events
|
158
|
+
e1 = MIDI::NoteOn.new(0, 64, 64, 100)
|
159
|
+
e1.time_from_start = 0
|
160
|
+
@track.events << e1
|
161
|
+
|
162
|
+
# Recalc sorts. Make sure note off/note on pair at t 100 are in the
|
163
|
+
# correct order.
|
164
|
+
@track.recalc_delta_from_times
|
165
|
+
|
166
|
+
# These tests would fail before we moved to mergesort.
|
167
|
+
assert_equal(e1, @track.events[0])
|
168
|
+
assert_equal(e2, @track.events[1])
|
169
|
+
assert_equal(e3, @track.events[2])
|
170
|
+
|
171
|
+
end
|
172
172
|
end
|