midilib 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/html/MIDI/Track.html
CHANGED
@@ -2,70 +2,68 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
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
|
16
|
-
<script
|
17
|
-
|
18
|
-
<
|
19
|
-
<
|
20
|
-
|
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
|
25
|
-
<
|
26
|
-
|
27
|
-
|
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
|
-
</
|
31
|
-
</
|
32
|
-
|
33
|
+
</div>
|
34
|
+
</div>
|
33
35
|
|
34
|
-
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
37
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
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
|
-
</
|
40
|
-
</form>
|
43
|
+
</div>
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
<
|
60
|
-
<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
|
-
</
|
63
|
+
</div>
|
65
64
|
|
66
|
-
|
67
|
-
<
|
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
|
-
</
|
75
|
+
</div>
|
78
76
|
|
77
|
+
|
79
78
|
<!-- Method Quickref -->
|
80
|
-
<
|
81
|
-
<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
|
-
</
|
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
|
-
|
128
|
-
<
|
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
|
-
<
|
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
|
-
</
|
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
|
-
|
254
|
-
|
255
|
-
|
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
|
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
|
-
|
269
|
-
|
270
|
-
|
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
|
206
|
+
</section>
|
313
207
|
|
314
208
|
|
315
|
-
<!-- Methods -->
|
316
209
|
|
317
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section
|
318
|
-
|
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
|
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
|
-
|
340
|
-
|
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
|
-
|
343
|
-
|
344
|
-
|
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
|
244
|
+
</div>
|
347
245
|
|
348
246
|
</div>
|
349
247
|
|
350
248
|
|
351
249
|
|
352
250
|
|
353
|
-
</div
|
251
|
+
</div>
|
354
252
|
|
355
253
|
|
356
|
-
</section
|
254
|
+
</section>
|
357
255
|
|
358
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section
|
359
|
-
|
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
|
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
|
-
|
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
|
285
|
+
</div>
|
383
286
|
|
384
287
|
</div>
|
385
288
|
|
386
289
|
|
387
290
|
|
388
291
|
|
389
|
-
</div
|
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
|
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
|
-
|
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
|
318
|
+
</div>
|
413
319
|
|
414
320
|
</div>
|
415
321
|
|
416
322
|
|
417
323
|
|
418
324
|
|
419
|
-
</div
|
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
|
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
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
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
|
356
|
+
</div>
|
448
357
|
|
449
358
|
</div>
|
450
359
|
|
451
360
|
|
452
361
|
|
453
362
|
|
454
|
-
</div
|
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
|
469
|
-
time_from_start values are correct so you don
|
470
|
-
recalc_times.</p>
|
379
|
+
<p>Merges an array of events into our event list. After merging, the
|
380
|
+
events' time_from_start values are correct so you don'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
|
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
|
-
|
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
|
391
|
+
</div>
|
480
392
|
|
481
393
|
</div>
|
482
394
|
|
483
395
|
|
484
396
|
|
485
397
|
|
486
|
-
</div
|
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
|
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
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
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
|
428
|
+
</div>
|
514
429
|
|
515
430
|
</div>
|
516
431
|
|
517
432
|
|
518
433
|
|
519
434
|
|
520
|
-
</div
|
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
|
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
|
-
|
543
|
-
|
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">&&</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
|
463
|
+
</div>
|
548
464
|
|
549
465
|
</div>
|
550
466
|
|
551
467
|
|
552
468
|
|
553
469
|
|
554
|
-
</div
|
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
|
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
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
<span class="ruby-
|
581
|
-
|
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">&&</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
|
502
|
+
</div>
|
586
503
|
|
587
504
|
</div>
|
588
505
|
|
589
506
|
|
590
507
|
|
591
508
|
|
592
|
-
</div
|
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 (
|
608
|
-
triplet
|
526
|
+
= sixteenth, 4 = whole note) or a note name (“sixteenth”, “32nd”, “8th
|
527
|
+
triplet”, “dotted quarter”).</p>
|
609
528
|
|
610
|
-
<p>Since each event
|
529
|
+
<p>Since each event'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
|
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
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
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
|
548
|
+
</div>
|
629
549
|
|
630
550
|
</div>
|
631
551
|
|
632
552
|
|
633
553
|
|
634
554
|
|
635
|
-
</div
|
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
|
573
|
+
delta_time for each event from each event'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
|
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
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
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"><=></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
|
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
|
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
|
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
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
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
|
638
|
+
</div>
|
713
639
|
|
714
640
|
</div>
|
715
641
|
|
716
642
|
|
717
643
|
|
718
644
|
|
719
|
-
</div
|
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
|
-
|
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
|
681
|
+
</div>
|
755
682
|
|
756
683
|
|
757
|
-
</section
|
684
|
+
</section>
|
758
685
|
|
759
|
-
</section
|
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">
|
766
|
-
<p>Generated by <a href="
|
767
|
-
<p>
|
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
|
|