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/Event.html
CHANGED
@@ -2,211 +2,104 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta charset="UTF-8">
|
6
6
|
|
7
7
|
<title>class MIDI::Event - 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
|
+
|
19
|
+
|
21
20
|
|
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>
|
22
28
|
|
23
|
-
<
|
24
|
-
<
|
25
|
-
<nav id="home-section" class="section">
|
26
|
-
<h3 class="section-header">
|
27
|
-
<a href="../index.html">Home</a>
|
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>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
44
|
-
|
43
|
+
</div>
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
65
|
|
66
|
+
|
67
67
|
<!-- Method Quickref -->
|
68
|
-
<
|
69
|
-
<h3
|
68
|
+
<div id="method-list-section" class="nav-section">
|
69
|
+
<h3>Methods</h3>
|
70
70
|
|
71
|
-
<ul class="link-list">
|
71
|
+
<ul class="link-list" role="directory">
|
72
72
|
|
73
|
-
<li><a href="#method-c-new">::new</a>
|
73
|
+
<li ><a href="#method-c-new">::new</a>
|
74
74
|
|
75
|
-
<li><a href="#method-i-3C-3D-3E">#<=></a>
|
75
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
76
76
|
|
77
|
-
<li><a href="#method-i-channel_to_s">#channel_to_s</a>
|
77
|
+
<li ><a href="#method-i-channel_to_s">#channel_to_s</a>
|
78
78
|
|
79
|
-
<li><a href="#method-i-data_as_bytes">#data_as_bytes</a>
|
79
|
+
<li ><a href="#method-i-data_as_bytes">#data_as_bytes</a>
|
80
80
|
|
81
|
-
<li><a href="#method-i-number_to_s">#number_to_s</a>
|
81
|
+
<li ><a href="#method-i-number_to_s">#number_to_s</a>
|
82
82
|
|
83
|
-
<li><a href="#method-i-quantize_to">#quantize_to</a>
|
83
|
+
<li ><a href="#method-i-quantize_to">#quantize_to</a>
|
84
84
|
|
85
|
-
<li><a href="#method-i-to_s">#to_s</a>
|
85
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
86
86
|
|
87
87
|
</ul>
|
88
|
-
</
|
88
|
+
</div>
|
89
89
|
|
90
90
|
</div>
|
91
|
-
|
92
|
-
<div id="project-metadata">
|
93
|
-
<nav id="fileindex-section" class="section project-section">
|
94
|
-
<h3 class="section-header">Pages</h3>
|
95
|
-
|
96
|
-
<ul>
|
97
|
-
|
98
|
-
<li class="file"><a href="../README_rdoc.html">README</a>
|
99
|
-
|
100
|
-
<li class="file"><a href="../TODO_rdoc.html">TODO</a>
|
101
|
-
|
102
|
-
</ul>
|
103
91
|
</nav>
|
104
92
|
|
105
|
-
|
106
|
-
<
|
93
|
+
<main role="main" aria-labelledby="class-MIDI::Event">
|
94
|
+
<h1 id="class-MIDI::Event" class="class">
|
95
|
+
class MIDI::Event
|
96
|
+
</h1>
|
107
97
|
|
108
|
-
<
|
109
|
-
|
110
|
-
<li><a href="../MIDI.html">MIDI</a>
|
111
|
-
|
112
|
-
<li><a href="../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
|
113
|
-
|
114
|
-
<li><a href="../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
|
115
|
-
|
116
|
-
<li><a href="../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
|
117
|
-
|
118
|
-
<li><a href="../MIDI/Clock.html">MIDI::Clock</a>
|
119
|
-
|
120
|
-
<li><a href="../MIDI/Continue.html">MIDI::Continue</a>
|
121
|
-
|
122
|
-
<li><a href="../MIDI/Controller.html">MIDI::Controller</a>
|
123
|
-
|
124
|
-
<li><a href="../MIDI/Event.html">MIDI::Event</a>
|
125
|
-
|
126
|
-
<li><a href="../MIDI/IO.html">MIDI::IO</a>
|
127
|
-
|
128
|
-
<li><a href="../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
|
129
|
-
|
130
|
-
<li><a href="../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
|
131
|
-
|
132
|
-
<li><a href="../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
|
133
|
-
|
134
|
-
<li><a href="../MIDI/KeySig.html">MIDI::KeySig</a>
|
135
|
-
|
136
|
-
<li><a href="../MIDI/MIDI.html">MIDI::MIDI</a>
|
137
|
-
|
138
|
-
<li><a href="../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
|
139
|
-
|
140
|
-
<li><a href="../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
|
141
|
-
|
142
|
-
<li><a href="../MIDI/Marker.html">MIDI::Marker</a>
|
143
|
-
|
144
|
-
<li><a href="../MIDI/Measure.html">MIDI::Measure</a>
|
145
|
-
|
146
|
-
<li><a href="../MIDI/Measures.html">MIDI::Measures</a>
|
147
|
-
|
148
|
-
<li><a href="../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
|
149
|
-
|
150
|
-
<li><a href="../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
|
151
|
-
|
152
|
-
<li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a>
|
153
|
-
|
154
|
-
<li><a href="../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
|
155
|
-
|
156
|
-
<li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a>
|
157
|
-
|
158
|
-
<li><a href="../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
|
159
|
-
|
160
|
-
<li><a href="../MIDI/PitchBend.html">MIDI::PitchBend</a>
|
161
|
-
|
162
|
-
<li><a href="../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
|
163
|
-
|
164
|
-
<li><a href="../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
|
165
|
-
|
166
|
-
<li><a href="../MIDI/Realtime.html">MIDI::Realtime</a>
|
167
|
-
|
168
|
-
<li><a href="../MIDI/Sequence.html">MIDI::Sequence</a>
|
169
|
-
|
170
|
-
<li><a href="../MIDI/SongPointer.html">MIDI::SongPointer</a>
|
171
|
-
|
172
|
-
<li><a href="../MIDI/SongSelect.html">MIDI::SongSelect</a>
|
173
|
-
|
174
|
-
<li><a href="../MIDI/Start.html">MIDI::Start</a>
|
175
|
-
|
176
|
-
<li><a href="../MIDI/Stop.html">MIDI::Stop</a>
|
177
|
-
|
178
|
-
<li><a href="../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
|
179
|
-
|
180
|
-
<li><a href="../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
|
181
|
-
|
182
|
-
<li><a href="../MIDI/SystemReset.html">MIDI::SystemReset</a>
|
183
|
-
|
184
|
-
<li><a href="../MIDI/Tempo.html">MIDI::Tempo</a>
|
185
|
-
|
186
|
-
<li><a href="../MIDI/TimeSig.html">MIDI::TimeSig</a>
|
187
|
-
|
188
|
-
<li><a href="../MIDI/Track.html">MIDI::Track</a>
|
189
|
-
|
190
|
-
<li><a href="../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
|
191
|
-
|
192
|
-
<li><a href="../MIDI/Utils.html">MIDI::Utils</a>
|
193
|
-
|
194
|
-
<li><a href="../IO.html">IO</a>
|
195
|
-
|
196
|
-
</ul>
|
197
|
-
</nav>
|
198
|
-
|
199
|
-
</div>
|
200
|
-
</nav>
|
201
|
-
|
202
|
-
<div id="documentation">
|
203
|
-
<h1 class="class">class MIDI::Event</h1>
|
204
|
-
|
205
|
-
<div id="description" class="description">
|
98
|
+
<section class="description">
|
206
99
|
|
207
100
|
<p>The abstract superclass of all <a href="MIDI.html">MIDI</a> events.</p>
|
208
101
|
|
209
|
-
</
|
102
|
+
</section>
|
210
103
|
|
211
104
|
|
212
105
|
|
@@ -219,9 +112,10 @@
|
|
219
112
|
|
220
113
|
|
221
114
|
|
222
|
-
|
223
|
-
|
224
|
-
|
115
|
+
<section class="attribute-method-details" class="method-section">
|
116
|
+
<header>
|
117
|
+
<h3>Attributes</h3>
|
118
|
+
</header>
|
225
119
|
|
226
120
|
|
227
121
|
<div id="attribute-i-delta_time" class="method-detail">
|
@@ -233,7 +127,7 @@
|
|
233
127
|
<div class="method-description">
|
234
128
|
|
235
129
|
<p>Modifying <a href="Event.html#attribute-i-delta_time">#delta_time</a> does
|
236
|
-
not affect time_from_start. You need to call the event
|
130
|
+
not affect time_from_start. You need to call the event's track's
|
237
131
|
<code>recalc_time</code> method.</p>
|
238
132
|
|
239
133
|
</div>
|
@@ -312,13 +206,14 @@ held here but is maintained by the track.</p>
|
|
312
206
|
</div>
|
313
207
|
</div>
|
314
208
|
|
315
|
-
</section
|
209
|
+
</section>
|
316
210
|
|
317
211
|
|
318
|
-
<!-- Methods -->
|
319
212
|
|
320
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section
|
321
|
-
|
213
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
214
|
+
<header>
|
215
|
+
<h3>Public Class Methods</h3>
|
216
|
+
</header>
|
322
217
|
|
323
218
|
|
324
219
|
<div id="method-c-new" class="method-detail ">
|
@@ -326,7 +221,9 @@ held here but is maintained by the track.</p>
|
|
326
221
|
<div class="method-heading">
|
327
222
|
<span class="method-name">new</span><span
|
328
223
|
class="method-args">(status = 0, delta_time = 0)</span>
|
224
|
+
|
329
225
|
<span class="method-click-advice">click to toggle source</span>
|
226
|
+
|
330
227
|
</div>
|
331
228
|
|
332
229
|
|
@@ -334,29 +231,32 @@ held here but is maintained by the track.</p>
|
|
334
231
|
|
335
232
|
|
336
233
|
|
234
|
+
|
337
235
|
|
338
236
|
|
339
237
|
<div class="method-source-code" id="new-source">
|
340
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
238
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 31</span>
|
341
239
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">status</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">delta_time</span> = <span class="ruby-value">0</span>)
|
342
|
-
|
343
|
-
|
344
|
-
|
240
|
+
<span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
|
241
|
+
<span class="ruby-ivar">@delta_time</span> = <span class="ruby-identifier">delta_time</span>
|
242
|
+
<span class="ruby-ivar">@time_from_start</span> = <span class="ruby-value">0</span> <span class="ruby-comment"># maintained by tracks</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-3C-3D-3E" class="method-detail ">
|
@@ -364,32 +264,34 @@ held here but is maintained by the track.</p>
|
|
364
264
|
<div class="method-heading">
|
365
265
|
<span class="method-name"><=></span><span
|
366
266
|
class="method-args">(an_event)</span>
|
267
|
+
|
367
268
|
<span class="method-click-advice">click to toggle source</span>
|
269
|
+
|
368
270
|
</div>
|
369
271
|
|
370
272
|
|
371
273
|
<div class="method-description">
|
372
274
|
|
373
|
-
<p>For sorting. Uses
|
374
|
-
|
375
|
-
|
376
|
-
|
275
|
+
<p>For sorting. Uses @time_from_start, which is maintained by this event's
|
276
|
+
track. I'm not sure this is necessary, since each track has to maintain
|
277
|
+
its events' time-from-start values anyway.</p>
|
278
|
+
|
377
279
|
|
378
280
|
|
379
281
|
|
380
282
|
<div class="method-source-code" id="3C-3D-3E-source">
|
381
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
283
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 60</span>
|
382
284
|
<span class="ruby-keyword">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">an_event</span>)
|
383
|
-
|
285
|
+
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">an_event</span>.<span class="ruby-identifier">time_from_start</span>
|
384
286
|
<span class="ruby-keyword">end</span></pre>
|
385
|
-
</div
|
287
|
+
</div>
|
386
288
|
|
387
289
|
</div>
|
388
290
|
|
389
291
|
|
390
292
|
|
391
293
|
|
392
|
-
</div
|
294
|
+
</div>
|
393
295
|
|
394
296
|
|
395
297
|
<div id="method-i-channel_to_s" class="method-detail ">
|
@@ -397,7 +299,9 @@ each track has to maintain its events' time-from-start values anyway.</p>
|
|
397
299
|
<div class="method-heading">
|
398
300
|
<span class="method-name">channel_to_s</span><span
|
399
301
|
class="method-args">(val)</span>
|
302
|
+
|
400
303
|
<span class="method-click-advice">click to toggle source</span>
|
304
|
+
|
401
305
|
</div>
|
402
306
|
|
403
307
|
|
@@ -406,22 +310,23 @@ each track has to maintain its events' time-from-start values anyway.</p>
|
|
406
310
|
<p>Returns <code>val</code> as a decimal or hex string, depending upon the
|
407
311
|
value of @print_decimal_numbers.</p>
|
408
312
|
|
313
|
+
|
409
314
|
|
410
315
|
|
411
316
|
<div class="method-source-code" id="channel_to_s-source">
|
412
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
317
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 72</span>
|
413
318
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">channel_to_s</span>(<span class="ruby-identifier">val</span>)
|
414
|
-
|
415
|
-
|
319
|
+
<span class="ruby-identifier">val</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@print_channel_numbers_from_one</span>
|
320
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">number_to_s</span>(<span class="ruby-identifier">val</span>)
|
416
321
|
<span class="ruby-keyword">end</span></pre>
|
417
|
-
</div
|
322
|
+
</div>
|
418
323
|
|
419
324
|
</div>
|
420
325
|
|
421
326
|
|
422
327
|
|
423
328
|
|
424
|
-
</div
|
329
|
+
</div>
|
425
330
|
|
426
331
|
|
427
332
|
<div id="method-i-data_as_bytes" class="method-detail ">
|
@@ -429,7 +334,9 @@ value of @print_decimal_numbers.</p>
|
|
429
334
|
<div class="method-heading">
|
430
335
|
<span class="method-name">data_as_bytes</span><span
|
431
336
|
class="method-args">()</span>
|
337
|
+
|
432
338
|
<span class="method-click-advice">click to toggle source</span>
|
339
|
+
|
433
340
|
</div>
|
434
341
|
|
435
342
|
|
@@ -437,23 +344,24 @@ value of @print_decimal_numbers.</p>
|
|
437
344
|
|
438
345
|
<p>Returns the raw bytes that are written to a <a href="MIDI.html">MIDI</a>
|
439
346
|
file or output to a <a href="MIDI.html">MIDI</a> stream. In MIDI::EVENT
|
440
|
-
this raises a
|
347
|
+
this raises a “subclass responsibility” exception.</p>
|
348
|
+
|
441
349
|
|
442
350
|
|
443
351
|
|
444
352
|
<div class="method-source-code" id="data_as_bytes-source">
|
445
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
353
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 41</span>
|
446
354
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">data_as_bytes</span>
|
447
|
-
|
355
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"subclass responsibility"</span>
|
448
356
|
<span class="ruby-keyword">end</span></pre>
|
449
|
-
</div
|
357
|
+
</div>
|
450
358
|
|
451
359
|
</div>
|
452
360
|
|
453
361
|
|
454
362
|
|
455
363
|
|
456
|
-
</div
|
364
|
+
</div>
|
457
365
|
|
458
366
|
|
459
367
|
<div id="method-i-number_to_s" class="method-detail ">
|
@@ -461,7 +369,9 @@ this raises a "subclass responsibility" exception.</p>
|
|
461
369
|
<div class="method-heading">
|
462
370
|
<span class="method-name">number_to_s</span><span
|
463
371
|
class="method-args">(val)</span>
|
372
|
+
|
464
373
|
<span class="method-click-advice">click to toggle source</span>
|
374
|
+
|
465
375
|
</div>
|
466
376
|
|
467
377
|
|
@@ -470,21 +380,22 @@ this raises a "subclass responsibility" exception.</p>
|
|
470
380
|
<p>Returns <code>val</code> as a decimal or hex string, depending upon the
|
471
381
|
value of @print_decimal_numbers.</p>
|
472
382
|
|
383
|
+
|
473
384
|
|
474
385
|
|
475
386
|
<div class="method-source-code" id="number_to_s-source">
|
476
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
387
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 66</span>
|
477
388
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">number_to_s</span>(<span class="ruby-identifier">val</span>)
|
478
|
-
|
389
|
+
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@print_decimal_numbers</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> (<span class="ruby-string">'%02x'</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span>)
|
479
390
|
<span class="ruby-keyword">end</span></pre>
|
480
|
-
</div
|
391
|
+
</div>
|
481
392
|
|
482
393
|
</div>
|
483
394
|
|
484
395
|
|
485
396
|
|
486
397
|
|
487
|
-
</div
|
398
|
+
</div>
|
488
399
|
|
489
400
|
|
490
401
|
<div id="method-i-quantize_to" class="method-detail ">
|
@@ -492,40 +403,43 @@ value of @print_decimal_numbers.</p>
|
|
492
403
|
<div class="method-heading">
|
493
404
|
<span class="method-name">quantize_to</span><span
|
494
405
|
class="method-args">(boundary)</span>
|
406
|
+
|
495
407
|
<span class="method-click-advice">click to toggle source</span>
|
408
|
+
|
496
409
|
</div>
|
497
410
|
|
498
411
|
|
499
412
|
<div class="method-description">
|
500
413
|
|
501
|
-
<p>Quantize this event
|
414
|
+
<p>Quantize this event's <a
|
502
415
|
href="Event.html#attribute-i-time_from_start">#time_from_start</a> by
|
503
416
|
moving it to the nearest multiple of <code>boundary</code>. See <a
|
504
417
|
href="Track.html#method-i-quantize">MIDI::Track#quantize</a>.
|
505
|
-
<strong>Note</strong>: does not modify the event
|
418
|
+
<strong>Note</strong>: does not modify the event's <a
|
506
419
|
href="Event.html#attribute-i-delta_time">#delta_time</a>, though <a
|
507
420
|
href="Track.html#method-i-quantize">MIDI::Track#quantize</a> calls
|
508
421
|
recalc_delta_from_times after it asks each event to quantize itself.</p>
|
509
422
|
|
423
|
+
|
510
424
|
|
511
425
|
|
512
426
|
<div class="method-source-code" id="quantize_to-source">
|
513
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
427
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 49</span>
|
514
428
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">quantize_to</span>(<span class="ruby-identifier">boundary</span>)
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
429
|
+
<span class="ruby-identifier">diff</span> = <span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">boundary</span>
|
430
|
+
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">diff</span>
|
431
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">diff</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">boundary</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>
|
432
|
+
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">boundary</span>
|
433
|
+
<span class="ruby-keyword">end</span>
|
520
434
|
<span class="ruby-keyword">end</span></pre>
|
521
|
-
</div
|
435
|
+
</div>
|
522
436
|
|
523
437
|
</div>
|
524
438
|
|
525
439
|
|
526
440
|
|
527
441
|
|
528
|
-
</div
|
442
|
+
</div>
|
529
443
|
|
530
444
|
|
531
445
|
<div id="method-i-to_s" class="method-detail ">
|
@@ -533,7 +447,9 @@ recalc_delta_from_times after it asks each event to quantize itself.</p>
|
|
533
447
|
<div class="method-heading">
|
534
448
|
<span class="method-name">to_s</span><span
|
535
449
|
class="method-args">()</span>
|
450
|
+
|
536
451
|
<span class="method-click-advice">click to toggle source</span>
|
452
|
+
|
537
453
|
</div>
|
538
454
|
|
539
455
|
|
@@ -541,33 +457,33 @@ recalc_delta_from_times after it asks each event to quantize itself.</p>
|
|
541
457
|
|
542
458
|
|
543
459
|
|
460
|
+
|
544
461
|
|
545
462
|
|
546
463
|
<div class="method-source-code" id="to_s-source">
|
547
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
464
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 77</span>
|
548
465
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
549
|
-
|
466
|
+
<span class="ruby-node">"#{@delta_time}: "</span>
|
550
467
|
<span class="ruby-keyword">end</span></pre>
|
551
|
-
</div
|
468
|
+
</div>
|
552
469
|
|
553
470
|
</div>
|
554
471
|
|
555
472
|
|
556
473
|
|
557
474
|
|
558
|
-
</div
|
475
|
+
</div>
|
559
476
|
|
560
477
|
|
561
|
-
</section
|
478
|
+
</section>
|
562
479
|
|
563
|
-
</section
|
564
|
-
|
565
|
-
</div><!-- documentation -->
|
480
|
+
</section>
|
481
|
+
</main>
|
566
482
|
|
567
483
|
|
568
|
-
<footer id="validator-badges">
|
569
|
-
<p><a href="http://validator.w3.org/check/referer">
|
570
|
-
<p>Generated by <a href="
|
571
|
-
<p>
|
484
|
+
<footer id="validator-badges" role="contentinfo">
|
485
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
486
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
487
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
572
488
|
</footer>
|
573
489
|
|