midilib 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Credits +5 -0
  3. data/html/MIDI/ActiveSense.html +171 -0
  4. data/html/MIDI/ChannelEvent.html +190 -0
  5. data/html/MIDI/ChannelPressure.html +212 -0
  6. data/html/MIDI/Clock.html +171 -0
  7. data/html/MIDI/Continue.html +171 -0
  8. data/html/MIDI/Controller.html +224 -0
  9. data/html/MIDI/Event.html +349 -0
  10. data/html/MIDI/IO/MIDIFile.html +1392 -0
  11. data/html/MIDI/IO/SeqReader.html +642 -0
  12. data/html/MIDI/IO/SeqWriter.html +442 -0
  13. data/html/MIDI/IO.html +91 -0
  14. data/html/MIDI/KeySig.html +292 -0
  15. data/html/MIDI/Marker.html +138 -0
  16. data/html/MIDI/Measure.html +260 -0
  17. data/html/MIDI/Measures.html +222 -0
  18. data/html/MIDI/MetaEvent.html +353 -0
  19. data/html/MIDI/NoteEvent.html +255 -0
  20. data/html/MIDI/NoteOff.html +188 -0
  21. data/html/MIDI/NoteOn.html +188 -0
  22. data/html/MIDI/PitchBend.html +213 -0
  23. data/html/MIDI/PolyPressure.html +216 -0
  24. data/html/MIDI/ProgramChange.html +212 -0
  25. data/html/MIDI/Realtime.html +194 -0
  26. data/html/MIDI/Sequence.html +641 -0
  27. data/html/MIDI/SongPointer.html +213 -0
  28. data/html/MIDI/SongSelect.html +212 -0
  29. data/html/MIDI/Start.html +171 -0
  30. data/html/MIDI/Stop.html +171 -0
  31. data/html/MIDI/SystemCommon.html +138 -0
  32. data/html/MIDI/SystemExclusive.html +215 -0
  33. data/html/MIDI/SystemReset.html +171 -0
  34. data/html/MIDI/Tempo.html +292 -0
  35. data/html/MIDI/TimeSig.html +286 -0
  36. data/html/MIDI/Track.html +489 -0
  37. data/html/MIDI/TuneRequest.html +194 -0
  38. data/html/MIDI/Utils.html +178 -0
  39. data/html/MIDI.html +281 -0
  40. data/html/Object.html +197 -0
  41. data/html/README_rdoc.html +545 -0
  42. data/html/TODO_rdoc.html +123 -0
  43. data/html/created.rid +15 -0
  44. data/html/css/fonts.css +167 -0
  45. data/html/css/rdoc.css +639 -0
  46. data/html/fonts/Lato-Light.ttf +0 -0
  47. data/html/fonts/Lato-LightItalic.ttf +0 -0
  48. data/html/fonts/Lato-Regular.ttf +0 -0
  49. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/html/images/add.png +0 -0
  53. data/html/images/arrow_up.png +0 -0
  54. data/html/images/brick.png +0 -0
  55. data/html/images/brick_link.png +0 -0
  56. data/html/images/bug.png +0 -0
  57. data/html/images/bullet_black.png +0 -0
  58. data/html/images/bullet_toggle_minus.png +0 -0
  59. data/html/images/bullet_toggle_plus.png +0 -0
  60. data/html/images/date.png +0 -0
  61. data/html/images/delete.png +0 -0
  62. data/html/images/find.png +0 -0
  63. data/html/images/loadingAnimation.gif +0 -0
  64. data/html/images/macFFBgHack.png +0 -0
  65. data/html/images/package.png +0 -0
  66. data/html/images/page_green.png +0 -0
  67. data/html/images/page_white_text.png +0 -0
  68. data/html/images/page_white_width.png +0 -0
  69. data/html/images/plugin.png +0 -0
  70. data/html/images/ruby.png +0 -0
  71. data/html/images/tag_blue.png +0 -0
  72. data/html/images/tag_green.png +0 -0
  73. data/html/images/transparent.png +0 -0
  74. data/html/images/wrench.png +0 -0
  75. data/html/images/wrench_orange.png +0 -0
  76. data/html/images/zoom.png +0 -0
  77. data/html/index.html +534 -0
  78. data/html/js/darkfish.js +84 -0
  79. data/html/js/navigation.js +105 -0
  80. data/html/js/navigation.js.gz +0 -0
  81. data/html/js/search.js +110 -0
  82. data/html/js/search_index.js +1 -0
  83. data/html/js/search_index.js.gz +0 -0
  84. data/html/js/searcher.js +229 -0
  85. data/html/js/searcher.js.gz +0 -0
  86. data/html/table_of_contents.html +1258 -0
  87. data/lib/midilib/info.rb +2 -2
  88. data/lib/midilib/io/seqreader.rb +18 -5
  89. data/test/test_io.rb +18 -5
  90. metadata +85 -1
@@ -0,0 +1,642 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class MIDI::IO::SeqReader - midilib</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../../";
11
+ var index_rel_prefix = "../../";
12
+ </script>
13
+
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
+
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>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="../../table_of_contents.html#pages">Pages</a>
34
+ <a href="../../table_of_contents.html#classes">Classes</a>
35
+ <a href="../../table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+ <div id="search-section" role="search" class="project-section initially-hidden">
40
+ <form action="#" method="get" accept-charset="utf-8">
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"
45
+ title="Type to search, Up and Down to navigate, Enter to load">
46
+ </div>
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>
53
+
54
+ </div>
55
+
56
+
57
+
58
+ <div id="class-metadata">
59
+
60
+
61
+ <div id="parent-class-section" class="nav-section">
62
+ <h3>Parent</h3>
63
+
64
+ <p class="link"><a href="MIDIFile.html">MIDI::IO::MIDIFile</a>
65
+ </div>
66
+
67
+
68
+
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 class="calls-super" ><a href="#method-c-new">::new</a>
76
+ <li ><a href="#method-i-chan_pressure">#chan_pressure</a>
77
+ <li ><a href="#method-i-controller">#controller</a>
78
+ <li ><a href="#method-i-end_track">#end_track</a>
79
+ <li ><a href="#method-i-header">#header</a>
80
+ <li ><a href="#method-i-key_signature">#key_signature</a>
81
+ <li ><a href="#method-i-make_note_off">#make_note_off</a>
82
+ <li ><a href="#method-i-meta_misc">#meta_misc</a>
83
+ <li ><a href="#method-i-note_off">#note_off</a>
84
+ <li ><a href="#method-i-note_on">#note_on</a>
85
+ <li ><a href="#method-i-pitch_bend">#pitch_bend</a>
86
+ <li ><a href="#method-i-pressure">#pressure</a>
87
+ <li ><a href="#method-i-program">#program</a>
88
+ <li ><a href="#method-i-start_track">#start_track</a>
89
+ <li ><a href="#method-i-sysex">#sysex</a>
90
+ <li ><a href="#method-i-tempo">#tempo</a>
91
+ <li ><a href="#method-i-text">#text</a>
92
+ <li ><a href="#method-i-time_signature">#time_signature</a>
93
+ <li ><a href="#method-i-track_uses_channel">#track_uses_channel</a>
94
+ </ul>
95
+ </div>
96
+
97
+ </div>
98
+ </nav>
99
+
100
+ <main role="main" aria-labelledby="class-MIDI::IO::SeqReader">
101
+ <h1 id="class-MIDI::IO::SeqReader" class="class">
102
+ class MIDI::IO::SeqReader
103
+ </h1>
104
+
105
+ <section class="description">
106
+
107
+ <p>Reads <a href="../../MIDI.html"><code>MIDI</code></a> files. As a subclass of <a href="MIDIFile.html"><code>MIDIFile</code></a>, this class implements the callback methods for each <a href="../../MIDI.html"><code>MIDI</code></a> event and use them to build <a href="../Track.html"><code>Track</code></a> and <a href="../Event.html"><code>Event</code></a> objects and give the tracks to a <a href="../Sequence.html"><code>Sequence</code></a>.</p>
108
+
109
+ <p>We append new events to the end of a track’s event list, bypassing a call to <a href="../Track.html"><code>Track</code></a>.#add. This means that we must call <a href="../Track.html#method-i-recalc_times"><code>Track.recalc_times</code></a> at the end of the track so it can update each event with its time from the track’s start (see <a href="SeqReader.html#method-i-end_track"><code>end_track</code></a> below).</p>
110
+
111
+ <p>META_TRACK_END events are not added to tracks. This way, we don’t have to worry about making sure the last event is always a track end event. We rely on the <a href="SeqWriter.html"><code>SeqWriter</code></a> to append a META_TRACK_END event to each track when it is output.</p>
112
+
113
+ </section>
114
+
115
+ <section id="5Buntitled-5D" class="documentation-section">
116
+
117
+
118
+
119
+
120
+
121
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
122
+ <header>
123
+ <h3>Public Class Methods</h3>
124
+ </header>
125
+
126
+ <div id="method-c-new" class="method-detail ">
127
+ <div class="method-heading">
128
+ <span class="method-name">new</span><span
129
+ class="method-args">(seq) { |track, num_tracks, index| ... }</span>
130
+ <span class="method-click-advice">click to toggle source</span>
131
+ </div>
132
+
133
+ <div class="method-description">
134
+ <p>The optional &amp;block is called once at the start of the file and again at the end of each track. There are three arguments to the block: the track, the track number (1 through <em>n</em>), and the total number of tracks.</p>
135
+ <div class="method-calls-super">
136
+ Calls superclass method
137
+ <a href="MIDIFile.html#method-c-new"><code>MIDI::IO::MIDIFile::new</code></a>
138
+ </div>
139
+
140
+ <div class="method-source-code" id="new-source">
141
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 26</span>
142
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">seq</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># :yields: track, num_tracks, index</span>
143
+ <span class="ruby-keyword">super</span>()
144
+ <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span>
145
+ <span class="ruby-ivar">@track</span> = <span class="ruby-keyword">nil</span>
146
+ <span class="ruby-ivar">@chan_mask</span> = <span class="ruby-value">0</span>
147
+ <span class="ruby-ivar">@update_block</span> = <span class="ruby-identifier">block</span>
148
+ <span class="ruby-keyword">end</span></pre>
149
+ </div>
150
+ </div>
151
+
152
+
153
+ </div>
154
+
155
+ </section>
156
+
157
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
158
+ <header>
159
+ <h3>Public Instance Methods</h3>
160
+ </header>
161
+
162
+ <div id="method-i-chan_pressure" class="method-detail ">
163
+ <div class="method-heading">
164
+ <span class="method-name">chan_pressure</span><span
165
+ class="method-args">(chan, press)</span>
166
+ <span class="method-click-advice">click to toggle source</span>
167
+ </div>
168
+
169
+ <div class="method-description">
170
+
171
+
172
+ <div class="method-source-code" id="chan_pressure-source">
173
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 137</span>
174
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">chan_pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">press</span>)
175
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">ChannelPressure</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">press</span>, <span class="ruby-ivar">@curr_ticks</span>)
176
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
177
+ <span class="ruby-keyword">end</span></pre>
178
+ </div>
179
+ </div>
180
+
181
+
182
+ </div>
183
+
184
+ <div id="method-i-controller" class="method-detail ">
185
+ <div class="method-heading">
186
+ <span class="method-name">controller</span><span
187
+ class="method-args">(chan, control, value)</span>
188
+ <span class="method-click-advice">click to toggle source</span>
189
+ </div>
190
+
191
+ <div class="method-description">
192
+
193
+
194
+ <div class="method-source-code" id="controller-source">
195
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 122</span>
196
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">controller</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">control</span>, <span class="ruby-identifier">value</span>)
197
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Controller</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">control</span>, <span class="ruby-identifier">value</span>, <span class="ruby-ivar">@curr_ticks</span>)
198
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
199
+ <span class="ruby-keyword">end</span></pre>
200
+ </div>
201
+ </div>
202
+
203
+
204
+ </div>
205
+
206
+ <div id="method-i-end_track" class="method-detail ">
207
+ <div class="method-heading">
208
+ <span class="method-name">end_track</span><span
209
+ class="method-args">()</span>
210
+ <span class="method-click-advice">click to toggle source</span>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+
215
+
216
+ <div class="method-source-code" id="end_track-source">
217
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 49</span>
218
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">end_track</span>
219
+ <span class="ruby-comment"># Turn off any pending note on messages</span>
220
+ <span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">on</span><span class="ruby-operator">|</span> <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-value">64</span>) }
221
+ <span class="ruby-ivar">@pending</span> = <span class="ruby-keyword">nil</span>
222
+
223
+ <span class="ruby-comment"># Don&#39;t bother adding the META_TRACK_END event to the track.</span>
224
+ <span class="ruby-comment"># This way, we don&#39;t have to worry about making sure the</span>
225
+ <span class="ruby-comment"># last event is always a track end event.</span>
226
+
227
+ <span class="ruby-comment"># Let the track calculate event times from start of track. This is</span>
228
+ <span class="ruby-comment"># in lieu of calling Track.add for each event.</span>
229
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">recalc_times</span>
230
+
231
+ <span class="ruby-comment"># Store bitmask of all channels used into track</span>
232
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">channels_used</span> = <span class="ruby-ivar">@chan_mask</span>
233
+
234
+ <span class="ruby-comment"># call update block</span>
235
+ <span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-ivar">@track</span>, <span class="ruby-ivar">@ntrks</span>, <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">length</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
236
+ <span class="ruby-keyword">end</span></pre>
237
+ </div>
238
+ </div>
239
+
240
+
241
+ </div>
242
+
243
+ <div id="method-i-header" class="method-detail ">
244
+ <div class="method-heading">
245
+ <span class="method-name">header</span><span
246
+ class="method-args">(format, ntrks, division)</span>
247
+ <span class="method-click-advice">click to toggle source</span>
248
+ </div>
249
+
250
+ <div class="method-description">
251
+
252
+
253
+ <div class="method-source-code" id="header-source">
254
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 34</span>
255
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">header</span>(<span class="ruby-identifier">format</span>, <span class="ruby-identifier">ntrks</span>, <span class="ruby-identifier">division</span>)
256
+ <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span>
257
+ <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">ppqn</span> = <span class="ruby-identifier">division</span>
258
+
259
+ <span class="ruby-ivar">@ntrks</span> = <span class="ruby-identifier">ntrks</span>
260
+ <span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@ntrks</span>, <span class="ruby-value">0</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
261
+ <span class="ruby-keyword">end</span></pre>
262
+ </div>
263
+ </div>
264
+
265
+
266
+ </div>
267
+
268
+ <div id="method-i-key_signature" class="method-detail ">
269
+ <div class="method-heading">
270
+ <span class="method-name">key_signature</span><span
271
+ class="method-args">(sharpflat, is_minor)</span>
272
+ <span class="method-click-advice">click to toggle source</span>
273
+ </div>
274
+
275
+ <div class="method-description">
276
+
277
+
278
+ <div class="method-source-code" id="key_signature-source">
279
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 195</span>
280
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">key_signature</span>(<span class="ruby-identifier">sharpflat</span>, <span class="ruby-identifier">is_minor</span>)
281
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">KeySig</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sharpflat</span>, <span class="ruby-identifier">is_minor</span>, <span class="ruby-ivar">@curr_ticks</span>)
282
+ <span class="ruby-keyword">end</span></pre>
283
+ </div>
284
+ </div>
285
+
286
+
287
+ </div>
288
+
289
+ <div id="method-i-make_note_off" class="method-detail ">
290
+ <div class="method-heading">
291
+ <span class="method-name">make_note_off</span><span
292
+ class="method-args">(on, vel)</span>
293
+ <span class="method-click-advice">click to toggle source</span>
294
+ </div>
295
+
296
+ <div class="method-description">
297
+
298
+
299
+ <div class="method-source-code" id="make_note_off-source">
300
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 110</span>
301
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-identifier">vel</span>)
302
+ <span class="ruby-identifier">off</span> = <span class="ruby-constant">NoteOff</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">on</span>.<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">on</span>.<span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>, <span class="ruby-ivar">@curr_ticks</span>)
303
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">off</span>
304
+ <span class="ruby-identifier">on</span>.<span class="ruby-identifier">off</span> = <span class="ruby-identifier">off</span>
305
+ <span class="ruby-identifier">off</span>.<span class="ruby-identifier">on</span> = <span class="ruby-identifier">on</span>
306
+ <span class="ruby-keyword">end</span></pre>
307
+ </div>
308
+ </div>
309
+
310
+
311
+ </div>
312
+
313
+ <div id="method-i-meta_misc" class="method-detail ">
314
+ <div class="method-heading">
315
+ <span class="method-name">meta_misc</span><span
316
+ class="method-args">(type, msg)</span>
317
+ <span class="method-click-advice">click to toggle source</span>
318
+ </div>
319
+
320
+ <div class="method-description">
321
+
322
+
323
+ <div class="method-source-code" id="meta_misc-source">
324
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 146</span>
325
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta_misc</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
326
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
327
+ <span class="ruby-keyword">end</span></pre>
328
+ </div>
329
+ </div>
330
+
331
+
332
+ </div>
333
+
334
+ <div id="method-i-note_off" class="method-detail ">
335
+ <div class="method-heading">
336
+ <span class="method-name">note_off</span><span
337
+ class="method-args">(chan, note, vel)</span>
338
+ <span class="method-click-advice">click to toggle source</span>
339
+ </div>
340
+
341
+ <div class="method-description">
342
+
343
+
344
+ <div class="method-source-code" id="note_off-source">
345
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 81</span>
346
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">note_off</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
347
+ <span class="ruby-comment"># Find note on, create note off, connect the two, and remove</span>
348
+ <span class="ruby-comment"># note on from pending list.</span>
349
+
350
+ <span class="ruby-identifier">corresp_note_on</span> = <span class="ruby-keyword">nil</span>
351
+
352
+ <span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">on</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
353
+ <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">on</span>.<span class="ruby-identifier">note</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">note</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">on</span>.<span class="ruby-identifier">channel</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">chan</span>
354
+
355
+ <span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">i</span>)
356
+ <span class="ruby-identifier">corresp_note_on</span> = <span class="ruby-identifier">on</span>
357
+ <span class="ruby-keyword">break</span>
358
+ <span class="ruby-keyword">end</span>
359
+
360
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">corresp_note_on</span>
361
+ <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">corresp_note_on</span>, <span class="ruby-identifier">vel</span>)
362
+ <span class="ruby-keyword">else</span>
363
+ <span class="ruby-comment"># When a corresponding note on is missing,</span>
364
+ <span class="ruby-comment"># keep note off as input with lefting on/off attr to nil.</span>
365
+ <span class="ruby-identifier">off</span> = <span class="ruby-constant">NoteOff</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>, <span class="ruby-ivar">@curr_ticks</span>)
366
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">off</span>
367
+
368
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
369
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;note off with no earlier note on (ch #{chan}, note&quot;</span> <span class="ruby-operator">+</span>
370
+ <span class="ruby-node">&quot; #{note}, vel #{vel})&quot;</span>
371
+ <span class="ruby-keyword">end</span>
372
+ <span class="ruby-keyword">end</span>
373
+ <span class="ruby-keyword">end</span></pre>
374
+ </div>
375
+ </div>
376
+
377
+
378
+ </div>
379
+
380
+ <div id="method-i-note_on" class="method-detail ">
381
+ <div class="method-heading">
382
+ <span class="method-name">note_on</span><span
383
+ class="method-args">(chan, note, vel)</span>
384
+ <span class="method-click-advice">click to toggle source</span>
385
+ </div>
386
+
387
+ <div class="method-description">
388
+
389
+
390
+ <div class="method-source-code" id="note_on-source">
391
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 69</span>
392
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">note_on</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
393
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">vel</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
394
+ <span class="ruby-identifier">note_off</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-value">64</span>)
395
+ <span class="ruby-keyword">return</span>
396
+ <span class="ruby-keyword">end</span>
397
+
398
+ <span class="ruby-identifier">on</span> = <span class="ruby-constant">NoteOn</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>, <span class="ruby-ivar">@curr_ticks</span>)
399
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">on</span>
400
+ <span class="ruby-ivar">@pending</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">on</span>
401
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
402
+ <span class="ruby-keyword">end</span></pre>
403
+ </div>
404
+ </div>
405
+
406
+
407
+ </div>
408
+
409
+ <div id="method-i-pitch_bend" class="method-detail ">
410
+ <div class="method-heading">
411
+ <span class="method-name">pitch_bend</span><span
412
+ class="method-args">(chan, lsb, msb)</span>
413
+ <span class="method-click-advice">click to toggle source</span>
414
+ </div>
415
+
416
+ <div class="method-description">
417
+
418
+
419
+ <div class="method-source-code" id="pitch_bend-source">
420
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 127</span>
421
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pitch_bend</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">lsb</span>, <span class="ruby-identifier">msb</span>)
422
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PitchBend</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, (<span class="ruby-identifier">msb</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">7</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">lsb</span>, <span class="ruby-ivar">@curr_ticks</span>)
423
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
424
+ <span class="ruby-keyword">end</span></pre>
425
+ </div>
426
+ </div>
427
+
428
+
429
+ </div>
430
+
431
+ <div id="method-i-pressure" class="method-detail ">
432
+ <div class="method-heading">
433
+ <span class="method-name">pressure</span><span
434
+ class="method-args">(chan, note, press)</span>
435
+ <span class="method-click-advice">click to toggle source</span>
436
+ </div>
437
+
438
+ <div class="method-description">
439
+
440
+
441
+ <div class="method-source-code" id="pressure-source">
442
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 117</span>
443
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">press</span>)
444
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PolyPressure</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">press</span>, <span class="ruby-ivar">@curr_ticks</span>)
445
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
446
+ <span class="ruby-keyword">end</span></pre>
447
+ </div>
448
+ </div>
449
+
450
+
451
+ </div>
452
+
453
+ <div id="method-i-program" class="method-detail ">
454
+ <div class="method-heading">
455
+ <span class="method-name">program</span><span
456
+ class="method-args">(chan, program)</span>
457
+ <span class="method-click-advice">click to toggle source</span>
458
+ </div>
459
+
460
+ <div class="method-description">
461
+
462
+
463
+ <div class="method-source-code" id="program-source">
464
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 132</span>
465
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">program</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">program</span>)
466
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">ProgramChange</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">program</span>, <span class="ruby-ivar">@curr_ticks</span>)
467
+ <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
468
+ <span class="ruby-keyword">end</span></pre>
469
+ </div>
470
+ </div>
471
+
472
+
473
+ </div>
474
+
475
+ <div id="method-i-start_track" class="method-detail ">
476
+ <div class="method-heading">
477
+ <span class="method-name">start_track</span><span
478
+ class="method-args">()</span>
479
+ <span class="method-click-advice">click to toggle source</span>
480
+ </div>
481
+
482
+ <div class="method-description">
483
+
484
+
485
+ <div class="method-source-code" id="start_track-source">
486
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 42</span>
487
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start_track</span>
488
+ <span class="ruby-ivar">@track</span> = <span class="ruby-constant">Track</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@seq</span>)
489
+ <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@track</span>
490
+
491
+ <span class="ruby-ivar">@pending</span> = []
492
+ <span class="ruby-keyword">end</span></pre>
493
+ </div>
494
+ </div>
495
+
496
+
497
+ </div>
498
+
499
+ <div id="method-i-sysex" class="method-detail ">
500
+ <div class="method-heading">
501
+ <span class="method-name">sysex</span><span
502
+ class="method-args">(msg)</span>
503
+ <span class="method-click-advice">click to toggle source</span>
504
+ </div>
505
+
506
+ <div class="method-description">
507
+
508
+
509
+ <div class="method-source-code" id="sysex-source">
510
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 142</span>
511
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sysex</span>(<span class="ruby-identifier">msg</span>)
512
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">SystemExclusive</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
513
+ <span class="ruby-keyword">end</span></pre>
514
+ </div>
515
+ </div>
516
+
517
+
518
+ </div>
519
+
520
+ <div id="method-i-tempo" class="method-detail ">
521
+ <div class="method-heading">
522
+ <span class="method-name">tempo</span><span
523
+ class="method-args">(microsecs)</span>
524
+ <span class="method-click-advice">click to toggle source</span>
525
+ </div>
526
+
527
+ <div class="method-description">
528
+ <p>–</p>
529
+
530
+ <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">smpte</span>(<span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">frame</span>, <span class="ruby-identifier">fract</span>)
531
+ <span class="ruby-keyword">end</span>
532
+ </pre>
533
+
534
+ <p>++</p>
535
+
536
+ <div class="method-source-code" id="tempo-source">
537
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 191</span>
538
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">tempo</span>(<span class="ruby-identifier">microsecs</span>)
539
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Tempo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">microsecs</span>, <span class="ruby-ivar">@curr_ticks</span>)
540
+ <span class="ruby-keyword">end</span></pre>
541
+ </div>
542
+ </div>
543
+
544
+
545
+ </div>
546
+
547
+ <div id="method-i-text" class="method-detail ">
548
+ <div class="method-heading">
549
+ <span class="method-name">text</span><span
550
+ class="method-args">(type, msg)</span>
551
+ <span class="method-click-advice">click to toggle source</span>
552
+ </div>
553
+
554
+ <div class="method-description">
555
+ <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sequence_number</span>(<span class="ruby-identifier">num</span>)
556
+ <span class="ruby-keyword">end</span>
557
+ </pre>
558
+
559
+ <p>++</p>
560
+
561
+ <div class="method-source-code" id="text-source">
562
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 158</span>
563
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">text</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
564
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
565
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">META_TEXT</span>, <span class="ruby-constant">META_LYRIC</span>, <span class="ruby-constant">META_CUE</span>, <span class="ruby-constant">META_SEQ_NAME</span>, <span class="ruby-constant">META_COPYRIGHT</span>
566
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
567
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">META_INSTRUMENT</span>
568
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">instrument</span> = <span class="ruby-identifier">msg</span>
569
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">META_MARKER</span>
570
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Marker</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
571
+ <span class="ruby-keyword">else</span>
572
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;text = #{msg}, type = #{type}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
573
+ <span class="ruby-keyword">end</span>
574
+ <span class="ruby-keyword">end</span></pre>
575
+ </div>
576
+ </div>
577
+
578
+
579
+ </div>
580
+
581
+ <div id="method-i-time_signature" class="method-detail ">
582
+ <div class="method-heading">
583
+ <span class="method-name">time_signature</span><span
584
+ class="method-args">(numer, denom, clocks, qnotes)</span>
585
+ <span class="method-click-advice">click to toggle source</span>
586
+ </div>
587
+
588
+ <div class="method-description">
589
+ <p>– Don’t bother adding the META_TRACK_END event to the track. This way, we don’t have to worry about always making sure the last event is always a track end event. We just have to make sure to write one when the track is output back to a file.</p>
590
+
591
+ <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">eot</span>()
592
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_TRACK_END</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@curr_ticks</span>)
593
+ <span class="ruby-keyword">end</span>
594
+ </pre>
595
+
596
+ <p>++</p>
597
+
598
+ <div class="method-source-code" id="time_signature-source">
599
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 181</span>
600
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">time_signature</span>(<span class="ruby-identifier">numer</span>, <span class="ruby-identifier">denom</span>, <span class="ruby-identifier">clocks</span>, <span class="ruby-identifier">qnotes</span>)
601
+ <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">time_signature</span>(<span class="ruby-identifier">numer</span>, <span class="ruby-identifier">denom</span>, <span class="ruby-identifier">clocks</span>, <span class="ruby-identifier">qnotes</span>)
602
+ <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">TimeSig</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">numer</span>, <span class="ruby-identifier">denom</span>, <span class="ruby-identifier">clocks</span>, <span class="ruby-identifier">qnotes</span>, <span class="ruby-ivar">@curr_ticks</span>)
603
+ <span class="ruby-keyword">end</span></pre>
604
+ </div>
605
+ </div>
606
+
607
+
608
+ </div>
609
+
610
+ <div id="method-i-track_uses_channel" class="method-detail ">
611
+ <div class="method-heading">
612
+ <span class="method-name">track_uses_channel</span><span
613
+ class="method-args">(chan)</span>
614
+ <span class="method-click-advice">click to toggle source</span>
615
+ </div>
616
+
617
+ <div class="method-description">
618
+ <p>Return true if the current track uses the specified channel.</p>
619
+
620
+ <div class="method-source-code" id="track_uses_channel-source">
621
+ <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 205</span>
622
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
623
+ <span class="ruby-ivar">@chan_mask</span> <span class="ruby-operator">|=</span> (<span class="ruby-value">1</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chan</span>)
624
+ <span class="ruby-keyword">end</span></pre>
625
+ </div>
626
+ </div>
627
+
628
+
629
+ </div>
630
+
631
+ </section>
632
+
633
+ </section>
634
+ </main>
635
+
636
+
637
+ <footer id="validator-badges" role="contentinfo">
638
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
639
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
640
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
641
+ </footer>
642
+