midilib 3.1.0 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +12 -12
  3. data/Credits +7 -0
  4. data/README.rdoc +12 -148
  5. data/Rakefile +5 -15
  6. data/TODO.rdoc +8 -7
  7. data/examples/from_scratch.rb +2 -7
  8. data/examples/measures_mbt.rb +1 -6
  9. data/examples/print_program_changes.rb +1 -3
  10. data/examples/reader2text.rb +2 -7
  11. data/examples/seq2text.rb +1 -6
  12. data/examples/split.rb +1 -6
  13. data/examples/strings.rb +2 -7
  14. data/examples/transpose.rb +3 -8
  15. data/lib/midilib/consts.rb +2 -0
  16. data/lib/midilib/event.rb +2 -2
  17. data/lib/midilib/info.rb +4 -4
  18. data/lib/midilib/io/seqreader.rb +11 -27
  19. data/lib/midilib/io/seqwriter.rb +6 -4
  20. data/lib/midilib/track.rb +38 -6
  21. data/test/test_event.rb +13 -6
  22. data/test/test_io.rb +144 -13
  23. data/test/test_mergesort.rb +1 -6
  24. data/test/test_midifile.rb +1 -6
  25. data/test/test_sequence.rb +1 -6
  26. data/test/test_track.rb +66 -7
  27. data/test/test_varlen.rb +1 -6
  28. metadata +3 -87
  29. data/html/MIDI/ActiveSense.html +0 -171
  30. data/html/MIDI/ChannelEvent.html +0 -190
  31. data/html/MIDI/ChannelPressure.html +0 -212
  32. data/html/MIDI/Clock.html +0 -171
  33. data/html/MIDI/Continue.html +0 -171
  34. data/html/MIDI/Controller.html +0 -224
  35. data/html/MIDI/Event.html +0 -349
  36. data/html/MIDI/IO/MIDIFile.html +0 -1392
  37. data/html/MIDI/IO/SeqReader.html +0 -642
  38. data/html/MIDI/IO/SeqWriter.html +0 -442
  39. data/html/MIDI/IO.html +0 -91
  40. data/html/MIDI/KeySig.html +0 -292
  41. data/html/MIDI/Marker.html +0 -138
  42. data/html/MIDI/Measure.html +0 -260
  43. data/html/MIDI/Measures.html +0 -222
  44. data/html/MIDI/MetaEvent.html +0 -353
  45. data/html/MIDI/NoteEvent.html +0 -255
  46. data/html/MIDI/NoteOff.html +0 -188
  47. data/html/MIDI/NoteOn.html +0 -188
  48. data/html/MIDI/PitchBend.html +0 -213
  49. data/html/MIDI/PolyPressure.html +0 -216
  50. data/html/MIDI/ProgramChange.html +0 -212
  51. data/html/MIDI/Realtime.html +0 -194
  52. data/html/MIDI/Sequence.html +0 -641
  53. data/html/MIDI/SongPointer.html +0 -213
  54. data/html/MIDI/SongSelect.html +0 -212
  55. data/html/MIDI/Start.html +0 -171
  56. data/html/MIDI/Stop.html +0 -171
  57. data/html/MIDI/SystemCommon.html +0 -138
  58. data/html/MIDI/SystemExclusive.html +0 -215
  59. data/html/MIDI/SystemReset.html +0 -171
  60. data/html/MIDI/Tempo.html +0 -292
  61. data/html/MIDI/TimeSig.html +0 -286
  62. data/html/MIDI/Track.html +0 -489
  63. data/html/MIDI/TuneRequest.html +0 -194
  64. data/html/MIDI/Utils.html +0 -178
  65. data/html/MIDI.html +0 -281
  66. data/html/Object.html +0 -197
  67. data/html/README_rdoc.html +0 -545
  68. data/html/TODO_rdoc.html +0 -123
  69. data/html/created.rid +0 -15
  70. data/html/css/fonts.css +0 -167
  71. data/html/css/rdoc.css +0 -639
  72. data/html/fonts/Lato-Light.ttf +0 -0
  73. data/html/fonts/Lato-LightItalic.ttf +0 -0
  74. data/html/fonts/Lato-Regular.ttf +0 -0
  75. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  76. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  77. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  78. data/html/images/add.png +0 -0
  79. data/html/images/arrow_up.png +0 -0
  80. data/html/images/brick.png +0 -0
  81. data/html/images/brick_link.png +0 -0
  82. data/html/images/bug.png +0 -0
  83. data/html/images/bullet_black.png +0 -0
  84. data/html/images/bullet_toggle_minus.png +0 -0
  85. data/html/images/bullet_toggle_plus.png +0 -0
  86. data/html/images/date.png +0 -0
  87. data/html/images/delete.png +0 -0
  88. data/html/images/find.png +0 -0
  89. data/html/images/loadingAnimation.gif +0 -0
  90. data/html/images/macFFBgHack.png +0 -0
  91. data/html/images/package.png +0 -0
  92. data/html/images/page_green.png +0 -0
  93. data/html/images/page_white_text.png +0 -0
  94. data/html/images/page_white_width.png +0 -0
  95. data/html/images/plugin.png +0 -0
  96. data/html/images/ruby.png +0 -0
  97. data/html/images/tag_blue.png +0 -0
  98. data/html/images/tag_green.png +0 -0
  99. data/html/images/transparent.png +0 -0
  100. data/html/images/wrench.png +0 -0
  101. data/html/images/wrench_orange.png +0 -0
  102. data/html/images/zoom.png +0 -0
  103. data/html/index.html +0 -534
  104. data/html/js/darkfish.js +0 -84
  105. data/html/js/navigation.js +0 -105
  106. data/html/js/navigation.js.gz +0 -0
  107. data/html/js/search.js +0 -110
  108. data/html/js/search_index.js +0 -1
  109. data/html/js/search_index.js.gz +0 -0
  110. data/html/js/searcher.js +0 -229
  111. data/html/js/searcher.js.gz +0 -0
  112. data/html/table_of_contents.html +0 -1258
data/html/MIDI/Event.html DELETED
@@ -1,349 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class MIDI::Event - 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="../Object.html">Object</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 ><a href="#method-c-new">::new</a>
76
- <li ><a href="#method-i-3C-3D-3E">#&lt;=&gt;</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>
82
- </ul>
83
- </div>
84
-
85
- </div>
86
- </nav>
87
-
88
- <main role="main" aria-labelledby="class-MIDI::Event">
89
- <h1 id="class-MIDI::Event" class="class">
90
- class MIDI::Event
91
- </h1>
92
-
93
- <section class="description">
94
-
95
- <p>The abstract superclass of all <a href="../MIDI.html"><code>MIDI</code></a> events.</p>
96
-
97
- </section>
98
-
99
- <section id="5Buntitled-5D" class="documentation-section">
100
-
101
-
102
-
103
- <section class="attribute-method-details" class="method-section">
104
- <header>
105
- <h3>Attributes</h3>
106
- </header>
107
-
108
- <div id="attribute-i-delta_time" class="method-detail">
109
- <div class="method-heading attribute-method-heading">
110
- <span class="method-name">delta_time</span><span
111
- class="attribute-access-type">[RW]</span>
112
- </div>
113
-
114
- <div class="method-description">
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>
116
- </div>
117
- </div>
118
- <div id="attribute-i-print_channel_numbers_from_one" class="method-detail">
119
- <div class="method-heading attribute-method-heading">
120
- <span class="method-name">print_channel_numbers_from_one</span><span
121
- class="attribute-access-type">[RW]</span>
122
- </div>
123
-
124
- <div class="method-description">
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>
126
- </div>
127
- </div>
128
- <div id="attribute-i-print_decimal_numbers" class="method-detail">
129
- <div class="method-heading attribute-method-heading">
130
- <span class="method-name">print_decimal_numbers</span><span
131
- class="attribute-access-type">[RW]</span>
132
- </div>
133
-
134
- <div class="method-description">
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>
136
- </div>
137
- </div>
138
- <div id="attribute-i-print_note_names" class="method-detail">
139
- <div class="method-heading attribute-method-heading">
140
- <span class="method-name">print_note_names</span><span
141
- class="attribute-access-type">[RW]</span>
142
- </div>
143
-
144
- <div class="method-description">
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>
146
- </div>
147
- </div>
148
- <div id="attribute-i-status" class="method-detail">
149
- <div class="method-heading attribute-method-heading">
150
- <span class="method-name">status</span><span
151
- class="attribute-access-type">[R]</span>
152
- </div>
153
-
154
- <div class="method-description">
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>
156
- </div>
157
- </div>
158
- <div id="attribute-i-time_from_start" class="method-detail">
159
- <div class="method-heading attribute-method-heading">
160
- <span class="method-name">time_from_start</span><span
161
- class="attribute-access-type">[RW]</span>
162
- </div>
163
-
164
- <div class="method-description">
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>
166
- </div>
167
- </div>
168
- </section>
169
-
170
-
171
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
172
- <header>
173
- <h3>Public Class Methods</h3>
174
- </header>
175
-
176
- <div id="method-c-new" class="method-detail ">
177
- <div class="method-heading">
178
- <span class="method-name">new</span><span
179
- class="method-args">(status = 0, delta_time = 0)</span>
180
- <span class="method-click-advice">click to toggle source</span>
181
- </div>
182
-
183
- <div class="method-description">
184
-
185
-
186
- <div class="method-source-code" id="new-source">
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>
195
- <span class="ruby-keyword">end</span></pre>
196
- </div>
197
- </div>
198
-
199
-
200
- </div>
201
-
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>
208
-
209
- <div id="method-i-3C-3D-3E" class="method-detail ">
210
- <div class="method-heading">
211
- <span class="method-name">&lt;=&gt;</span><span
212
- class="method-args">(other)</span>
213
- <span class="method-click-advice">click to toggle source</span>
214
- </div>
215
-
216
- <div class="method-description">
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>
218
-
219
- <div class="method-source-code" id="3C-3D-3E-source">
220
- <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 59</span>
221
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">&lt;=&gt;</span>(<span class="ruby-identifier">other</span>)
222
- <span class="ruby-ivar">@time_from_start</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">time_from_start</span>
223
- <span class="ruby-keyword">end</span></pre>
224
- </div>
225
- </div>
226
-
227
-
228
- </div>
229
-
230
- <div id="method-i-channel_to_s" class="method-detail ">
231
- <div class="method-heading">
232
- <span class="method-name">channel_to_s</span><span
233
- class="method-args">(val)</span>
234
- <span class="method-click-advice">click to toggle source</span>
235
- </div>
236
-
237
- <div class="method-description">
238
- <p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.</p>
239
-
240
- <div class="method-source-code" id="channel_to_s-source">
241
- <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 71</span>
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>)
245
- <span class="ruby-keyword">end</span></pre>
246
- </div>
247
- </div>
248
-
249
-
250
- </div>
251
-
252
- <div id="method-i-data_as_bytes" class="method-detail ">
253
- <div class="method-heading">
254
- <span class="method-name">data_as_bytes</span><span
255
- class="method-args">()</span>
256
- <span class="method-click-advice">click to toggle source</span>
257
- </div>
258
-
259
- <div class="method-description">
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>
261
-
262
- <div class="method-source-code" id="data_as_bytes-source">
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">&#39;subclass responsibility&#39;</span>
266
- <span class="ruby-keyword">end</span></pre>
267
- </div>
268
- </div>
269
-
270
-
271
- </div>
272
-
273
- <div id="method-i-number_to_s" class="method-detail ">
274
- <div class="method-heading">
275
- <span class="method-name">number_to_s</span><span
276
- class="method-args">(val)</span>
277
- <span class="method-click-advice">click to toggle source</span>
278
- </div>
279
-
280
- <div class="method-description">
281
- <p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.</p>
282
-
283
- <div class="method-source-code" id="number_to_s-source">
284
- <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 65</span>
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">&#39;%02x&#39;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span>)
287
- <span class="ruby-keyword">end</span></pre>
288
- </div>
289
- </div>
290
-
291
-
292
- </div>
293
-
294
- <div id="method-i-quantize_to" class="method-detail ">
295
- <div class="method-heading">
296
- <span class="method-name">quantize_to</span><span
297
- class="method-args">(boundary)</span>
298
- <span class="method-click-advice">click to toggle source</span>
299
- </div>
300
-
301
- <div class="method-description">
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>
303
-
304
- <div class="method-source-code" id="quantize_to-source">
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">&gt;=</span> <span class="ruby-identifier">boundary</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>
310
- <span class="ruby-keyword">end</span></pre>
311
- </div>
312
- </div>
313
-
314
-
315
- </div>
316
-
317
- <div id="method-i-to_s" class="method-detail ">
318
- <div class="method-heading">
319
- <span class="method-name">to_s</span><span
320
- class="method-args">()</span>
321
- <span class="method-click-advice">click to toggle source</span>
322
- </div>
323
-
324
- <div class="method-description">
325
-
326
-
327
- <div class="method-source-code" id="to_s-source">
328
- <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 76</span>
329
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
330
- <span class="ruby-node">&quot;#{@delta_time}: &quot;</span>
331
- <span class="ruby-keyword">end</span></pre>
332
- </div>
333
- </div>
334
-
335
-
336
- </div>
337
-
338
- </section>
339
-
340
- </section>
341
- </main>
342
-
343
-
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>.
348
- </footer>
349
-