midilib 2.0.5 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +5 -5
  2. data/ChangeLog +2 -1
  3. data/Credits +39 -2
  4. data/README.rdoc +5 -6
  5. data/Rakefile +36 -49
  6. data/TODO.rdoc +13 -2
  7. data/examples/from_scratch.rb +1 -1
  8. data/examples/measures_mbt.rb +11 -11
  9. data/examples/print_program_changes.rb +2 -2
  10. data/examples/reader2text.rb +47 -47
  11. data/examples/seq2text.rb +1 -1
  12. data/examples/split.rb +4 -3
  13. data/examples/strings.rb +4 -4
  14. data/examples/transpose.rb +19 -20
  15. data/install.rb +21 -13
  16. data/lib/midilib/consts.rb +237 -239
  17. data/lib/midilib/event.rb +128 -100
  18. data/lib/midilib/info.rb +3 -5
  19. data/lib/midilib/io/midifile.rb +155 -182
  20. data/lib/midilib/io/seqreader.rb +80 -85
  21. data/lib/midilib/io/seqwriter.rb +93 -88
  22. data/lib/midilib/measure.rb +78 -80
  23. data/lib/midilib/mergesort.rb +39 -0
  24. data/lib/midilib/sequence.rb +40 -32
  25. data/lib/midilib/track.rb +16 -57
  26. data/lib/midilib/utils.rb +4 -7
  27. data/lib/midilib.rb +5 -5
  28. data/test/event_equality.rb +28 -30
  29. data/test/test_event.rb +9 -11
  30. data/test/test_io.rb +83 -3
  31. data/test/test_mergesort.rb +37 -0
  32. data/test/test_midifile.rb +6 -19
  33. data/test/test_sequence.rb +5 -4
  34. data/test/test_track.rb +9 -38
  35. data/test/test_varlen.rb +1 -3
  36. metadata +8 -95
  37. data/html/IO.html +0 -155
  38. data/html/MIDI/ActiveSense.html +0 -206
  39. data/html/MIDI/ChannelEvent.html +0 -231
  40. data/html/MIDI/ChannelPressure.html +0 -265
  41. data/html/MIDI/Clock.html +0 -206
  42. data/html/MIDI/Continue.html +0 -206
  43. data/html/MIDI/Controller.html +0 -280
  44. data/html/MIDI/Event.html +0 -489
  45. data/html/MIDI/IO/MIDIFile.html +0 -2024
  46. data/html/MIDI/IO/SeqReader.html +0 -904
  47. data/html/MIDI/IO/SeqWriter.html +0 -572
  48. data/html/MIDI/IO.html +0 -95
  49. data/html/MIDI/KeySig.html +0 -353
  50. data/html/MIDI/MIDI/MIDI/Array.html +0 -255
  51. data/html/MIDI/MIDI/MIDI.html +0 -95
  52. data/html/MIDI/MIDI.html +0 -95
  53. data/html/MIDI/Marker.html +0 -158
  54. data/html/MIDI/Measure.html +0 -328
  55. data/html/MIDI/Measures.html +0 -285
  56. data/html/MIDI/MetaEvent.html +0 -461
  57. data/html/MIDI/NoteEvent.html +0 -331
  58. data/html/MIDI/NoteOff.html +0 -228
  59. data/html/MIDI/NoteOn.html +0 -228
  60. data/html/MIDI/PitchBend.html +0 -266
  61. data/html/MIDI/PolyPressure.html +0 -277
  62. data/html/MIDI/ProgramChange.html +0 -265
  63. data/html/MIDI/Realtime.html +0 -242
  64. data/html/MIDI/Sequence.html +0 -896
  65. data/html/MIDI/SongPointer.html +0 -266
  66. data/html/MIDI/SongSelect.html +0 -265
  67. data/html/MIDI/Start.html +0 -206
  68. data/html/MIDI/Stop.html +0 -206
  69. data/html/MIDI/SystemCommon.html +0 -158
  70. data/html/MIDI/SystemExclusive.html +0 -268
  71. data/html/MIDI/SystemReset.html +0 -206
  72. data/html/MIDI/Tempo.html +0 -396
  73. data/html/MIDI/TimeSig.html +0 -388
  74. data/html/MIDI/Track.html +0 -695
  75. data/html/MIDI/TuneRequest.html +0 -242
  76. data/html/MIDI/Utils.html +0 -220
  77. data/html/MIDI.html +0 -547
  78. data/html/README_rdoc.html +0 -731
  79. data/html/TODO_rdoc.html +0 -125
  80. data/html/created.rid +0 -14
  81. data/html/css/fonts.css +0 -167
  82. data/html/css/rdoc.css +0 -590
  83. data/html/fonts/Lato-Light.ttf +0 -0
  84. data/html/fonts/Lato-LightItalic.ttf +0 -0
  85. data/html/fonts/Lato-Regular.ttf +0 -0
  86. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  87. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  88. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  89. data/html/images/add.png +0 -0
  90. data/html/images/arrow_up.png +0 -0
  91. data/html/images/brick.png +0 -0
  92. data/html/images/brick_link.png +0 -0
  93. data/html/images/bug.png +0 -0
  94. data/html/images/bullet_black.png +0 -0
  95. data/html/images/bullet_toggle_minus.png +0 -0
  96. data/html/images/bullet_toggle_plus.png +0 -0
  97. data/html/images/date.png +0 -0
  98. data/html/images/delete.png +0 -0
  99. data/html/images/find.png +0 -0
  100. data/html/images/loadingAnimation.gif +0 -0
  101. data/html/images/macFFBgHack.png +0 -0
  102. data/html/images/package.png +0 -0
  103. data/html/images/page_green.png +0 -0
  104. data/html/images/page_white_text.png +0 -0
  105. data/html/images/page_white_width.png +0 -0
  106. data/html/images/plugin.png +0 -0
  107. data/html/images/ruby.png +0 -0
  108. data/html/images/tag_blue.png +0 -0
  109. data/html/images/tag_green.png +0 -0
  110. data/html/images/transparent.png +0 -0
  111. data/html/images/wrench.png +0 -0
  112. data/html/images/wrench_orange.png +0 -0
  113. data/html/images/zoom.png +0 -0
  114. data/html/index.html +0 -768
  115. data/html/js/darkfish.js +0 -161
  116. data/html/js/jquery.js +0 -4
  117. data/html/js/navigation.js +0 -142
  118. data/html/js/navigation.js.gz +0 -0
  119. data/html/js/search.js +0 -109
  120. data/html/js/search_index.js +0 -1
  121. data/html/js/search_index.js.gz +0 -0
  122. data/html/js/searcher.js +0 -228
  123. data/html/js/searcher.js.gz +0 -0
  124. data/html/table_of_contents.html +0 -1265
@@ -1,904 +0,0 @@
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
- </script>
12
-
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
-
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>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../../table_of_contents.html#pages">Pages</a>
31
- <a href="../../table_of_contents.html#classes">Classes</a>
32
- <a href="../../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
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"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
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>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
- <div id="parent-class-section" class="nav-section">
58
- <h3>Parent</h3>
59
-
60
-
61
- <p class="link"><a href="MIDIFile.html">MIDI::IO::MIDIFile</a>
62
-
63
- </div>
64
-
65
-
66
-
67
- <!-- Method Quickref -->
68
- <div id="method-list-section" class="nav-section">
69
- <h3>Methods</h3>
70
-
71
- <ul class="link-list" role="directory">
72
-
73
- <li class="calls-super" ><a href="#method-c-new">::new</a>
74
-
75
- <li ><a href="#method-i-chan_pressure">#chan_pressure</a>
76
-
77
- <li ><a href="#method-i-controller">#controller</a>
78
-
79
- <li ><a href="#method-i-end_track">#end_track</a>
80
-
81
- <li ><a href="#method-i-header">#header</a>
82
-
83
- <li ><a href="#method-i-key_signature">#key_signature</a>
84
-
85
- <li ><a href="#method-i-make_note_off">#make_note_off</a>
86
-
87
- <li ><a href="#method-i-meta_misc">#meta_misc</a>
88
-
89
- <li ><a href="#method-i-note_off">#note_off</a>
90
-
91
- <li ><a href="#method-i-note_on">#note_on</a>
92
-
93
- <li ><a href="#method-i-pitch_bend">#pitch_bend</a>
94
-
95
- <li ><a href="#method-i-pressure">#pressure</a>
96
-
97
- <li ><a href="#method-i-program">#program</a>
98
-
99
- <li ><a href="#method-i-start_track">#start_track</a>
100
-
101
- <li ><a href="#method-i-sysex">#sysex</a>
102
-
103
- <li ><a href="#method-i-tempo">#tempo</a>
104
-
105
- <li ><a href="#method-i-text">#text</a>
106
-
107
- <li ><a href="#method-i-time_signature">#time_signature</a>
108
-
109
- <li ><a href="#method-i-track_uses_channel">#track_uses_channel</a>
110
-
111
- </ul>
112
- </div>
113
-
114
- </div>
115
- </nav>
116
-
117
- <main role="main" aria-labelledby="class-MIDI::IO::SeqReader">
118
- <h1 id="class-MIDI::IO::SeqReader" class="class">
119
- class MIDI::IO::SeqReader
120
- </h1>
121
-
122
- <section class="description">
123
-
124
- <p>Reads <a href="../MIDI.html">MIDI</a> files. As a subclass of <a
125
- href="MIDIFile.html">MIDIFile</a>, this class implements the callback
126
- methods for each <a href="../MIDI.html">MIDI</a> event and use them to
127
- build <a href="../Track.html">Track</a> and <a
128
- href="../Event.html">Event</a> objects and give the tracks to a <a
129
- href="../Sequence.html">Sequence</a>.</p>
130
-
131
- <p>We append new events to the end of a track&#39;s event list, bypassing a
132
- call to <a href="../Track.html">Track</a>.#add. This means that we must
133
- call <a
134
- href="../Track.html#method-i-recalc_times">MIDI::Track#recalc_times</a> at
135
- the end of the track so it can update each event with its time from the
136
- track&#39;s start (see <a
137
- href="SeqReader.html#method-i-end_track">#end_track</a> below).</p>
138
-
139
- <p>META_TRACK_END events are not added to tracks. This way, we don&#39;t have
140
- to worry about making sure the last event is always a track end event. We
141
- rely on the <a href="SeqWriter.html">SeqWriter</a> to append a
142
- META_TRACK_END event to each track when it is output.</p>
143
-
144
- </section>
145
-
146
-
147
-
148
-
149
- <section id="5Buntitled-5D" class="documentation-section">
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
160
- <header>
161
- <h3>Public Class Methods</h3>
162
- </header>
163
-
164
-
165
- <div id="method-c-new" class="method-detail ">
166
-
167
- <div class="method-heading">
168
- <span class="method-name">new</span><span
169
- class="method-args">(seq, proc = nil) { |track, num_tracks, index| ... }</span>
170
-
171
- <span class="method-click-advice">click to toggle source</span>
172
-
173
- </div>
174
-
175
-
176
- <div class="method-description">
177
-
178
- <p>The optional proc block is called once at the start of the file and again
179
- at the end of each track. There are three arguments to the block: the
180
- track, the track number (1 through <em>n</em>), and the total number of
181
- tracks.</p>
182
-
183
-
184
- <div class="method-calls-super">
185
- Calls superclass method
186
- <a href="MIDIFile.html#method-c-new">MIDI::IO::MIDIFile.new</a>
187
- </div>
188
-
189
-
190
-
191
- <div class="method-source-code" id="new-source">
192
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 29</span>
193
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">seq</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-comment"># :yields: track, num_tracks, index</span>
194
- <span class="ruby-keyword">super</span>()
195
- <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span>
196
- <span class="ruby-ivar">@track</span> = <span class="ruby-keyword">nil</span>
197
- <span class="ruby-ivar">@chan_mask</span> = <span class="ruby-value">0</span>
198
- <span class="ruby-ivar">@update_block</span> = <span class="ruby-identifier">block_given?</span>() <span class="ruby-operator">?</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>() <span class="ruby-operator">:</span> <span class="ruby-identifier">proc</span>
199
- <span class="ruby-keyword">end</span></pre>
200
- </div>
201
-
202
- </div>
203
-
204
-
205
-
206
-
207
- </div>
208
-
209
-
210
- </section>
211
-
212
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
213
- <header>
214
- <h3>Public Instance Methods</h3>
215
- </header>
216
-
217
-
218
- <div id="method-i-chan_pressure" class="method-detail ">
219
-
220
- <div class="method-heading">
221
- <span class="method-name">chan_pressure</span><span
222
- class="method-args">(chan, press)</span>
223
-
224
- <span class="method-click-advice">click to toggle source</span>
225
-
226
- </div>
227
-
228
-
229
- <div class="method-description">
230
-
231
-
232
-
233
-
234
-
235
-
236
- <div class="method-source-code" id="chan_pressure-source">
237
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 125</span>
238
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">chan_pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">press</span>)
239
- <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>)
240
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
241
- <span class="ruby-keyword">end</span></pre>
242
- </div>
243
-
244
- </div>
245
-
246
-
247
-
248
-
249
- </div>
250
-
251
-
252
- <div id="method-i-controller" class="method-detail ">
253
-
254
- <div class="method-heading">
255
- <span class="method-name">controller</span><span
256
- class="method-args">(chan, control, value)</span>
257
-
258
- <span class="method-click-advice">click to toggle source</span>
259
-
260
- </div>
261
-
262
-
263
- <div class="method-description">
264
-
265
-
266
-
267
-
268
-
269
-
270
- <div class="method-source-code" id="controller-source">
271
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 110</span>
272
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">controller</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">control</span>, <span class="ruby-identifier">value</span>)
273
- <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>)
274
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
275
- <span class="ruby-keyword">end</span></pre>
276
- </div>
277
-
278
- </div>
279
-
280
-
281
-
282
-
283
- </div>
284
-
285
-
286
- <div id="method-i-end_track" class="method-detail ">
287
-
288
- <div class="method-heading">
289
- <span class="method-name">end_track</span><span
290
- class="method-args">()</span>
291
-
292
- <span class="method-click-advice">click to toggle source</span>
293
-
294
- </div>
295
-
296
-
297
- <div class="method-description">
298
-
299
-
300
-
301
-
302
-
303
-
304
- <div class="method-source-code" id="end_track-source">
305
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 52</span>
306
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">end_track</span>()
307
- <span class="ruby-comment"># Turn off any pending note on messages</span>
308
- <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>) }
309
- <span class="ruby-ivar">@pending</span> = <span class="ruby-keyword">nil</span>
310
-
311
- <span class="ruby-comment"># Don&#39;t bother adding the META_TRACK_END event to the track.</span>
312
- <span class="ruby-comment"># This way, we don&#39;t have to worry about making sure the</span>
313
- <span class="ruby-comment"># last event is always a track end event.</span>
314
-
315
- <span class="ruby-comment"># Let the track calculate event times from start of track. This is</span>
316
- <span class="ruby-comment"># in lieu of calling Track.add for each event.</span>
317
- <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">recalc_times</span>()
318
-
319
- <span class="ruby-comment"># Store bitmask of all channels used into track</span>
320
- <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">channels_used</span> = <span class="ruby-ivar">@chan_mask</span>
321
-
322
- <span class="ruby-comment"># call update block</span>
323
- <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>
324
- <span class="ruby-keyword">end</span></pre>
325
- </div>
326
-
327
- </div>
328
-
329
-
330
-
331
-
332
- </div>
333
-
334
-
335
- <div id="method-i-header" class="method-detail ">
336
-
337
- <div class="method-heading">
338
- <span class="method-name">header</span><span
339
- class="method-args">(format, ntrks, division)</span>
340
-
341
- <span class="method-click-advice">click to toggle source</span>
342
-
343
- </div>
344
-
345
-
346
- <div class="method-description">
347
-
348
-
349
-
350
-
351
-
352
-
353
- <div class="method-source-code" id="header-source">
354
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 37</span>
355
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">format</span>, <span class="ruby-identifier">ntrks</span>, <span class="ruby-identifier">division</span>)
356
- <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span>
357
- <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">ppqn</span> = <span class="ruby-identifier">division</span>
358
-
359
- <span class="ruby-ivar">@ntrks</span> = <span class="ruby-identifier">ntrks</span>
360
- <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>
361
- <span class="ruby-keyword">end</span></pre>
362
- </div>
363
-
364
- </div>
365
-
366
-
367
-
368
-
369
- </div>
370
-
371
-
372
- <div id="method-i-key_signature" class="method-detail ">
373
-
374
- <div class="method-heading">
375
- <span class="method-name">key_signature</span><span
376
- class="method-args">(sharpflat, is_minor)</span>
377
-
378
- <span class="method-click-advice">click to toggle source</span>
379
-
380
- </div>
381
-
382
-
383
- <div class="method-description">
384
-
385
-
386
-
387
-
388
-
389
-
390
- <div class="method-source-code" id="key_signature-source">
391
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 185</span>
392
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">key_signature</span>(<span class="ruby-identifier">sharpflat</span>, <span class="ruby-identifier">is_minor</span>)
393
- <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>)
394
- <span class="ruby-keyword">end</span></pre>
395
- </div>
396
-
397
- </div>
398
-
399
-
400
-
401
-
402
- </div>
403
-
404
-
405
- <div id="method-i-make_note_off" class="method-detail ">
406
-
407
- <div class="method-heading">
408
- <span class="method-name">make_note_off</span><span
409
- class="method-args">(on, vel)</span>
410
-
411
- <span class="method-click-advice">click to toggle source</span>
412
-
413
- </div>
414
-
415
-
416
- <div class="method-description">
417
-
418
-
419
-
420
-
421
-
422
-
423
- <div class="method-source-code" id="make_note_off-source">
424
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 98</span>
425
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-identifier">vel</span>)
426
- <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>)
427
- <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>
428
- <span class="ruby-identifier">on</span>.<span class="ruby-identifier">off</span> = <span class="ruby-identifier">off</span>
429
- <span class="ruby-identifier">off</span>.<span class="ruby-identifier">on</span> = <span class="ruby-identifier">on</span>
430
- <span class="ruby-keyword">end</span></pre>
431
- </div>
432
-
433
- </div>
434
-
435
-
436
-
437
-
438
- </div>
439
-
440
-
441
- <div id="method-i-meta_misc" class="method-detail ">
442
-
443
- <div class="method-heading">
444
- <span class="method-name">meta_misc</span><span
445
- class="method-args">(type, msg)</span>
446
-
447
- <span class="method-click-advice">click to toggle source</span>
448
-
449
- </div>
450
-
451
-
452
- <div class="method-description">
453
-
454
-
455
-
456
-
457
-
458
-
459
- <div class="method-source-code" id="meta_misc-source">
460
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 134</span>
461
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">meta_misc</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
462
- <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>)
463
- <span class="ruby-keyword">end</span></pre>
464
- </div>
465
-
466
- </div>
467
-
468
-
469
-
470
-
471
- </div>
472
-
473
-
474
- <div id="method-i-note_off" class="method-detail ">
475
-
476
- <div class="method-heading">
477
- <span class="method-name">note_off</span><span
478
- class="method-args">(chan, note, vel)</span>
479
-
480
- <span class="method-click-advice">click to toggle source</span>
481
-
482
- </div>
483
-
484
-
485
- <div class="method-description">
486
-
487
-
488
-
489
-
490
-
491
-
492
- <div class="method-source-code" id="note_off-source">
493
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 84</span>
494
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">note_off</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
495
- <span class="ruby-comment"># Find note on, create note off, connect the two, and remove</span>
496
- <span class="ruby-comment"># note on from pending list.</span>
497
- <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>
498
- <span class="ruby-keyword">if</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>
499
- <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-identifier">vel</span>)
500
- <span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">i</span>)
501
- <span class="ruby-keyword">return</span>
502
- <span class="ruby-keyword">end</span>
503
- <span class="ruby-keyword">end</span>
504
- <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;note off with no earlier note on (ch #{chan}, note&quot;</span> <span class="ruby-operator">+</span>
505
- <span class="ruby-node">&quot; #{note}, vel #{vel})&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
506
- <span class="ruby-keyword">end</span></pre>
507
- </div>
508
-
509
- </div>
510
-
511
-
512
-
513
-
514
- </div>
515
-
516
-
517
- <div id="method-i-note_on" class="method-detail ">
518
-
519
- <div class="method-heading">
520
- <span class="method-name">note_on</span><span
521
- class="method-args">(chan, note, vel)</span>
522
-
523
- <span class="method-click-advice">click to toggle source</span>
524
-
525
- </div>
526
-
527
-
528
- <div class="method-description">
529
-
530
-
531
-
532
-
533
-
534
-
535
- <div class="method-source-code" id="note_on-source">
536
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 72</span>
537
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">note_on</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
538
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">vel</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
539
- <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>)
540
- <span class="ruby-keyword">return</span>
541
- <span class="ruby-keyword">end</span>
542
-
543
- <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>)
544
- <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>
545
- <span class="ruby-ivar">@pending</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">on</span>
546
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
547
- <span class="ruby-keyword">end</span></pre>
548
- </div>
549
-
550
- </div>
551
-
552
-
553
-
554
-
555
- </div>
556
-
557
-
558
- <div id="method-i-pitch_bend" class="method-detail ">
559
-
560
- <div class="method-heading">
561
- <span class="method-name">pitch_bend</span><span
562
- class="method-args">(chan, lsb, msb)</span>
563
-
564
- <span class="method-click-advice">click to toggle source</span>
565
-
566
- </div>
567
-
568
-
569
- <div class="method-description">
570
-
571
-
572
-
573
-
574
-
575
-
576
- <div class="method-source-code" id="pitch_bend-source">
577
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 115</span>
578
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">pitch_bend</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">lsb</span>, <span class="ruby-identifier">msb</span>)
579
- <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>)
580
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
581
- <span class="ruby-keyword">end</span></pre>
582
- </div>
583
-
584
- </div>
585
-
586
-
587
-
588
-
589
- </div>
590
-
591
-
592
- <div id="method-i-pressure" class="method-detail ">
593
-
594
- <div class="method-heading">
595
- <span class="method-name">pressure</span><span
596
- class="method-args">(chan, note, press)</span>
597
-
598
- <span class="method-click-advice">click to toggle source</span>
599
-
600
- </div>
601
-
602
-
603
- <div class="method-description">
604
-
605
-
606
-
607
-
608
-
609
-
610
- <div class="method-source-code" id="pressure-source">
611
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 105</span>
612
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">press</span>)
613
- <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>)
614
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
615
- <span class="ruby-keyword">end</span></pre>
616
- </div>
617
-
618
- </div>
619
-
620
-
621
-
622
-
623
- </div>
624
-
625
-
626
- <div id="method-i-program" class="method-detail ">
627
-
628
- <div class="method-heading">
629
- <span class="method-name">program</span><span
630
- class="method-args">(chan, program)</span>
631
-
632
- <span class="method-click-advice">click to toggle source</span>
633
-
634
- </div>
635
-
636
-
637
- <div class="method-description">
638
-
639
-
640
-
641
-
642
-
643
-
644
- <div class="method-source-code" id="program-source">
645
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 120</span>
646
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">program</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">program</span>)
647
- <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>)
648
- <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
649
- <span class="ruby-keyword">end</span></pre>
650
- </div>
651
-
652
- </div>
653
-
654
-
655
-
656
-
657
- </div>
658
-
659
-
660
- <div id="method-i-start_track" class="method-detail ">
661
-
662
- <div class="method-heading">
663
- <span class="method-name">start_track</span><span
664
- class="method-args">()</span>
665
-
666
- <span class="method-click-advice">click to toggle source</span>
667
-
668
- </div>
669
-
670
-
671
- <div class="method-description">
672
-
673
-
674
-
675
-
676
-
677
-
678
- <div class="method-source-code" id="start_track-source">
679
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 45</span>
680
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">start_track</span>()
681
- <span class="ruby-ivar">@track</span> = <span class="ruby-constant">Track</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@seq</span>)
682
- <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>
683
-
684
- <span class="ruby-ivar">@pending</span> = []
685
- <span class="ruby-keyword">end</span></pre>
686
- </div>
687
-
688
- </div>
689
-
690
-
691
-
692
-
693
- </div>
694
-
695
-
696
- <div id="method-i-sysex" class="method-detail ">
697
-
698
- <div class="method-heading">
699
- <span class="method-name">sysex</span><span
700
- class="method-args">(msg)</span>
701
-
702
- <span class="method-click-advice">click to toggle source</span>
703
-
704
- </div>
705
-
706
-
707
- <div class="method-description">
708
-
709
-
710
-
711
-
712
-
713
-
714
- <div class="method-source-code" id="sysex-source">
715
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 130</span>
716
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">sysex</span>(<span class="ruby-identifier">msg</span>)
717
- <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>)
718
- <span class="ruby-keyword">end</span></pre>
719
- </div>
720
-
721
- </div>
722
-
723
-
724
-
725
-
726
- </div>
727
-
728
-
729
- <div id="method-i-tempo" class="method-detail ">
730
-
731
- <div class="method-heading">
732
- <span class="method-name">tempo</span><span
733
- class="method-args">(microsecs)</span>
734
-
735
- <span class="method-click-advice">click to toggle source</span>
736
-
737
- </div>
738
-
739
-
740
- <div class="method-description">
741
-
742
- <p>–</p>
743
-
744
- <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">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>)
745
- <span class="ruby-keyword">end</span>
746
- </pre>
747
-
748
- <p>++</p>
749
-
750
-
751
-
752
-
753
- <div class="method-source-code" id="tempo-source">
754
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 181</span>
755
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">tempo</span>(<span class="ruby-identifier">microsecs</span>)
756
- <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>)
757
- <span class="ruby-keyword">end</span></pre>
758
- </div>
759
-
760
- </div>
761
-
762
-
763
-
764
-
765
- </div>
766
-
767
-
768
- <div id="method-i-text" class="method-detail ">
769
-
770
- <div class="method-heading">
771
- <span class="method-name">text</span><span
772
- class="method-args">(type, msg)</span>
773
-
774
- <span class="method-click-advice">click to toggle source</span>
775
-
776
- </div>
777
-
778
-
779
- <div class="method-description">
780
-
781
- <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">sequence_number</span>(<span class="ruby-identifier">num</span>)
782
- <span class="ruby-keyword">end</span>
783
- </pre>
784
-
785
- <p>++</p>
786
-
787
-
788
-
789
-
790
- <div class="method-source-code" id="text-source">
791
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 146</span>
792
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">text</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
793
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
794
- <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>
795
- <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>)
796
- <span class="ruby-keyword">when</span> <span class="ruby-constant">META_SEQ_NAME</span>, <span class="ruby-constant">META_COPYRIGHT</span>
797
- <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-value">0</span>)
798
- <span class="ruby-keyword">when</span> <span class="ruby-constant">META_INSTRUMENT</span>
799
- <span class="ruby-ivar">@track</span>.<span class="ruby-identifier">instrument</span> = <span class="ruby-identifier">msg</span>
800
- <span class="ruby-keyword">when</span> <span class="ruby-constant">META_MARKER</span>
801
- <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>)
802
- <span class="ruby-keyword">else</span>
803
- <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;text = #{msg}, type = #{type}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
804
- <span class="ruby-keyword">end</span>
805
- <span class="ruby-keyword">end</span></pre>
806
- </div>
807
-
808
- </div>
809
-
810
-
811
-
812
-
813
- </div>
814
-
815
-
816
- <div id="method-i-time_signature" class="method-detail ">
817
-
818
- <div class="method-heading">
819
- <span class="method-name">time_signature</span><span
820
- class="method-args">(numer, denom, clocks, qnotes)</span>
821
-
822
- <span class="method-click-advice">click to toggle source</span>
823
-
824
- </div>
825
-
826
-
827
- <div class="method-description">
828
-
829
- <p>– Don&#39;t bother adding the META_TRACK_END event to the track. This way,
830
- we don&#39;t have to worry about always making sure the last event is
831
- always a track end event. We just have to make sure to write one when the
832
- track is output back to a file.</p>
833
-
834
- <pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">eot</span>()
835
- <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>)
836
- <span class="ruby-keyword">end</span>
837
- </pre>
838
-
839
- <p>++</p>
840
-
841
-
842
-
843
-
844
- <div class="method-source-code" id="time_signature-source">
845
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 171</span>
846
- <span class="ruby-keyword">def</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>)
847
- <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>)
848
- <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>)
849
- <span class="ruby-keyword">end</span></pre>
850
- </div>
851
-
852
- </div>
853
-
854
-
855
-
856
-
857
- </div>
858
-
859
-
860
- <div id="method-i-track_uses_channel" class="method-detail ">
861
-
862
- <div class="method-heading">
863
- <span class="method-name">track_uses_channel</span><span
864
- class="method-args">(chan)</span>
865
-
866
- <span class="method-click-advice">click to toggle source</span>
867
-
868
- </div>
869
-
870
-
871
- <div class="method-description">
872
-
873
- <p>Return true if the current track uses the specified channel.</p>
874
-
875
-
876
-
877
-
878
- <div class="method-source-code" id="track_uses_channel-source">
879
- <pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 195</span>
880
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
881
- <span class="ruby-ivar">@chan_mask</span> = <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>)
882
- <span class="ruby-keyword">end</span></pre>
883
- </div>
884
-
885
- </div>
886
-
887
-
888
-
889
-
890
- </div>
891
-
892
-
893
- </section>
894
-
895
- </section>
896
- </main>
897
-
898
-
899
- <footer id="validator-badges" role="contentinfo">
900
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
901
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
902
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
903
- </footer>
904
-