midilib 2.0.4 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +2 -1
- data/Credits +44 -2
- data/README.rdoc +13 -9
- data/Rakefile +36 -53
- data/TODO.rdoc +13 -2
- data/examples/from_scratch.rb +4 -6
- data/examples/measures_mbt.rb +11 -11
- data/examples/print_program_changes.rb +11 -11
- data/examples/reader2text.rb +191 -191
- data/examples/seq2text.rb +18 -18
- data/examples/split.rb +21 -20
- data/examples/strings.rb +15 -15
- data/examples/transpose.rb +41 -42
- data/html/MIDI/ActiveSense.html +89 -213
- data/html/MIDI/ChannelEvent.html +95 -224
- data/html/MIDI/ChannelPressure.html +103 -241
- data/html/MIDI/Clock.html +89 -213
- data/html/MIDI/Continue.html +89 -213
- data/html/MIDI/Controller.html +105 -246
- data/html/MIDI/Event.html +134 -358
- data/html/MIDI/IO/MIDIFile.html +544 -1148
- data/html/MIDI/IO/SeqReader.html +273 -577
- data/html/MIDI/IO/SeqWriter.html +233 -439
- data/html/MIDI/IO.html +48 -164
- data/html/MIDI/KeySig.html +148 -291
- data/html/MIDI/Marker.html +73 -192
- data/html/MIDI/Measure.html +104 -267
- data/html/MIDI/Measures.html +106 -259
- data/html/MIDI/MetaEvent.html +171 -352
- data/html/MIDI/NoteEvent.html +114 -276
- data/html/MIDI/NoteOff.html +95 -223
- data/html/MIDI/NoteOn.html +95 -223
- data/html/MIDI/PitchBend.html +104 -242
- data/html/MIDI/PolyPressure.html +102 -246
- data/html/MIDI/ProgramChange.html +103 -241
- data/html/MIDI/Realtime.html +96 -230
- data/html/MIDI/Sequence.html +256 -576
- data/html/MIDI/SongPointer.html +104 -242
- data/html/MIDI/SongSelect.html +103 -241
- data/html/MIDI/Start.html +89 -213
- data/html/MIDI/Stop.html +89 -213
- data/html/MIDI/SystemCommon.html +73 -192
- data/html/MIDI/SystemExclusive.html +106 -244
- data/html/MIDI/SystemReset.html +89 -213
- data/html/MIDI/Tempo.html +127 -309
- data/html/MIDI/TimeSig.html +119 -300
- data/html/MIDI/Track.html +214 -494
- data/html/MIDI/TuneRequest.html +96 -230
- data/html/MIDI/Utils.html +91 -233
- data/html/MIDI.html +142 -526
- data/html/Object.html +197 -0
- data/html/README_rdoc.html +280 -486
- data/html/TODO_rdoc.html +68 -145
- data/html/created.rid +15 -14
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -0
- 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 +230 -446
- data/html/js/darkfish.js +22 -91
- data/html/js/navigation.js +4 -41
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +41 -25
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +9 -8
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +1111 -505
- data/install.rb +53 -34
- data/lib/midilib/consts.rb +406 -408
- data/lib/midilib/event.rb +335 -306
- data/lib/midilib/info.rb +5 -7
- data/lib/midilib/io/midifile.rb +424 -452
- data/lib/midilib/io/seqreader.rb +200 -192
- data/lib/midilib/io/seqwriter.rb +151 -147
- data/lib/midilib/measure.rb +78 -80
- data/lib/midilib/mergesort.rb +39 -0
- data/lib/midilib/sequence.rb +93 -87
- data/lib/midilib/track.rb +71 -118
- data/lib/midilib/utils.rb +17 -20
- data/lib/midilib.rb +5 -5
- data/test/event_equality.rb +50 -52
- data/test/test_event.rb +120 -124
- data/test/test_io.rb +118 -38
- data/test/test_mergesort.rb +37 -0
- data/test/test_midifile.rb +6 -19
- data/test/test_sequence.rb +62 -61
- data/test/test_track.rb +126 -155
- data/test/test_varlen.rb +23 -27
- metadata +67 -62
- data/html/IO.html +0 -259
- data/html/MIDI/MIDI/MIDI/Array.html +0 -353
- data/html/MIDI/MIDI/MIDI.html +0 -204
- data/html/MIDI/MIDI.html +0 -204
- data/html/js/jquery.js +0 -18
- data/html/rdoc.css +0 -543
data/html/MIDI/Event.html
CHANGED
@@ -2,228 +2,109 @@
|
|
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 = "../";
|
11
|
+
var index_rel_prefix = "../";
|
13
12
|
</script>
|
14
13
|
|
15
|
-
<script
|
16
|
-
<script
|
17
|
-
<script
|
18
|
-
<script
|
19
|
-
<script
|
20
|
-
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
21
23
|
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
22
31
|
|
23
|
-
<
|
24
|
-
<
|
25
|
-
<nav id="home-section" class="section">
|
26
|
-
<h3 class="section-header">
|
27
|
-
<a href="../index.html">Home</a>
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
28
34
|
<a href="../table_of_contents.html#classes">Classes</a>
|
29
35
|
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
-
</
|
31
|
-
</
|
32
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
33
38
|
|
34
|
-
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
40
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
38
45
|
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>
|
46
|
+
</div>
|
44
47
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
45
53
|
|
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/event.rb
|
51
|
-
</ul>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
|
55
54
|
</div>
|
56
55
|
|
57
|
-
<div id="class-metadata">
|
58
|
-
|
59
|
-
<nav id="parent-class-section" class="section">
|
60
|
-
<h3 class="section-header">Parent</h3>
|
61
56
|
|
62
|
-
<p class="link">Object
|
63
|
-
|
64
|
-
</nav>
|
65
57
|
|
58
|
+
<div id="class-metadata">
|
66
59
|
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<nav id="method-list-section" class="section">
|
69
|
-
<h3 class="section-header">Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list">
|
72
|
-
|
73
|
-
<li><a href="#method-c-new">::new</a>
|
74
|
-
|
75
|
-
<li><a href="#method-i-3C-3D-3E">#<=></a>
|
76
|
-
|
77
|
-
<li><a href="#method-i-channel_to_s">#channel_to_s</a>
|
78
|
-
|
79
|
-
<li><a href="#method-i-data_as_bytes">#data_as_bytes</a>
|
80
60
|
|
81
|
-
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link"><a href="../Object.html">Object</a>
|
65
|
+
</div>
|
66
|
+
|
82
67
|
|
83
|
-
<li><a href="#method-i-quantize_to">#quantize_to</a>
|
84
68
|
|
85
|
-
<li><a href="#method-i-to_s">#to_s</a>
|
86
69
|
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li ><a href="#method-c-new">::new</a>
|
76
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
77
|
+
<li ><a href="#method-i-channel_to_s">#channel_to_s</a>
|
78
|
+
<li ><a href="#method-i-data_as_bytes">#data_as_bytes</a>
|
79
|
+
<li ><a href="#method-i-number_to_s">#number_to_s</a>
|
80
|
+
<li ><a href="#method-i-quantize_to">#quantize_to</a>
|
81
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
87
82
|
</ul>
|
88
|
-
</
|
83
|
+
</div>
|
89
84
|
|
90
85
|
</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
86
|
</nav>
|
104
87
|
|
105
|
-
|
106
|
-
<
|
88
|
+
<main role="main" aria-labelledby="class-MIDI::Event">
|
89
|
+
<h1 id="class-MIDI::Event" class="class">
|
90
|
+
class MIDI::Event
|
91
|
+
</h1>
|
107
92
|
|
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">
|
93
|
+
<section class="description">
|
206
94
|
|
207
|
-
<p>The abstract superclass of all <a href="MIDI.html">MIDI</a> events.</p>
|
95
|
+
<p>The abstract superclass of all <a href="../MIDI.html"><code>MIDI</code></a> events.</p>
|
208
96
|
|
209
|
-
</
|
97
|
+
</section>
|
210
98
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
99
|
<section id="5Buntitled-5D" class="documentation-section">
|
215
|
-
|
216
100
|
|
217
|
-
|
218
101
|
|
219
|
-
|
220
102
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
103
|
+
<section class="attribute-method-details" class="method-section">
|
104
|
+
<header>
|
105
|
+
<h3>Attributes</h3>
|
106
|
+
</header>
|
225
107
|
|
226
|
-
|
227
108
|
<div id="attribute-i-delta_time" class="method-detail">
|
228
109
|
<div class="method-heading attribute-method-heading">
|
229
110
|
<span class="method-name">delta_time</span><span
|
@@ -231,14 +112,9 @@
|
|
231
112
|
</div>
|
232
113
|
|
233
114
|
<div class="method-description">
|
234
|
-
|
235
|
-
<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's track's
|
237
|
-
<code>recalc_time</code> method.</p>
|
238
|
-
|
115
|
+
<p>Modifying <a href="Event.html#attribute-i-delta_time"><code>delta_time</code></a> does not affect time_from_start. You need to call the event’s track’s <code>recalc_time</code> method.</p>
|
239
116
|
</div>
|
240
117
|
</div>
|
241
|
-
|
242
118
|
<div id="attribute-i-print_channel_numbers_from_one" class="method-detail">
|
243
119
|
<div class="method-heading attribute-method-heading">
|
244
120
|
<span class="method-name">print_channel_numbers_from_one</span><span
|
@@ -246,14 +122,9 @@ not affect time_from_start. You need to call the event's track's
|
|
246
122
|
</div>
|
247
123
|
|
248
124
|
<div class="method-description">
|
249
|
-
|
250
|
-
<p>Determines if <a href="Event.html#method-i-to_s">#to_s</a> outputs <a
|
251
|
-
href="MIDI.html">MIDI</a> channel numbers from 1-16 instead of the default
|
252
|
-
0-15.</p>
|
253
|
-
|
125
|
+
<p>Determines if <a href="Event.html#method-i-to_s"><code>to_s</code></a> outputs <a href="../MIDI.html"><code>MIDI</code></a> channel numbers from 1-16 instead of the default 0-15.</p>
|
254
126
|
</div>
|
255
127
|
</div>
|
256
|
-
|
257
128
|
<div id="attribute-i-print_decimal_numbers" class="method-detail">
|
258
129
|
<div class="method-heading attribute-method-heading">
|
259
130
|
<span class="method-name">print_decimal_numbers</span><span
|
@@ -261,14 +132,9 @@ href="MIDI.html">MIDI</a> channel numbers from 1-16 instead of the default
|
|
261
132
|
</div>
|
262
133
|
|
263
134
|
<div class="method-description">
|
264
|
-
|
265
|
-
<p>Determines if <a href="Event.html#method-i-to_s">#to_s</a> outputs numbers
|
266
|
-
as hex (false, the default) or decimal # (true). Delta times are always
|
267
|
-
printed as decimal.</p>
|
268
|
-
|
135
|
+
<p>Determines if <a href="Event.html#method-i-to_s"><code>to_s</code></a> outputs numbers as hex (false, the default) or decimal # (true). Delta times are always printed as decimal.</p>
|
269
136
|
</div>
|
270
137
|
</div>
|
271
|
-
|
272
138
|
<div id="attribute-i-print_note_names" class="method-detail">
|
273
139
|
<div class="method-heading attribute-method-heading">
|
274
140
|
<span class="method-name">print_note_names</span><span
|
@@ -276,13 +142,9 @@ printed as decimal.</p>
|
|
276
142
|
</div>
|
277
143
|
|
278
144
|
<div class="method-description">
|
279
|
-
|
280
|
-
<p>Determines if <a href="Event.html#method-i-to_s">#to_s</a> outputs hex note
|
281
|
-
numbers (false, the default) or decimal note names (true).</p>
|
282
|
-
|
145
|
+
<p>Determines if <a href="Event.html#method-i-to_s"><code>to_s</code></a> outputs hex note numbers (false, the default) or decimal note names (true).</p>
|
283
146
|
</div>
|
284
147
|
</div>
|
285
|
-
|
286
148
|
<div id="attribute-i-status" class="method-detail">
|
287
149
|
<div class="method-heading attribute-method-heading">
|
288
150
|
<span class="method-name">status</span><span
|
@@ -290,14 +152,9 @@ numbers (false, the default) or decimal note names (true).</p>
|
|
290
152
|
</div>
|
291
153
|
|
292
154
|
<div class="method-description">
|
293
|
-
|
294
|
-
<p>The <a href="MIDI.html">MIDI</a> status byte. Never includes the channel,
|
295
|
-
which is held separately by <a
|
296
|
-
href="ChannelEvent.html">MIDI::ChannelEvent</a>.</p>
|
297
|
-
|
155
|
+
<p>The <a href="../MIDI.html"><code>MIDI</code></a> status byte. Never includes the channel, which is held separately by <a href="ChannelEvent.html"><code>MIDI::ChannelEvent</code></a>.</p>
|
298
156
|
</div>
|
299
157
|
</div>
|
300
|
-
|
301
158
|
<div id="attribute-i-time_from_start" class="method-detail">
|
302
159
|
<div class="method-heading attribute-method-heading">
|
303
160
|
<span class="method-name">time_from_start</span><span
|
@@ -305,269 +162,188 @@ href="ChannelEvent.html">MIDI::ChannelEvent</a>.</p>
|
|
305
162
|
</div>
|
306
163
|
|
307
164
|
<div class="method-description">
|
308
|
-
|
309
|
-
<p>The start time of this event from the beginning of the track. This value is
|
310
|
-
held here but is maintained by the track.</p>
|
311
|
-
|
165
|
+
<p>The start time of this event from the beginning of the track. This value is held here but is maintained by the track.</p>
|
312
166
|
</div>
|
313
167
|
</div>
|
314
|
-
|
315
|
-
</section><!-- attribute-method-details -->
|
316
|
-
|
168
|
+
</section>
|
317
169
|
|
318
|
-
<!-- Methods -->
|
319
|
-
|
320
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
321
|
-
<h3 class="section-header">Public Class Methods</h3>
|
322
170
|
|
323
|
-
|
171
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
172
|
+
<header>
|
173
|
+
<h3>Public Class Methods</h3>
|
174
|
+
</header>
|
175
|
+
|
324
176
|
<div id="method-c-new" class="method-detail ">
|
325
|
-
|
326
177
|
<div class="method-heading">
|
327
178
|
<span class="method-name">new</span><span
|
328
179
|
class="method-args">(status = 0, delta_time = 0)</span>
|
329
180
|
<span class="method-click-advice">click to toggle source</span>
|
330
181
|
</div>
|
331
|
-
|
332
182
|
|
333
183
|
<div class="method-description">
|
334
184
|
|
335
|
-
|
336
|
-
|
337
185
|
|
338
|
-
|
339
186
|
<div class="method-source-code" id="new-source">
|
340
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
341
|
-
<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
|
-
|
187
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 29</span>
|
188
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">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>)
|
189
|
+
<span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
|
190
|
+
<span class="ruby-ivar">@delta_time</span> = <span class="ruby-identifier">delta_time</span>
|
191
|
+
<span class="ruby-ivar">@time_from_start</span> = <span class="ruby-value">0</span> <span class="ruby-comment"># maintained by tracks</span>
|
192
|
+
<span class="ruby-ivar">@print_note_names</span> = <span class="ruby-keyword">false</span>
|
193
|
+
<span class="ruby-ivar">@print_decimal_numbers</span> = <span class="ruby-keyword">false</span>
|
194
|
+
<span class="ruby-ivar">@print_channel_numbers_from_one</span> = <span class="ruby-keyword">false</span>
|
345
195
|
<span class="ruby-keyword">end</span></pre>
|
346
|
-
</div
|
347
|
-
|
196
|
+
</div>
|
348
197
|
</div>
|
349
198
|
|
350
|
-
|
351
199
|
|
352
|
-
|
353
|
-
</div><!-- new-method -->
|
200
|
+
</div>
|
354
201
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
202
|
+
</section>
|
203
|
+
|
204
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
205
|
+
<header>
|
206
|
+
<h3>Public Instance Methods</h3>
|
207
|
+
</header>
|
360
208
|
|
361
|
-
|
362
209
|
<div id="method-i-3C-3D-3E" class="method-detail ">
|
363
|
-
|
364
210
|
<div class="method-heading">
|
365
211
|
<span class="method-name"><=></span><span
|
366
|
-
class="method-args">(
|
212
|
+
class="method-args">(other)</span>
|
367
213
|
<span class="method-click-advice">click to toggle source</span>
|
368
214
|
</div>
|
369
|
-
|
370
215
|
|
371
216
|
<div class="method-description">
|
372
|
-
|
373
|
-
<p>For sorting. Uses @<a
|
374
|
-
href="Event.html#attribute-i-time_from_start">#time_from_start</a>, which
|
375
|
-
is maintained by this event's track. I'm not sure this is necessary, since
|
376
|
-
each track has to maintain its events' time-from-start values anyway.</p>
|
377
|
-
|
217
|
+
<p>For sorting. Uses @time_from_start, which is maintained by this event’s track. I’m not sure this is necessary, since each track has to maintain its events’ time-from-start values anyway.</p>
|
378
218
|
|
379
|
-
|
380
219
|
<div class="method-source-code" id="3C-3D-3E-source">
|
381
220
|
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 59</span>
|
382
|
-
<span class="ruby-keyword">def</span> <span class="ruby-
|
383
|
-
|
221
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title"><=></span>(<span class="ruby-identifier">other</span>)
|
222
|
+
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">time_from_start</span>
|
384
223
|
<span class="ruby-keyword">end</span></pre>
|
385
|
-
</div
|
386
|
-
|
224
|
+
</div>
|
387
225
|
</div>
|
388
226
|
|
389
|
-
|
390
227
|
|
391
|
-
|
392
|
-
</div><!-- 3C-3D-3E-method -->
|
228
|
+
</div>
|
393
229
|
|
394
|
-
|
395
230
|
<div id="method-i-channel_to_s" class="method-detail ">
|
396
|
-
|
397
231
|
<div class="method-heading">
|
398
232
|
<span class="method-name">channel_to_s</span><span
|
399
233
|
class="method-args">(val)</span>
|
400
234
|
<span class="method-click-advice">click to toggle source</span>
|
401
235
|
</div>
|
402
|
-
|
403
236
|
|
404
237
|
<div class="method-description">
|
405
|
-
|
406
|
-
<p>Returns <code>val</code> as a decimal or hex string, depending upon the
|
407
|
-
value of @print_decimal_numbers.</p>
|
408
|
-
|
238
|
+
<p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.</p>
|
409
239
|
|
410
|
-
|
411
240
|
<div class="method-source-code" id="channel_to_s-source">
|
412
241
|
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 71</span>
|
413
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">channel_to_s</span>(<span class="ruby-identifier">val</span>)
|
414
|
-
|
415
|
-
|
242
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">channel_to_s</span>(<span class="ruby-identifier">val</span>)
|
243
|
+
<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>
|
244
|
+
<span class="ruby-identifier">number_to_s</span>(<span class="ruby-identifier">val</span>)
|
416
245
|
<span class="ruby-keyword">end</span></pre>
|
417
|
-
</div
|
418
|
-
|
246
|
+
</div>
|
419
247
|
</div>
|
420
248
|
|
421
|
-
|
422
249
|
|
423
|
-
|
424
|
-
</div><!-- channel_to_s-method -->
|
250
|
+
</div>
|
425
251
|
|
426
|
-
|
427
252
|
<div id="method-i-data_as_bytes" class="method-detail ">
|
428
|
-
|
429
253
|
<div class="method-heading">
|
430
254
|
<span class="method-name">data_as_bytes</span><span
|
431
255
|
class="method-args">()</span>
|
432
256
|
<span class="method-click-advice">click to toggle source</span>
|
433
257
|
</div>
|
434
|
-
|
435
258
|
|
436
259
|
<div class="method-description">
|
437
|
-
|
438
|
-
<p>Returns the raw bytes that are written to a <a href="MIDI.html">MIDI</a>
|
439
|
-
file or output to a <a href="MIDI.html">MIDI</a> stream. In MIDI::EVENT
|
440
|
-
this raises a "subclass responsibility" exception.</p>
|
441
|
-
|
260
|
+
<p>Returns the raw bytes that are written to a <a href="../MIDI.html"><code>MIDI</code></a> file or output to a <a href="../MIDI.html"><code>MIDI</code></a> stream. In MIDI::EVENT this raises a “subclass responsibility” exception.</p>
|
442
261
|
|
443
|
-
|
444
262
|
<div class="method-source-code" id="data_as_bytes-source">
|
445
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
446
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">data_as_bytes</span>
|
447
|
-
|
263
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 42</span>
|
264
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">data_as_bytes</span>
|
265
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">'subclass responsibility'</span>
|
448
266
|
<span class="ruby-keyword">end</span></pre>
|
449
|
-
</div
|
450
|
-
|
267
|
+
</div>
|
451
268
|
</div>
|
452
269
|
|
453
|
-
|
454
270
|
|
455
|
-
|
456
|
-
</div><!-- data_as_bytes-method -->
|
271
|
+
</div>
|
457
272
|
|
458
|
-
|
459
273
|
<div id="method-i-number_to_s" class="method-detail ">
|
460
|
-
|
461
274
|
<div class="method-heading">
|
462
275
|
<span class="method-name">number_to_s</span><span
|
463
276
|
class="method-args">(val)</span>
|
464
277
|
<span class="method-click-advice">click to toggle source</span>
|
465
278
|
</div>
|
466
|
-
|
467
279
|
|
468
280
|
<div class="method-description">
|
469
|
-
|
470
|
-
<p>Returns <code>val</code> as a decimal or hex string, depending upon the
|
471
|
-
value of @print_decimal_numbers.</p>
|
472
|
-
|
281
|
+
<p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.</p>
|
473
282
|
|
474
|
-
|
475
283
|
<div class="method-source-code" id="number_to_s-source">
|
476
284
|
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 65</span>
|
477
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">number_to_s</span>(<span class="ruby-identifier">val</span>)
|
478
|
-
|
285
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">number_to_s</span>(<span class="ruby-identifier">val</span>)
|
286
|
+
<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
287
|
<span class="ruby-keyword">end</span></pre>
|
480
|
-
</div
|
481
|
-
|
288
|
+
</div>
|
482
289
|
</div>
|
483
290
|
|
484
|
-
|
485
291
|
|
486
|
-
|
487
|
-
</div><!-- number_to_s-method -->
|
292
|
+
</div>
|
488
293
|
|
489
|
-
|
490
294
|
<div id="method-i-quantize_to" class="method-detail ">
|
491
|
-
|
492
295
|
<div class="method-heading">
|
493
296
|
<span class="method-name">quantize_to</span><span
|
494
297
|
class="method-args">(boundary)</span>
|
495
298
|
<span class="method-click-advice">click to toggle source</span>
|
496
299
|
</div>
|
497
|
-
|
498
300
|
|
499
301
|
<div class="method-description">
|
500
|
-
|
501
|
-
<p>Quantize this event's <a
|
502
|
-
href="Event.html#attribute-i-time_from_start">#time_from_start</a> by
|
503
|
-
moving it to the nearest multiple of <code>boundary</code>. See <a
|
504
|
-
href="Track.html#method-i-quantize">MIDI::Track#quantize</a>.
|
505
|
-
<strong>Note</strong>: does not modify the event's <a
|
506
|
-
href="Event.html#attribute-i-delta_time">#delta_time</a>, though <a
|
507
|
-
href="Track.html#method-i-quantize">MIDI::Track#quantize</a> calls
|
508
|
-
recalc_delta_from_times after it asks each event to quantize itself.</p>
|
509
|
-
|
302
|
+
<p>Quantize this event’s <a href="Event.html#attribute-i-time_from_start"><code>time_from_start</code></a> by moving it to the nearest multiple of <code>boundary</code>. See <a href="Track.html#method-i-quantize"><code>MIDI::Track#quantize</code></a>. <strong>Note</strong>: does not modify the event’s <a href="Event.html#attribute-i-delta_time"><code>delta_time</code></a>, though <a href="Track.html#method-i-quantize"><code>MIDI::Track#quantize</code></a> calls recalc_delta_from_times after it asks each event to quantize itself.</p>
|
510
303
|
|
511
|
-
|
512
304
|
<div class="method-source-code" id="quantize_to-source">
|
513
|
-
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line
|
514
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">quantize_to</span>(<span class="ruby-identifier">boundary</span>)
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">boundary</span>
|
519
|
-
<span class="ruby-keyword">end</span>
|
305
|
+
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 50</span>
|
306
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">quantize_to</span>(<span class="ruby-identifier">boundary</span>)
|
307
|
+
<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>
|
308
|
+
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">diff</span>
|
309
|
+
<span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">boundary</span> <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>
|
520
310
|
<span class="ruby-keyword">end</span></pre>
|
521
|
-
</div
|
522
|
-
|
311
|
+
</div>
|
523
312
|
</div>
|
524
313
|
|
525
|
-
|
526
314
|
|
527
|
-
|
528
|
-
</div><!-- quantize_to-method -->
|
315
|
+
</div>
|
529
316
|
|
530
|
-
|
531
317
|
<div id="method-i-to_s" class="method-detail ">
|
532
|
-
|
533
318
|
<div class="method-heading">
|
534
319
|
<span class="method-name">to_s</span><span
|
535
320
|
class="method-args">()</span>
|
536
321
|
<span class="method-click-advice">click to toggle source</span>
|
537
322
|
</div>
|
538
|
-
|
539
323
|
|
540
324
|
<div class="method-description">
|
541
325
|
|
542
|
-
|
543
|
-
|
544
326
|
|
545
|
-
|
546
327
|
<div class="method-source-code" id="to_s-source">
|
547
328
|
<pre><span class="ruby-comment"># File lib/midilib/event.rb, line 76</span>
|
548
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
549
|
-
|
329
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
330
|
+
<span class="ruby-node">"#{@delta_time}: "</span>
|
550
331
|
<span class="ruby-keyword">end</span></pre>
|
551
|
-
</div
|
552
|
-
|
332
|
+
</div>
|
553
333
|
</div>
|
554
334
|
|
555
|
-
|
556
335
|
|
557
|
-
|
558
|
-
</div><!-- to_s-method -->
|
336
|
+
</div>
|
559
337
|
|
560
|
-
|
561
|
-
</section><!-- public-instance-method-details -->
|
562
|
-
|
563
|
-
</section><!-- 5Buntitled-5D -->
|
338
|
+
</section>
|
564
339
|
|
565
|
-
</
|
340
|
+
</section>
|
341
|
+
</main>
|
566
342
|
|
567
343
|
|
568
|
-
<footer id="validator-badges">
|
569
|
-
<p><a href="
|
570
|
-
<p>Generated by <a href="https://github.
|
571
|
-
<p>
|
344
|
+
<footer id="validator-badges" role="contentinfo">
|
345
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
346
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
347
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
572
348
|
</footer>
|
573
349
|
|