midilib 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +9 -4
  3. data/Rakefile +2 -6
  4. data/examples/from_scratch.rb +3 -5
  5. data/examples/measures_mbt.rb +4 -4
  6. data/examples/print_program_changes.rb +9 -9
  7. data/examples/reader2text.rb +188 -188
  8. data/examples/seq2text.rb +17 -17
  9. data/examples/split.rb +19 -19
  10. data/examples/strings.rb +14 -14
  11. data/examples/transpose.rb +31 -31
  12. data/html/IO.html +65 -169
  13. data/html/MIDI.html +138 -256
  14. data/html/MIDI/ActiveSense.html +89 -178
  15. data/html/MIDI/ChannelEvent.html +95 -183
  16. data/html/MIDI/ChannelPressure.html +105 -190
  17. data/html/MIDI/Clock.html +89 -178
  18. data/html/MIDI/Continue.html +89 -178
  19. data/html/MIDI/Controller.html +107 -192
  20. data/html/MIDI/Event.html +138 -222
  21. data/html/MIDI/IO.html +45 -157
  22. data/html/MIDI/IO/MIDIFile.html +596 -568
  23. data/html/MIDI/IO/SeqReader.html +272 -314
  24. data/html/MIDI/IO/SeqWriter.html +229 -305
  25. data/html/MIDI/KeySig.html +129 -211
  26. data/html/MIDI/MIDI.html +45 -154
  27. data/html/MIDI/MIDI/MIDI.html +45 -154
  28. data/html/MIDI/MIDI/MIDI/Array.html +87 -185
  29. data/html/MIDI/Marker.html +71 -170
  30. data/html/MIDI/Measure.html +95 -190
  31. data/html/MIDI/Measures.html +103 -193
  32. data/html/MIDI/MetaEvent.html +180 -253
  33. data/html/MIDI/NoteEvent.html +118 -204
  34. data/html/MIDI/NoteOff.html +95 -183
  35. data/html/MIDI/NoteOn.html +95 -183
  36. data/html/MIDI/PitchBend.html +106 -191
  37. data/html/MIDI/PolyPressure.html +106 -189
  38. data/html/MIDI/ProgramChange.html +105 -190
  39. data/html/MIDI/Realtime.html +98 -184
  40. data/html/MIDI/Sequence.html +246 -311
  41. data/html/MIDI/SongPointer.html +106 -191
  42. data/html/MIDI/SongSelect.html +105 -190
  43. data/html/MIDI/Start.html +89 -178
  44. data/html/MIDI/Stop.html +89 -178
  45. data/html/MIDI/SystemCommon.html +71 -170
  46. data/html/MIDI/SystemExclusive.html +108 -193
  47. data/html/MIDI/SystemReset.html +89 -178
  48. data/html/MIDI/Tempo.html +135 -213
  49. data/html/MIDI/TimeSig.html +135 -214
  50. data/html/MIDI/Track.html +217 -291
  51. data/html/MIDI/TuneRequest.html +98 -184
  52. data/html/MIDI/Utils.html +89 -189
  53. data/html/README_rdoc.html +237 -257
  54. data/html/TODO_rdoc.html +64 -139
  55. data/html/created.rid +14 -14
  56. data/html/css/fonts.css +167 -0
  57. data/html/{rdoc.css → css/rdoc.css} +265 -218
  58. data/html/fonts/Lato-Light.ttf +0 -0
  59. data/html/fonts/Lato-LightItalic.ttf +0 -0
  60. data/html/fonts/Lato-Regular.ttf +0 -0
  61. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  62. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  63. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  64. data/html/images/add.png +0 -0
  65. data/html/images/arrow_up.png +0 -0
  66. data/html/images/delete.png +0 -0
  67. data/html/images/tag_blue.png +0 -0
  68. data/html/index.html +187 -169
  69. data/html/js/darkfish.js +41 -33
  70. data/html/js/jquery.js +4 -18
  71. data/html/js/navigation.js.gz +0 -0
  72. data/html/js/search.js +20 -5
  73. data/html/js/search_index.js +1 -1
  74. data/html/js/search_index.js.gz +0 -0
  75. data/html/js/searcher.js.gz +0 -0
  76. data/html/table_of_contents.html +1111 -498
  77. data/install.rb +43 -32
  78. data/lib/midilib/consts.rb +407 -407
  79. data/lib/midilib/event.rb +295 -294
  80. data/lib/midilib/info.rb +5 -5
  81. data/lib/midilib/io/midifile.rb +266 -267
  82. data/lib/midilib/io/seqreader.rb +106 -106
  83. data/lib/midilib/io/seqwriter.rb +59 -60
  84. data/lib/midilib/measure.rb +69 -69
  85. data/lib/midilib/sequence.rb +68 -70
  86. data/lib/midilib/track.rb +96 -102
  87. data/lib/midilib/utils.rb +15 -15
  88. data/test/event_equality.rb +50 -50
  89. data/test/test_event.rb +120 -122
  90. data/test/test_io.rb +35 -48
  91. data/test/test_sequence.rb +60 -60
  92. data/test/test_track.rb +154 -154
  93. data/test/test_varlen.rb +23 -25
  94. metadata +65 -57
@@ -2,70 +2,68 @@
2
2
 
3
3
  <html>
4
4
  <head>
5
- <meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
5
+ <meta charset="UTF-8">
6
6
 
7
7
  <title>class MIDI::Track - midilib</title>
8
8
 
9
- <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
-
11
9
  <script type="text/javascript">
12
10
  var rdoc_rel_prefix = "../";
13
11
  </script>
14
12
 
15
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
13
+ <script src="../js/jquery.js"></script>
14
+ <script src="../js/darkfish.js"></script>
15
+
16
+ <link href="../css/fonts.css" rel="stylesheet">
17
+ <link href="../css/rdoc.css" rel="stylesheet">
18
+
21
19
 
22
20
 
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="../index.html">Home</a>
21
+ <body id="top" role="document" class="class">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="../index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="../table_of_contents.html#pages">Pages</a>
28
31
  <a href="../table_of_contents.html#classes">Classes</a>
29
32
  <a href="../table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
+ </div>
34
+ </div>
33
35
 
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
35
37
  <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
38
42
  title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
43
+ </div>
41
44
 
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
- <div id="file-metadata">
47
- <nav id="file-list-section" class="section">
48
- <h3 class="section-header">Defined In</h3>
49
- <ul>
50
- <li>lib/midilib/track.rb
51
- </ul>
52
- </nav>
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
53
50
 
54
-
55
51
  </div>
56
52
 
53
+
54
+
57
55
  <div id="class-metadata">
58
56
 
59
- <nav id="parent-class-section" class="section">
60
- <h3 class="section-header">Parent</h3>
57
+ <div id="parent-class-section" class="nav-section">
58
+ <h3>Parent</h3>
59
+
61
60
 
62
61
  <p class="link">Object
63
62
 
64
- </nav>
63
+ </div>
65
64
 
66
- <!-- Included Modules -->
67
- <nav id="includes-section" class="section">
68
- <h3 class="section-header">Included Modules</h3>
65
+ <div id="includes-section" class="nav-section">
66
+ <h3>Included Modules</h3>
69
67
 
70
68
  <ul class="link-list">
71
69
 
@@ -74,157 +72,51 @@
74
72
 
75
73
 
76
74
  </ul>
77
- </nav>
75
+ </div>
78
76
 
77
+
79
78
  <!-- Method Quickref -->
80
- <nav id="method-list-section" class="section">
81
- <h3 class="section-header">Methods</h3>
79
+ <div id="method-list-section" class="nav-section">
80
+ <h3>Methods</h3>
82
81
 
83
- <ul class="link-list">
82
+ <ul class="link-list" role="directory">
84
83
 
85
- <li><a href="#method-c-new">::new</a>
84
+ <li ><a href="#method-c-new">::new</a>
86
85
 
87
- <li><a href="#method-i-each">#each</a>
86
+ <li ><a href="#method-i-each">#each</a>
88
87
 
89
- <li><a href="#method-i-instrument">#instrument</a>
88
+ <li ><a href="#method-i-instrument">#instrument</a>
90
89
 
91
- <li><a href="#method-i-instrument-3D">#instrument=</a>
90
+ <li ><a href="#method-i-instrument-3D">#instrument=</a>
92
91
 
93
- <li><a href="#method-i-merge">#merge</a>
92
+ <li ><a href="#method-i-merge">#merge</a>
94
93
 
95
- <li><a href="#method-i-merge_event_lists">#merge_event_lists</a>
94
+ <li ><a href="#method-i-merge_event_lists">#merge_event_lists</a>
96
95
 
97
- <li><a href="#method-i-name">#name</a>
96
+ <li ><a href="#method-i-name">#name</a>
98
97
 
99
- <li><a href="#method-i-name-3D">#name=</a>
98
+ <li ><a href="#method-i-name-3D">#name=</a>
100
99
 
101
- <li><a href="#method-i-quantize">#quantize</a>
100
+ <li ><a href="#method-i-quantize">#quantize</a>
102
101
 
103
- <li><a href="#method-i-recalc_delta_from_times">#recalc_delta_from_times</a>
102
+ <li ><a href="#method-i-recalc_delta_from_times">#recalc_delta_from_times</a>
104
103
 
105
- <li><a href="#method-i-recalc_times">#recalc_times</a>
104
+ <li ><a href="#method-i-recalc_times">#recalc_times</a>
106
105
 
107
- <li><a href="#method-i-sort">#sort</a>
106
+ <li ><a href="#method-i-sort">#sort</a>
108
107
 
109
108
  </ul>
110
- </nav>
109
+ </div>
111
110
 
112
111
  </div>
113
-
114
- <div id="project-metadata">
115
- <nav id="fileindex-section" class="section project-section">
116
- <h3 class="section-header">Pages</h3>
117
-
118
- <ul>
119
-
120
- <li class="file"><a href="../README_rdoc.html">README</a>
121
-
122
- <li class="file"><a href="../TODO_rdoc.html">TODO</a>
123
-
124
- </ul>
125
112
  </nav>
126
113
 
127
- <nav id="classindex-section" class="section project-section">
128
- <h3 class="section-header">Class and Module Index</h3>
114
+ <main role="main" aria-labelledby="class-MIDI::Track">
115
+ <h1 id="class-MIDI::Track" class="class">
116
+ class MIDI::Track
117
+ </h1>
129
118
 
130
- <ul class="link-list">
131
-
132
- <li><a href="../MIDI.html">MIDI</a>
133
-
134
- <li><a href="../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
135
-
136
- <li><a href="../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
137
-
138
- <li><a href="../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
139
-
140
- <li><a href="../MIDI/Clock.html">MIDI::Clock</a>
141
-
142
- <li><a href="../MIDI/Continue.html">MIDI::Continue</a>
143
-
144
- <li><a href="../MIDI/Controller.html">MIDI::Controller</a>
145
-
146
- <li><a href="../MIDI/Event.html">MIDI::Event</a>
147
-
148
- <li><a href="../MIDI/IO.html">MIDI::IO</a>
149
-
150
- <li><a href="../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
151
-
152
- <li><a href="../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
153
-
154
- <li><a href="../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
155
-
156
- <li><a href="../MIDI/KeySig.html">MIDI::KeySig</a>
157
-
158
- <li><a href="../MIDI/MIDI.html">MIDI::MIDI</a>
159
-
160
- <li><a href="../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
161
-
162
- <li><a href="../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
163
-
164
- <li><a href="../MIDI/Marker.html">MIDI::Marker</a>
165
-
166
- <li><a href="../MIDI/Measure.html">MIDI::Measure</a>
167
-
168
- <li><a href="../MIDI/Measures.html">MIDI::Measures</a>
169
-
170
- <li><a href="../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
171
-
172
- <li><a href="../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
173
-
174
- <li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a>
175
-
176
- <li><a href="../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
177
-
178
- <li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a>
179
-
180
- <li><a href="../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
181
-
182
- <li><a href="../MIDI/PitchBend.html">MIDI::PitchBend</a>
183
-
184
- <li><a href="../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
185
-
186
- <li><a href="../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
187
-
188
- <li><a href="../MIDI/Realtime.html">MIDI::Realtime</a>
189
-
190
- <li><a href="../MIDI/Sequence.html">MIDI::Sequence</a>
191
-
192
- <li><a href="../MIDI/SongPointer.html">MIDI::SongPointer</a>
193
-
194
- <li><a href="../MIDI/SongSelect.html">MIDI::SongSelect</a>
195
-
196
- <li><a href="../MIDI/Start.html">MIDI::Start</a>
197
-
198
- <li><a href="../MIDI/Stop.html">MIDI::Stop</a>
199
-
200
- <li><a href="../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
201
-
202
- <li><a href="../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
203
-
204
- <li><a href="../MIDI/SystemReset.html">MIDI::SystemReset</a>
205
-
206
- <li><a href="../MIDI/Tempo.html">MIDI::Tempo</a>
207
-
208
- <li><a href="../MIDI/TimeSig.html">MIDI::TimeSig</a>
209
-
210
- <li><a href="../MIDI/Track.html">MIDI::Track</a>
211
-
212
- <li><a href="../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
213
-
214
- <li><a href="../MIDI/Utils.html">MIDI::Utils</a>
215
-
216
- <li><a href="../IO.html">IO</a>
217
-
218
- </ul>
219
- </nav>
220
-
221
- </div>
222
- </nav>
223
-
224
- <div id="documentation">
225
- <h1 class="class">class MIDI::Track</h1>
226
-
227
- <div id="description" class="description">
119
+ <section class="description">
228
120
 
229
121
  <p>A <a href="Track.html">Track</a> is a list of events.</p>
230
122
 
@@ -239,7 +131,7 @@ the <a href="MIDI.html">MIDI</a> file by an <a
239
131
  href="IO/SeqReader.html">IO::SeqReader</a> but is <em>not</em> kept up to
240
132
  date by any other methods.</p>
241
133
 
242
- </div><!-- description -->
134
+ </section>
243
135
 
244
136
 
245
137
 
@@ -250,14 +142,15 @@ date by any other methods.</p>
250
142
 
251
143
 
252
144
 
253
- <!-- Constants -->
254
- <section id="constants-list" class="section">
255
- <h3 class="section-header">Constants</h3>
145
+ <section class="constants-list">
146
+ <header>
147
+ <h3>Constants</h3>
148
+ </header>
256
149
  <dl>
257
150
 
258
151
  <dt id="UNNAMED">UNNAMED
259
152
 
260
- <dd class="description">
153
+ <dd>
261
154
 
262
155
 
263
156
  </dl>
@@ -265,9 +158,10 @@ date by any other methods.</p>
265
158
 
266
159
 
267
160
 
268
- <!-- Attributes -->
269
- <section id="attribute-method-details" class="method-section section">
270
- <h3 class="section-header">Attributes</h3>
161
+ <section class="attribute-method-details" class="method-section">
162
+ <header>
163
+ <h3>Attributes</h3>
164
+ </header>
271
165
 
272
166
 
273
167
  <div id="attribute-i-channels_used" class="method-detail">
@@ -309,13 +203,14 @@ date by any other methods.</p>
309
203
  </div>
310
204
  </div>
311
205
 
312
- </section><!-- attribute-method-details -->
206
+ </section>
313
207
 
314
208
 
315
- <!-- Methods -->
316
209
 
317
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
318
- <h3 class="section-header">Public Class Methods</h3>
210
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
211
+ <header>
212
+ <h3>Public Class Methods</h3>
213
+ </header>
319
214
 
320
215
 
321
216
  <div id="method-c-new" class="method-detail ">
@@ -323,7 +218,9 @@ date by any other methods.</p>
323
218
  <div class="method-heading">
324
219
  <span class="method-name">new</span><span
325
220
  class="method-args">(sequence)</span>
221
+
326
222
  <span class="method-click-advice">click to toggle source</span>
223
+
327
224
  </div>
328
225
 
329
226
 
@@ -331,32 +228,35 @@ date by any other methods.</p>
331
228
 
332
229
 
333
230
 
231
+
334
232
 
335
233
 
336
234
  <div class="method-source-code" id="new-source">
337
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 65</span>
235
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 63</span>
338
236
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">sequence</span>)
339
- <span class="ruby-ivar">@sequence</span> = <span class="ruby-identifier">sequence</span>
340
- <span class="ruby-ivar">@events</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
237
+ <span class="ruby-ivar">@sequence</span> = <span class="ruby-identifier">sequence</span>
238
+ <span class="ruby-ivar">@events</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
341
239
 
342
- <span class="ruby-comment"># Bitmask of all channels used. Set when track is read in from</span>
343
- <span class="ruby-comment"># a MIDI file.</span>
344
- <span class="ruby-ivar">@channels_used</span> = <span class="ruby-value">0</span>
240
+ <span class="ruby-comment"># Bitmask of all channels used. Set when track is read in from</span>
241
+ <span class="ruby-comment"># a MIDI file.</span>
242
+ <span class="ruby-ivar">@channels_used</span> = <span class="ruby-value">0</span>
345
243
  <span class="ruby-keyword">end</span></pre>
346
- </div><!-- new-source -->
244
+ </div>
347
245
 
348
246
  </div>
349
247
 
350
248
 
351
249
 
352
250
 
353
- </div><!-- new-method -->
251
+ </div>
354
252
 
355
253
 
356
- </section><!-- public-class-method-details -->
254
+ </section>
357
255
 
358
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
359
- <h3 class="section-header">Public Instance Methods</h3>
256
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
257
+ <header>
258
+ <h3>Public Instance Methods</h3>
259
+ </header>
360
260
 
361
261
 
362
262
  <div id="method-i-each" class="method-detail ">
@@ -364,7 +264,9 @@ date by any other methods.</p>
364
264
  <div class="method-heading">
365
265
  <span class="method-name">each</span><span
366
266
  class="method-args">() { |event| ... }</span>
267
+
367
268
  <span class="method-click-advice">click to toggle source</span>
269
+
368
270
  </div>
369
271
 
370
272
 
@@ -372,21 +274,22 @@ date by any other methods.</p>
372
274
 
373
275
  <p>Iterate over events.</p>
374
276
 
277
+
375
278
 
376
279
 
377
280
  <div class="method-source-code" id="each-source">
378
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 171</span>
281
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 165</span>
379
282
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">each</span> <span class="ruby-comment"># :yields: event</span>
380
- <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">event</span> }
283
+ <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">event</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">event</span> }
381
284
  <span class="ruby-keyword">end</span></pre>
382
- </div><!-- each-source -->
285
+ </div>
383
286
 
384
287
  </div>
385
288
 
386
289
 
387
290
 
388
291
 
389
- </div><!-- each-method -->
292
+ </div>
390
293
 
391
294
 
392
295
  <div id="method-i-instrument" class="method-detail ">
@@ -394,7 +297,9 @@ date by any other methods.</p>
394
297
  <div class="method-heading">
395
298
  <span class="method-name">instrument</span><span
396
299
  class="method-args">()</span>
300
+
397
301
  <span class="method-click-advice">click to toggle source</span>
302
+
398
303
  </div>
399
304
 
400
305
 
@@ -402,21 +307,22 @@ date by any other methods.</p>
402
307
 
403
308
 
404
309
 
310
+
405
311
 
406
312
 
407
313
  <div class="method-source-code" id="instrument-source">
408
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 95</span>
314
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 89</span>
409
315
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">instrument</span>
410
- <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">bytes_as_str</span>(<span class="ruby-ivar">@instrument</span>)
316
+ <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">bytes_as_str</span>(<span class="ruby-ivar">@instrument</span>)
411
317
  <span class="ruby-keyword">end</span></pre>
412
- </div><!-- instrument-source -->
318
+ </div>
413
319
 
414
320
  </div>
415
321
 
416
322
 
417
323
 
418
324
 
419
- </div><!-- instrument-method -->
325
+ </div>
420
326
 
421
327
 
422
328
  <div id="method-i-instrument-3D" class="method-detail ">
@@ -424,7 +330,9 @@ date by any other methods.</p>
424
330
  <div class="method-heading">
425
331
  <span class="method-name">instrument=</span><span
426
332
  class="method-args">(str_or_bytes)</span>
333
+
427
334
  <span class="method-click-advice">click to toggle source</span>
335
+
428
336
  </div>
429
337
 
430
338
 
@@ -432,26 +340,27 @@ date by any other methods.</p>
432
340
 
433
341
 
434
342
 
343
+
435
344
 
436
345
 
437
346
  <div class="method-source-code" id="instrument-3D-source">
438
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 99</span>
347
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 93</span>
439
348
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">instrument=</span>(<span class="ruby-identifier">str_or_bytes</span>)
440
- <span class="ruby-ivar">@instrument</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">str_or_bytes</span>
441
- <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
442
- <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">str_as_bytes</span>(<span class="ruby-identifier">str_or_bytes</span>)
443
- <span class="ruby-keyword">else</span>
444
- <span class="ruby-identifier">str_or_bytes</span>
445
- <span class="ruby-keyword">end</span>
349
+ <span class="ruby-ivar">@instrument</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">str_or_bytes</span>
350
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
351
+ <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">str_as_bytes</span>(<span class="ruby-identifier">str_or_bytes</span>)
352
+ <span class="ruby-keyword">else</span>
353
+ <span class="ruby-identifier">str_or_bytes</span>
354
+ <span class="ruby-keyword">end</span>
446
355
  <span class="ruby-keyword">end</span></pre>
447
- </div><!-- instrument-3D-source -->
356
+ </div>
448
357
 
449
358
  </div>
450
359
 
451
360
 
452
361
 
453
362
 
454
- </div><!-- instrument-3D-method -->
363
+ </div>
455
364
 
456
365
 
457
366
  <div id="method-i-merge" class="method-detail ">
@@ -459,31 +368,34 @@ date by any other methods.</p>
459
368
  <div class="method-heading">
460
369
  <span class="method-name">merge</span><span
461
370
  class="method-args">(event_list)</span>
371
+
462
372
  <span class="method-click-advice">click to toggle source</span>
373
+
463
374
  </div>
464
375
 
465
376
 
466
377
  <div class="method-description">
467
378
 
468
- <p>Merges an array of events into our event list. After merging, the events'
469
- time_from_start values are correct so you don't need to worry about calling
470
- recalc_times.</p>
379
+ <p>Merges an array of events into our event list. After merging, the
380
+ events&#39; time_from_start values are correct so you don&#39;t need to
381
+ worry about calling recalc_times.</p>
382
+
471
383
 
472
384
 
473
385
 
474
386
  <div class="method-source-code" id="merge-source">
475
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 111</span>
387
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 105</span>
476
388
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">event_list</span>)
477
- <span class="ruby-ivar">@events</span> = <span class="ruby-identifier">merge_event_lists</span>(<span class="ruby-ivar">@events</span>, <span class="ruby-identifier">event_list</span>)
389
+ <span class="ruby-ivar">@events</span> = <span class="ruby-identifier">merge_event_lists</span>(<span class="ruby-ivar">@events</span>, <span class="ruby-identifier">event_list</span>)
478
390
  <span class="ruby-keyword">end</span></pre>
479
- </div><!-- merge-source -->
391
+ </div>
480
392
 
481
393
  </div>
482
394
 
483
395
 
484
396
 
485
397
 
486
- </div><!-- merge-method -->
398
+ </div>
487
399
 
488
400
 
489
401
  <div id="method-i-merge_event_lists" class="method-detail ">
@@ -491,7 +403,9 @@ recalc_times.</p>
491
403
  <div class="method-heading">
492
404
  <span class="method-name">merge_event_lists</span><span
493
405
  class="method-args">(list1, list2)</span>
406
+
494
407
  <span class="method-click-advice">click to toggle source</span>
408
+
495
409
  </div>
496
410
 
497
411
 
@@ -499,25 +413,26 @@ recalc_times.</p>
499
413
 
500
414
  <p>Merges two event arrays together. Does not modify this track.</p>
501
415
 
416
+
502
417
 
503
418
 
504
419
  <div class="method-source-code" id="merge_event_lists-source">
505
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 116</span>
420
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 110</span>
506
421
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_event_lists</span>(<span class="ruby-identifier">list1</span>, <span class="ruby-identifier">list2</span>)
507
- <span class="ruby-identifier">recalc_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list1</span>)
508
- <span class="ruby-identifier">recalc_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list2</span>)
509
- <span class="ruby-identifier">list</span> = <span class="ruby-identifier">list1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">list2</span>
510
- <span class="ruby-identifier">recalc_delta_from_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list</span>)
511
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">list</span>
422
+ <span class="ruby-identifier">recalc_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list1</span>)
423
+ <span class="ruby-identifier">recalc_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list2</span>)
424
+ <span class="ruby-identifier">list</span> = <span class="ruby-identifier">list1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">list2</span>
425
+ <span class="ruby-identifier">recalc_delta_from_times</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">list</span>)
426
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">list</span>
512
427
  <span class="ruby-keyword">end</span></pre>
513
- </div><!-- merge_event_lists-source -->
428
+ </div>
514
429
 
515
430
  </div>
516
431
 
517
432
 
518
433
 
519
434
 
520
- </div><!-- merge_event_lists-method -->
435
+ </div>
521
436
 
522
437
 
523
438
  <div id="method-i-name" class="method-detail ">
@@ -525,7 +440,9 @@ recalc_times.</p>
525
440
  <div class="method-heading">
526
441
  <span class="method-name">name</span><span
527
442
  class="method-args">()</span>
443
+
528
444
  <span class="method-click-advice">click to toggle source</span>
445
+
529
446
  </div>
530
447
 
531
448
 
@@ -534,24 +451,23 @@ recalc_times.</p>
534
451
  <p>Return track name. If there is no name, return <a
535
452
  href="Track.html#UNNAMED">UNNAMED</a>.</p>
536
453
 
454
+
537
455
 
538
456
 
539
457
  <div class="method-source-code" id="name-source">
540
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 75</span>
458
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 73</span>
541
459
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>
542
- <span class="ruby-identifier">event</span> = <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
543
- <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MetaEvent</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">meta_type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">META_SEQ_NAME</span>
544
- }
545
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data_as_str</span> <span class="ruby-operator">:</span> <span class="ruby-constant">UNNAMED</span>
460
+ <span class="ruby-identifier">event</span> = <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MetaEvent</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">meta_type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">META_SEQ_NAME</span> }
461
+ <span class="ruby-identifier">event</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data_as_str</span> <span class="ruby-operator">:</span> <span class="ruby-constant">UNNAMED</span>
546
462
  <span class="ruby-keyword">end</span></pre>
547
- </div><!-- name-source -->
463
+ </div>
548
464
 
549
465
  </div>
550
466
 
551
467
 
552
468
 
553
469
 
554
- </div><!-- name-method -->
470
+ </div>
555
471
 
556
472
 
557
473
  <div id="method-i-name-3D" class="method-detail ">
@@ -559,7 +475,9 @@ href="Track.html#UNNAMED">UNNAMED</a>.</p>
559
475
  <div class="method-heading">
560
476
  <span class="method-name">name=</span><span
561
477
  class="method-args">(name)</span>
478
+
562
479
  <span class="method-click-advice">click to toggle source</span>
480
+
563
481
  </div>
564
482
 
565
483
 
@@ -567,29 +485,28 @@ href="Track.html#UNNAMED">UNNAMED</a>.</p>
567
485
 
568
486
  <p>Set track name. Replaces or creates a name meta-event.</p>
569
487
 
488
+
570
489
 
571
490
 
572
491
  <div class="method-source-code" id="name-3D-source">
573
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 83</span>
492
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 79</span>
574
493
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">name=</span>(<span class="ruby-identifier">name</span>)
575
- <span class="ruby-identifier">event</span> = <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
576
- <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MetaEvent</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">meta_type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">META_SEQ_NAME</span>
577
- }
578
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">event</span>
579
- <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data</span> = <span class="ruby-identifier">name</span>
580
- <span class="ruby-keyword">else</span>
581
- <span class="ruby-identifier">event</span> = <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_SEQ_NAME</span>, <span class="ruby-identifier">name</span>, <span class="ruby-value">0</span>)
582
- <span class="ruby-ivar">@events</span>[<span class="ruby-value">0</span>, <span class="ruby-value">0</span>] = <span class="ruby-identifier">event</span>
583
- <span class="ruby-keyword">end</span>
494
+ <span class="ruby-identifier">event</span> = <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MetaEvent</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">meta_type</span> <span class="ruby-operator">==</span> <span class="ruby-constant">META_SEQ_NAME</span> }
495
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">event</span>
496
+ <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data</span> = <span class="ruby-identifier">name</span>
497
+ <span class="ruby-keyword">else</span>
498
+ <span class="ruby-identifier">event</span> = <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_SEQ_NAME</span>, <span class="ruby-identifier">name</span>, <span class="ruby-value">0</span>)
499
+ <span class="ruby-ivar">@events</span>[<span class="ruby-value">0</span>, <span class="ruby-value">0</span>] = <span class="ruby-identifier">event</span>
500
+ <span class="ruby-keyword">end</span>
584
501
  <span class="ruby-keyword">end</span></pre>
585
- </div><!-- name-3D-source -->
502
+ </div>
586
503
 
587
504
  </div>
588
505
 
589
506
 
590
507
 
591
508
 
592
- </div><!-- name-3D-method -->
509
+ </div>
593
510
 
594
511
 
595
512
  <div id="method-i-quantize" class="method-detail ">
@@ -597,42 +514,45 @@ href="Track.html#UNNAMED">UNNAMED</a>.</p>
597
514
  <div class="method-heading">
598
515
  <span class="method-name">quantize</span><span
599
516
  class="method-args">(length_or_note)</span>
517
+
600
518
  <span class="method-click-advice">click to toggle source</span>
519
+
601
520
  </div>
602
521
 
603
522
 
604
523
  <div class="method-description">
605
524
 
606
525
  <p>Quantize every event. length_or_note is either a length (1 = quarter, 0.25
607
- = sixteenth, 4 = whole note) or a note name ("sixteenth", "32nd", "8th
608
- triplet", "dotted quarter").</p>
526
+ = sixteenth, 4 = whole note) or a note name (sixteenth”, 32nd”, 8th
527
+ triplet”, dotted quarter).</p>
609
528
 
610
- <p>Since each event's time_from_start is modified, we call <a
529
+ <p>Since each event&#39;s time_from_start is modified, we call <a
611
530
  href="Track.html#method-i-recalc_delta_from_times">#recalc_delta_from_times</a>
612
531
  after each event quantizes itself.</p>
613
532
 
533
+
614
534
 
615
535
 
616
536
  <div class="method-source-code" id="quantize-source">
617
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 130</span>
537
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 124</span>
618
538
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">quantize</span>(<span class="ruby-identifier">length_or_note</span>)
619
- <span class="ruby-identifier">delta</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">length_or_note</span>
620
- <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
621
- <span class="ruby-ivar">@sequence</span>.<span class="ruby-identifier">note_to_delta</span>(<span class="ruby-identifier">length_or_note</span>)
622
- <span class="ruby-keyword">else</span>
623
- <span class="ruby-ivar">@sequence</span>.<span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">length_or_note</span>.<span class="ruby-identifier">to_i</span>)
624
- <span class="ruby-keyword">end</span>
625
- <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">quantize_to</span>(<span class="ruby-identifier">delta</span>) }
626
- <span class="ruby-identifier">recalc_delta_from_times</span>
539
+ <span class="ruby-identifier">delta</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">length_or_note</span>
540
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
541
+ <span class="ruby-ivar">@sequence</span>.<span class="ruby-identifier">note_to_delta</span>(<span class="ruby-identifier">length_or_note</span>)
542
+ <span class="ruby-keyword">else</span>
543
+ <span class="ruby-ivar">@sequence</span>.<span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">length_or_note</span>.<span class="ruby-identifier">to_i</span>)
544
+ <span class="ruby-keyword">end</span>
545
+ <span class="ruby-ivar">@events</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">event</span><span class="ruby-operator">|</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">quantize_to</span>(<span class="ruby-identifier">delta</span>) }
546
+ <span class="ruby-identifier">recalc_delta_from_times</span>
627
547
  <span class="ruby-keyword">end</span></pre>
628
- </div><!-- quantize-source -->
548
+ </div>
629
549
 
630
550
  </div>
631
551
 
632
552
 
633
553
 
634
554
 
635
- </div><!-- quantize-method -->
555
+ </div>
636
556
 
637
557
 
638
558
  <div id="method-i-recalc_delta_from_times" class="method-detail ">
@@ -640,7 +560,9 @@ after each event quantizes itself.</p>
640
560
  <div class="method-heading">
641
561
  <span class="method-name">recalc_delta_from_times</span><span
642
562
  class="method-args">(starting_at=0, list=@events)</span>
563
+
643
564
  <span class="method-click-advice">click to toggle source</span>
565
+
644
566
  </div>
645
567
 
646
568
 
@@ -648,29 +570,30 @@ after each event quantizes itself.</p>
648
570
 
649
571
  <p>The opposite of <a
650
572
  href="Track.html#method-i-recalc_times">#recalc_times</a>: recalculates
651
- delta_time for each event from each event's time_from_start. This is
573
+ delta_time for each event from each event&#39;s time_from_start. This is
652
574
  useful, for example, when merging two event lists. As a side-effect,
653
575
  elements from starting_at are sorted by time_from_start.</p>
654
576
 
577
+
655
578
 
656
579
 
657
580
  <div class="method-source-code" id="recalc_delta_from_times-source">
658
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 155</span>
581
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 149</span>
659
582
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">recalc_delta_from_times</span>(<span class="ruby-identifier">starting_at</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">list</span>=<span class="ruby-ivar">@events</span>)
660
- <span class="ruby-identifier">prev_time_from_start</span> = <span class="ruby-value">0</span>
661
- <span class="ruby-comment"># We need to sort the sublist. sublist.sort! does not do what we want.</span>
662
- <span class="ruby-comment"># We call mergesort instead of Array.sort because sort is not stable</span>
663
- <span class="ruby-comment"># (it can mix up the order of events that have the same start time).</span>
664
- <span class="ruby-comment"># See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.</span>
665
- <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>] = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]).<span class="ruby-identifier">mergesort</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e1</span>, <span class="ruby-identifier">e2</span> <span class="ruby-operator">|</span>
666
- <span class="ruby-identifier">e1</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">e2</span>.<span class="ruby-identifier">time_from_start</span>
667
- }
668
- <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
669
- <span class="ruby-identifier">e</span>.<span class="ruby-identifier">delta_time</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">prev_time_from_start</span>
670
- <span class="ruby-identifier">prev_time_from_start</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span>
671
- }
583
+ <span class="ruby-identifier">prev_time_from_start</span> = <span class="ruby-value">0</span>
584
+ <span class="ruby-comment"># We need to sort the sublist. sublist.sort! does not do what we want.</span>
585
+ <span class="ruby-comment"># We call mergesort instead of Array.sort because sort is not stable</span>
586
+ <span class="ruby-comment"># (it can mix up the order of events that have the same start time).</span>
587
+ <span class="ruby-comment"># See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.</span>
588
+ <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>] = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]).<span class="ruby-identifier">mergesort</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e1</span>, <span class="ruby-identifier">e2</span><span class="ruby-operator">|</span>
589
+ <span class="ruby-identifier">e1</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">e2</span>.<span class="ruby-identifier">time_from_start</span>
590
+ <span class="ruby-keyword">end</span>
591
+ <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
592
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">delta_time</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">prev_time_from_start</span>
593
+ <span class="ruby-identifier">prev_time_from_start</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span>
594
+ <span class="ruby-keyword">end</span>
672
595
  <span class="ruby-keyword">end</span></pre>
673
- </div><!-- recalc_delta_from_times-source -->
596
+ </div>
674
597
 
675
598
  </div>
676
599
 
@@ -681,7 +604,7 @@ elements from starting_at are sorted by time_from_start.</p>
681
604
 
682
605
 
683
606
 
684
- </div><!-- recalc_delta_from_times-method -->
607
+ </div>
685
608
 
686
609
 
687
610
  <div id="method-i-recalc_times" class="method-detail ">
@@ -689,7 +612,9 @@ elements from starting_at are sorted by time_from_start.</p>
689
612
  <div class="method-heading">
690
613
  <span class="method-name">recalc_times</span><span
691
614
  class="method-args">(starting_at=0, list=@events)</span>
615
+
692
616
  <span class="method-click-advice">click to toggle source</span>
617
+
693
618
  </div>
694
619
 
695
620
 
@@ -698,25 +623,26 @@ elements from starting_at are sorted by time_from_start.</p>
698
623
  <p>Recalculate start times for all events in <code>list</code> from
699
624
  starting_at to end.</p>
700
625
 
626
+
701
627
 
702
628
 
703
629
  <div class="method-source-code" id="recalc_times-source">
704
- <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 143</span>
630
+ <pre><span class="ruby-comment"># File lib/midilib/track.rb, line 137</span>
705
631
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">recalc_times</span>(<span class="ruby-identifier">starting_at</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">list</span>=<span class="ruby-ivar">@events</span>)
706
- <span class="ruby-identifier">t</span> = (<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">time_from_start</span>
707
- <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
708
- <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">delta_time</span>
709
- <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> = <span class="ruby-identifier">t</span>
710
- }
632
+ <span class="ruby-identifier">t</span> = (<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">time_from_start</span>
633
+ <span class="ruby-identifier">list</span>[<span class="ruby-identifier">starting_at</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
634
+ <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">delta_time</span>
635
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> = <span class="ruby-identifier">t</span>
636
+ <span class="ruby-keyword">end</span>
711
637
  <span class="ruby-keyword">end</span></pre>
712
- </div><!-- recalc_times-source -->
638
+ </div>
713
639
 
714
640
  </div>
715
641
 
716
642
 
717
643
 
718
644
 
719
- </div><!-- recalc_times-method -->
645
+ </div>
720
646
 
721
647
 
722
648
  <div id="method-i-sort" class="method-detail method-alias">
@@ -724,7 +650,7 @@ starting_at to end.</p>
724
650
  <div class="method-heading">
725
651
  <span class="method-name">sort</span><span
726
652
  class="method-args">(starting_at=0, list=@events)</span>
727
- <span class="method-click-advice">click to toggle source</span>
653
+
728
654
  </div>
729
655
 
730
656
 
@@ -740,6 +666,7 @@ href="Track.html#method-i-recalc_delta_from_times">#recalc_delta_from_times</a>
740
666
  sorts the events first. This method may go away in a future release, or at
741
667
  least be aliased to recalc_delta_from_times.</p>
742
668
 
669
+
743
670
 
744
671
 
745
672
  </div>
@@ -751,19 +678,18 @@ least be aliased to recalc_delta_from_times.</p>
751
678
  Alias for: <a href="Track.html#method-i-recalc_delta_from_times">recalc_delta_from_times</a>
752
679
  </div>
753
680
 
754
- </div><!-- sort-method -->
681
+ </div>
755
682
 
756
683
 
757
- </section><!-- public-instance-method-details -->
684
+ </section>
758
685
 
759
- </section><!-- 5Buntitled-5D -->
760
-
761
- </div><!-- documentation -->
686
+ </section>
687
+ </main>
762
688
 
763
689
 
764
- <footer id="validator-badges">
765
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
766
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
767
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
690
+ <footer id="validator-badges" role="contentinfo">
691
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
692
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
693
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
768
694
  </footer>
769
695