midilib 2.0.2 → 2.0.4

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