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,328 @@
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::Realtime - 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"><a href="Event.html">MIDI::Event</a>
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-data_as_bytes">#data_as_bytes</a>
76
+
77
+ <li><a href="#method-i-to_s">#to_s</a>
78
+
79
+ </ul>
80
+ </nav>
81
+
82
+ </div>
83
+
84
+ <div id="project-metadata">
85
+ <nav id="fileindex-section" class="section project-section">
86
+ <h3 class="section-header">Pages</h3>
87
+
88
+ <ul>
89
+
90
+ <li class="file"><a href="../README_rdoc.html">README</a>
91
+
92
+ <li class="file"><a href="../TODO_rdoc.html">TODO</a>
93
+
94
+ </ul>
95
+ </nav>
96
+
97
+ <nav id="classindex-section" class="section project-section">
98
+ <h3 class="section-header">Class and Module Index</h3>
99
+
100
+ <ul class="link-list">
101
+
102
+ <li><a href="../MIDI.html">MIDI</a>
103
+
104
+ <li><a href="../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
105
+
106
+ <li><a href="../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
107
+
108
+ <li><a href="../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
109
+
110
+ <li><a href="../MIDI/Clock.html">MIDI::Clock</a>
111
+
112
+ <li><a href="../MIDI/Continue.html">MIDI::Continue</a>
113
+
114
+ <li><a href="../MIDI/Controller.html">MIDI::Controller</a>
115
+
116
+ <li><a href="../MIDI/Event.html">MIDI::Event</a>
117
+
118
+ <li><a href="../MIDI/IO.html">MIDI::IO</a>
119
+
120
+ <li><a href="../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
121
+
122
+ <li><a href="../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
123
+
124
+ <li><a href="../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
125
+
126
+ <li><a href="../MIDI/KeySig.html">MIDI::KeySig</a>
127
+
128
+ <li><a href="../MIDI/MIDI.html">MIDI::MIDI</a>
129
+
130
+ <li><a href="../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
131
+
132
+ <li><a href="../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
133
+
134
+ <li><a href="../MIDI/Marker.html">MIDI::Marker</a>
135
+
136
+ <li><a href="../MIDI/Measure.html">MIDI::Measure</a>
137
+
138
+ <li><a href="../MIDI/Measures.html">MIDI::Measures</a>
139
+
140
+ <li><a href="../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
141
+
142
+ <li><a href="../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
143
+
144
+ <li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a>
145
+
146
+ <li><a href="../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
147
+
148
+ <li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a>
149
+
150
+ <li><a href="../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
151
+
152
+ <li><a href="../MIDI/PitchBend.html">MIDI::PitchBend</a>
153
+
154
+ <li><a href="../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
155
+
156
+ <li><a href="../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
157
+
158
+ <li><a href="../MIDI/Realtime.html">MIDI::Realtime</a>
159
+
160
+ <li><a href="../MIDI/Sequence.html">MIDI::Sequence</a>
161
+
162
+ <li><a href="../MIDI/SongPointer.html">MIDI::SongPointer</a>
163
+
164
+ <li><a href="../MIDI/SongSelect.html">MIDI::SongSelect</a>
165
+
166
+ <li><a href="../MIDI/Start.html">MIDI::Start</a>
167
+
168
+ <li><a href="../MIDI/Stop.html">MIDI::Stop</a>
169
+
170
+ <li><a href="../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
171
+
172
+ <li><a href="../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
173
+
174
+ <li><a href="../MIDI/SystemReset.html">MIDI::SystemReset</a>
175
+
176
+ <li><a href="../MIDI/Tempo.html">MIDI::Tempo</a>
177
+
178
+ <li><a href="../MIDI/TimeSig.html">MIDI::TimeSig</a>
179
+
180
+ <li><a href="../MIDI/Track.html">MIDI::Track</a>
181
+
182
+ <li><a href="../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
183
+
184
+ <li><a href="../MIDI/Utils.html">MIDI::Utils</a>
185
+
186
+ <li><a href="../IO.html">IO</a>
187
+
188
+ </ul>
189
+ </nav>
190
+
191
+ </div>
192
+ </nav>
193
+
194
+ <div id="documentation">
195
+ <h1 class="class">class MIDI::Realtime</h1>
196
+
197
+ <div id="description" class="description">
198
+
199
+ </div><!-- description -->
200
+
201
+
202
+
203
+
204
+ <section id="5Buntitled-5D" class="documentation-section">
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+ <!-- Methods -->
214
+
215
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
216
+ <h3 class="section-header">Public Class Methods</h3>
217
+
218
+
219
+ <div id="method-c-new" class="method-detail ">
220
+
221
+ <div class="method-heading">
222
+ <span class="method-name">new</span><span
223
+ class="method-args">(status, delta_time)</span>
224
+ <span class="method-click-advice">click to toggle source</span>
225
+ </div>
226
+
227
+
228
+ <div class="method-description">
229
+
230
+
231
+
232
+
233
+
234
+ <div class="method-source-code" id="new-source">
235
+ <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 342</span>
236
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">delta_time</span>)
237
+ <span class="ruby-keyword">super</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">delta_time</span>)
238
+ <span class="ruby-keyword">end</span></pre>
239
+ </div><!-- new-source -->
240
+
241
+ </div>
242
+
243
+
244
+
245
+
246
+ </div><!-- new-method -->
247
+
248
+
249
+ </section><!-- public-class-method-details -->
250
+
251
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
252
+ <h3 class="section-header">Public Instance Methods</h3>
253
+
254
+
255
+ <div id="method-i-data_as_bytes" class="method-detail ">
256
+
257
+ <div class="method-heading">
258
+ <span class="method-name">data_as_bytes</span><span
259
+ class="method-args">()</span>
260
+ <span class="method-click-advice">click to toggle source</span>
261
+ </div>
262
+
263
+
264
+ <div class="method-description">
265
+
266
+
267
+
268
+
269
+
270
+ <div class="method-source-code" id="data_as_bytes-source">
271
+ <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 346</span>
272
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">data_as_bytes</span>
273
+ <span class="ruby-identifier">data</span> = []
274
+ <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@status</span>
275
+ <span class="ruby-keyword">end</span></pre>
276
+ </div><!-- data_as_bytes-source -->
277
+
278
+ </div>
279
+
280
+
281
+
282
+
283
+ </div><!-- data_as_bytes-method -->
284
+
285
+
286
+ <div id="method-i-to_s" class="method-detail ">
287
+
288
+ <div class="method-heading">
289
+ <span class="method-name">to_s</span><span
290
+ class="method-args">()</span>
291
+ <span class="method-click-advice">click to toggle source</span>
292
+ </div>
293
+
294
+
295
+ <div class="method-description">
296
+
297
+
298
+
299
+
300
+
301
+ <div class="method-source-code" id="to_s-source">
302
+ <pre><span class="ruby-comment"># File lib/midilib/event.rb, line 351</span>
303
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
304
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">super</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;realtime #{number_to_s(@status)}&quot;</span>
305
+ <span class="ruby-keyword">end</span></pre>
306
+ </div><!-- to_s-source -->
307
+
308
+ </div>
309
+
310
+
311
+
312
+
313
+ </div><!-- to_s-method -->
314
+
315
+
316
+ </section><!-- public-instance-method-details -->
317
+
318
+ </section><!-- 5Buntitled-5D -->
319
+
320
+ </div><!-- documentation -->
321
+
322
+
323
+ <footer id="validator-badges">
324
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
325
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
326
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
327
+ </footer>
328
+
@@ -0,0 +1,961 @@
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::Sequence - 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/sequence.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
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><span class="include">Enumerable</span>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+ <!-- Method Quickref -->
80
+ <nav id="method-list-section" class="section">
81
+ <h3 class="section-header">Methods</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="#method-c-new">::new</a>
86
+
87
+ <li><a href="#method-i-beats_per_minute">#beats_per_minute</a>
88
+
89
+ <li><a href="#method-i-bpm">#bpm</a>
90
+
91
+ <li><a href="#method-i-each">#each</a>
92
+
93
+ <li><a href="#method-i-get_measures">#get_measures</a>
94
+
95
+ <li><a href="#method-i-length_to_delta">#length_to_delta</a>
96
+
97
+ <li><a href="#method-i-name">#name</a>
98
+
99
+ <li><a href="#method-i-name-3D">#name=</a>
100
+
101
+ <li><a href="#method-i-note_to_delta">#note_to_delta</a>
102
+
103
+ <li><a href="#method-i-note_to_length">#note_to_length</a>
104
+
105
+ <li><a href="#method-i-pulses_to_seconds">#pulses_to_seconds</a>
106
+
107
+ <li><a href="#method-i-read">#read</a>
108
+
109
+ <li><a href="#method-i-tempo">#tempo</a>
110
+
111
+ <li><a href="#method-i-time_signature">#time_signature</a>
112
+
113
+ <li><a href="#method-i-write">#write</a>
114
+
115
+ </ul>
116
+ </nav>
117
+
118
+ </div>
119
+
120
+ <div id="project-metadata">
121
+ <nav id="fileindex-section" class="section project-section">
122
+ <h3 class="section-header">Pages</h3>
123
+
124
+ <ul>
125
+
126
+ <li class="file"><a href="../README_rdoc.html">README</a>
127
+
128
+ <li class="file"><a href="../TODO_rdoc.html">TODO</a>
129
+
130
+ </ul>
131
+ </nav>
132
+
133
+ <nav id="classindex-section" class="section project-section">
134
+ <h3 class="section-header">Class and Module Index</h3>
135
+
136
+ <ul class="link-list">
137
+
138
+ <li><a href="../MIDI.html">MIDI</a>
139
+
140
+ <li><a href="../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
141
+
142
+ <li><a href="../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
143
+
144
+ <li><a href="../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
145
+
146
+ <li><a href="../MIDI/Clock.html">MIDI::Clock</a>
147
+
148
+ <li><a href="../MIDI/Continue.html">MIDI::Continue</a>
149
+
150
+ <li><a href="../MIDI/Controller.html">MIDI::Controller</a>
151
+
152
+ <li><a href="../MIDI/Event.html">MIDI::Event</a>
153
+
154
+ <li><a href="../MIDI/IO.html">MIDI::IO</a>
155
+
156
+ <li><a href="../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
157
+
158
+ <li><a href="../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
159
+
160
+ <li><a href="../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
161
+
162
+ <li><a href="../MIDI/KeySig.html">MIDI::KeySig</a>
163
+
164
+ <li><a href="../MIDI/MIDI.html">MIDI::MIDI</a>
165
+
166
+ <li><a href="../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
167
+
168
+ <li><a href="../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
169
+
170
+ <li><a href="../MIDI/Marker.html">MIDI::Marker</a>
171
+
172
+ <li><a href="../MIDI/Measure.html">MIDI::Measure</a>
173
+
174
+ <li><a href="../MIDI/Measures.html">MIDI::Measures</a>
175
+
176
+ <li><a href="../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
177
+
178
+ <li><a href="../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
179
+
180
+ <li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a>
181
+
182
+ <li><a href="../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
183
+
184
+ <li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a>
185
+
186
+ <li><a href="../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
187
+
188
+ <li><a href="../MIDI/PitchBend.html">MIDI::PitchBend</a>
189
+
190
+ <li><a href="../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
191
+
192
+ <li><a href="../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
193
+
194
+ <li><a href="../MIDI/Realtime.html">MIDI::Realtime</a>
195
+
196
+ <li><a href="../MIDI/Sequence.html">MIDI::Sequence</a>
197
+
198
+ <li><a href="../MIDI/SongPointer.html">MIDI::SongPointer</a>
199
+
200
+ <li><a href="../MIDI/SongSelect.html">MIDI::SongSelect</a>
201
+
202
+ <li><a href="../MIDI/Start.html">MIDI::Start</a>
203
+
204
+ <li><a href="../MIDI/Stop.html">MIDI::Stop</a>
205
+
206
+ <li><a href="../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
207
+
208
+ <li><a href="../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
209
+
210
+ <li><a href="../MIDI/SystemReset.html">MIDI::SystemReset</a>
211
+
212
+ <li><a href="../MIDI/Tempo.html">MIDI::Tempo</a>
213
+
214
+ <li><a href="../MIDI/TimeSig.html">MIDI::TimeSig</a>
215
+
216
+ <li><a href="../MIDI/Track.html">MIDI::Track</a>
217
+
218
+ <li><a href="../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
219
+
220
+ <li><a href="../MIDI/Utils.html">MIDI::Utils</a>
221
+
222
+ <li><a href="../IO.html">IO</a>
223
+
224
+ </ul>
225
+ </nav>
226
+
227
+ </div>
228
+ </nav>
229
+
230
+ <div id="documentation">
231
+ <h1 class="class">class MIDI::Sequence</h1>
232
+
233
+ <div id="description" class="description">
234
+
235
+ <p>A <a href="Sequence.html">MIDI::Sequence</a> contains <a
236
+ href="Track.html">MIDI::Track</a> objects.</p>
237
+
238
+ </div><!-- description -->
239
+
240
+
241
+
242
+
243
+ <section id="5Buntitled-5D" class="documentation-section">
244
+
245
+
246
+
247
+
248
+
249
+ <!-- Constants -->
250
+ <section id="constants-list" class="section">
251
+ <h3 class="section-header">Constants</h3>
252
+ <dl>
253
+
254
+ <dt id="DEFAULT_TEMPO">DEFAULT_TEMPO
255
+
256
+ <dd class="description">
257
+
258
+
259
+ <dt id="NOTE_TO_LENGTH">NOTE_TO_LENGTH
260
+
261
+ <dd class="description">
262
+
263
+
264
+ <dt id="UNNAMED">UNNAMED
265
+
266
+ <dd class="description">
267
+
268
+
269
+ </dl>
270
+ </section>
271
+
272
+
273
+
274
+ <!-- Attributes -->
275
+ <section id="attribute-method-details" class="method-section section">
276
+ <h3 class="section-header">Attributes</h3>
277
+
278
+
279
+ <div id="attribute-i-clocks" class="method-detail">
280
+ <div class="method-heading attribute-method-heading">
281
+ <span class="method-name">clocks</span><span
282
+ class="attribute-access-type">[RW]</span>
283
+ </div>
284
+
285
+ <div class="method-description">
286
+
287
+
288
+
289
+ </div>
290
+ </div>
291
+
292
+ <div id="attribute-i-denom" class="method-detail">
293
+ <div class="method-heading attribute-method-heading">
294
+ <span class="method-name">denom</span><span
295
+ class="attribute-access-type">[RW]</span>
296
+ </div>
297
+
298
+ <div class="method-description">
299
+
300
+
301
+
302
+ </div>
303
+ </div>
304
+
305
+ <div id="attribute-i-format" class="method-detail">
306
+ <div class="method-heading attribute-method-heading">
307
+ <span class="method-name">format</span><span
308
+ class="attribute-access-type">[RW]</span>
309
+ </div>
310
+
311
+ <div class="method-description">
312
+
313
+ <p>The <a href="MIDI.html">MIDI</a> file format (0, 1, or 2)</p>
314
+
315
+ </div>
316
+ </div>
317
+
318
+ <div id="attribute-i-numer" class="method-detail">
319
+ <div class="method-heading attribute-method-heading">
320
+ <span class="method-name">numer</span><span
321
+ class="attribute-access-type">[RW]</span>
322
+ </div>
323
+
324
+ <div class="method-description">
325
+
326
+
327
+
328
+ </div>
329
+ </div>
330
+
331
+ <div id="attribute-i-ppqn" class="method-detail">
332
+ <div class="method-heading attribute-method-heading">
333
+ <span class="method-name">ppqn</span><span
334
+ class="attribute-access-type">[RW]</span>
335
+ </div>
336
+
337
+ <div class="method-description">
338
+
339
+ <p>Pulses (i.e. clocks) Per Quarter Note resolution for the sequence</p>
340
+
341
+ </div>
342
+ </div>
343
+
344
+ <div id="attribute-i-qnotes" class="method-detail">
345
+ <div class="method-heading attribute-method-heading">
346
+ <span class="method-name">qnotes</span><span
347
+ class="attribute-access-type">[RW]</span>
348
+ </div>
349
+
350
+ <div class="method-description">
351
+
352
+
353
+
354
+ </div>
355
+ </div>
356
+
357
+ <div id="attribute-i-reader_class" class="method-detail">
358
+ <div class="method-heading attribute-method-heading">
359
+ <span class="method-name">reader_class</span><span
360
+ class="attribute-access-type">[RW]</span>
361
+ </div>
362
+
363
+ <div class="method-description">
364
+
365
+ <p>The class to use for reading <a href="MIDI.html">MIDI</a> from a stream.
366
+ The default is <a href="IO/SeqReader.html">MIDI::IO::SeqReader</a>. You can
367
+ change this at any time.</p>
368
+
369
+ </div>
370
+ </div>
371
+
372
+ <div id="attribute-i-tracks" class="method-detail">
373
+ <div class="method-heading attribute-method-heading">
374
+ <span class="method-name">tracks</span><span
375
+ class="attribute-access-type">[RW]</span>
376
+ </div>
377
+
378
+ <div class="method-description">
379
+
380
+ <p>Array with all tracks for the sequence</p>
381
+
382
+ </div>
383
+ </div>
384
+
385
+ <div id="attribute-i-writer_class" class="method-detail">
386
+ <div class="method-heading attribute-method-heading">
387
+ <span class="method-name">writer_class</span><span
388
+ class="attribute-access-type">[RW]</span>
389
+ </div>
390
+
391
+ <div class="method-description">
392
+
393
+ <p>The class to use for writeing <a href="MIDI.html">MIDI</a> from a stream.
394
+ The default is <a href="IO/SeqWriter.html">MIDI::IO::SeqWriter</a>. You can
395
+ change this at any time.</p>
396
+
397
+ </div>
398
+ </div>
399
+
400
+ </section><!-- attribute-method-details -->
401
+
402
+
403
+ <!-- Methods -->
404
+
405
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
406
+ <h3 class="section-header">Public Class Methods</h3>
407
+
408
+
409
+ <div id="method-c-new" class="method-detail ">
410
+
411
+ <div class="method-heading">
412
+ <span class="method-name">new</span><span
413
+ class="method-args">()</span>
414
+ <span class="method-click-advice">click to toggle source</span>
415
+ </div>
416
+
417
+
418
+ <div class="method-description">
419
+
420
+
421
+
422
+
423
+
424
+ <div class="method-source-code" id="new-source">
425
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 45</span>
426
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
427
+ <span class="ruby-ivar">@tracks</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
428
+ <span class="ruby-ivar">@ppqn</span> = <span class="ruby-value">480</span>
429
+
430
+ <span class="ruby-comment"># Time signature</span>
431
+ <span class="ruby-ivar">@numer</span> = <span class="ruby-value">4</span> <span class="ruby-comment"># Numer + denom = 4/4 time default</span>
432
+ <span class="ruby-ivar">@denom</span> = <span class="ruby-value">2</span>
433
+ <span class="ruby-ivar">@clocks</span> = <span class="ruby-value">24</span> <span class="ruby-comment"># Bug fix Nov 11, 2007 - this is not the same as ppqn!</span>
434
+ <span class="ruby-ivar">@qnotes</span> = <span class="ruby-value">8</span>
435
+
436
+ <span class="ruby-ivar">@reader_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqReader</span>
437
+ <span class="ruby-ivar">@writer_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqWriter</span>
438
+ <span class="ruby-keyword">end</span></pre>
439
+ </div><!-- new-source -->
440
+
441
+ </div>
442
+
443
+
444
+
445
+
446
+ </div><!-- new-method -->
447
+
448
+
449
+ </section><!-- public-class-method-details -->
450
+
451
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
452
+ <h3 class="section-header">Public Instance Methods</h3>
453
+
454
+
455
+ <div id="method-i-beats_per_minute" class="method-detail ">
456
+
457
+ <div class="method-heading">
458
+ <span class="method-name">beats_per_minute</span><span
459
+ class="method-args">()</span>
460
+ <span class="method-click-advice">click to toggle source</span>
461
+ </div>
462
+
463
+
464
+ <div class="method-description">
465
+
466
+ <p>Returns the song tempo in beats per minute.</p>
467
+
468
+
469
+
470
+ <div class="method-source-code" id="beats_per_minute-source">
471
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 68</span>
472
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">beats_per_minute</span>
473
+ <span class="ruby-keyword">return</span> <span class="ruby-constant">DEFAULT_TEMPO</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
474
+ <span class="ruby-identifier">event</span> = <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">events</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
475
+ <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Tempo</span>)
476
+ }
477
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">?</span> (<span class="ruby-constant">Tempo</span>.<span class="ruby-identifier">mpq_to_bpm</span>(<span class="ruby-identifier">event</span>.<span class="ruby-identifier">tempo</span>)) <span class="ruby-operator">:</span> <span class="ruby-constant">DEFAULT_TEMPO</span>
478
+ <span class="ruby-keyword">end</span></pre>
479
+ </div><!-- beats_per_minute-source -->
480
+
481
+ </div>
482
+
483
+
484
+ <div class="aliases">
485
+ Also aliased as: <a href="Sequence.html#method-i-bpm">bpm</a>, <a href="Sequence.html#method-i-tempo">tempo</a>
486
+ </div>
487
+
488
+
489
+
490
+ </div><!-- beats_per_minute-method -->
491
+
492
+
493
+ <div id="method-i-bpm" class="method-detail method-alias">
494
+
495
+ <div class="method-heading">
496
+ <span class="method-name">bpm</span><span
497
+ class="method-args">()</span>
498
+ <span class="method-click-advice">click to toggle source</span>
499
+ </div>
500
+
501
+
502
+ <div class="method-description">
503
+
504
+
505
+
506
+
507
+
508
+ </div>
509
+
510
+
511
+
512
+
513
+ <div class="aliases">
514
+ Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
515
+ </div>
516
+
517
+ </div><!-- bpm-method -->
518
+
519
+
520
+ <div id="method-i-each" class="method-detail ">
521
+
522
+ <div class="method-heading">
523
+ <span class="method-name">each</span><span
524
+ class="method-args">() { |track| ... }</span>
525
+ <span class="method-click-advice">click to toggle source</span>
526
+ </div>
527
+
528
+
529
+ <div class="method-description">
530
+
531
+ <p>Iterates over the tracks.</p>
532
+
533
+
534
+
535
+ <div class="method-source-code" id="each-source">
536
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 151</span>
537
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">each</span> <span class="ruby-comment"># :yields: track</span>
538
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">track</span> <span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">track</span> }
539
+ <span class="ruby-keyword">end</span></pre>
540
+ </div><!-- each-source -->
541
+
542
+ </div>
543
+
544
+
545
+
546
+
547
+ </div><!-- each-method -->
548
+
549
+
550
+ <div id="method-i-get_measures" class="method-detail ">
551
+
552
+ <div class="method-heading">
553
+ <span class="method-name">get_measures</span><span
554
+ class="method-args">()</span>
555
+ <span class="method-click-advice">click to toggle source</span>
556
+ </div>
557
+
558
+
559
+ <div class="method-description">
560
+
561
+ <p>Returns a <a href="Measures.html">Measures</a> object, which is an array
562
+ container for all measures in the sequence</p>
563
+
564
+
565
+
566
+ <div class="method-source-code" id="get_measures-source">
567
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 157</span>
568
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_measures</span>
569
+ <span class="ruby-comment"># Collect time sig events and scan for last event time</span>
570
+ <span class="ruby-identifier">time_sigs</span> = []
571
+ <span class="ruby-identifier">max_pos</span> = <span class="ruby-value">0</span>
572
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
573
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
574
+ <span class="ruby-identifier">time_sigs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeSig</span>)
575
+ <span class="ruby-identifier">max_pos</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_pos</span>
576
+ }
577
+ }
578
+ <span class="ruby-identifier">time_sigs</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">time_from_start</span> }
579
+
580
+ <span class="ruby-comment"># Add a &quot;fake&quot; time sig event at the very last position of the sequence,</span>
581
+ <span class="ruby-comment"># just to make sure the whole sequence is calculated.</span>
582
+ <span class="ruby-identifier">t</span> = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeSig</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">4</span>, <span class="ruby-value">2</span>, <span class="ruby-value">24</span>, <span class="ruby-value">8</span>, <span class="ruby-value">0</span>)
583
+ <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time_from_start</span> = <span class="ruby-identifier">max_pos</span>
584
+ <span class="ruby-identifier">time_sigs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">t</span>
585
+
586
+ <span class="ruby-comment"># Default to 4/4</span>
587
+ <span class="ruby-identifier">measure_length</span> = <span class="ruby-ivar">@ppqn</span> * <span class="ruby-value">4</span>
588
+ <span class="ruby-identifier">oldnumer</span>, <span class="ruby-identifier">olddenom</span>, <span class="ruby-identifier">oldbeats</span> = <span class="ruby-value">4</span>, <span class="ruby-value">2</span>, <span class="ruby-value">24</span>
589
+
590
+ <span class="ruby-identifier">measures</span> = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Measures</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">max_pos</span>, <span class="ruby-ivar">@ppqn</span>)
591
+ <span class="ruby-identifier">curr_pos</span> = <span class="ruby-value">0</span>
592
+ <span class="ruby-identifier">curr_meas_no</span> = <span class="ruby-value">1</span>
593
+ <span class="ruby-identifier">time_sigs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">te</span><span class="ruby-operator">|</span>
594
+ <span class="ruby-identifier">meas_count</span> = (<span class="ruby-identifier">te</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">curr_pos</span>) <span class="ruby-operator">/</span> <span class="ruby-identifier">measure_length</span>
595
+ <span class="ruby-identifier">meas_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> (<span class="ruby-identifier">te</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">curr_pos</span>) <span class="ruby-operator">%</span> <span class="ruby-identifier">measure_length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
596
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">meas_count</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
597
+ <span class="ruby-identifier">measures</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Measure</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">curr_meas_no</span>,
598
+ <span class="ruby-identifier">curr_pos</span>, <span class="ruby-identifier">measure_length</span>, <span class="ruby-identifier">oldnumer</span>, <span class="ruby-identifier">olddenom</span>, <span class="ruby-identifier">oldbeats</span>)
599
+ <span class="ruby-identifier">curr_meas_no</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
600
+ <span class="ruby-identifier">curr_pos</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">measure_length</span>
601
+ }
602
+ <span class="ruby-identifier">oldnumer</span>, <span class="ruby-identifier">olddenom</span>, <span class="ruby-identifier">oldbeats</span> = <span class="ruby-identifier">te</span>.<span class="ruby-identifier">numerator</span>, <span class="ruby-identifier">te</span>.<span class="ruby-identifier">denominator</span>, <span class="ruby-identifier">te</span>.<span class="ruby-identifier">metronome_ticks</span>
603
+ <span class="ruby-identifier">measure_length</span> = <span class="ruby-identifier">te</span>.<span class="ruby-identifier">measure_duration</span>(<span class="ruby-ivar">@ppqn</span>)
604
+ }
605
+ <span class="ruby-identifier">measures</span>
606
+ <span class="ruby-keyword">end</span></pre>
607
+ </div><!-- get_measures-source -->
608
+
609
+ </div>
610
+
611
+
612
+
613
+
614
+ </div><!-- get_measures-method -->
615
+
616
+
617
+ <div id="method-i-length_to_delta" class="method-detail ">
618
+
619
+ <div class="method-heading">
620
+ <span class="method-name">length_to_delta</span><span
621
+ class="method-args">(length)</span>
622
+ <span class="method-click-advice">click to toggle source</span>
623
+ </div>
624
+
625
+
626
+ <div class="method-description">
627
+
628
+ <p>Translates <code>length</code> (a multiple of a quarter note) into a delta
629
+ time. For example, 1 is a quarter note, 1.0/32.0 is a 32nd note, 1.5 is a
630
+ dotted quarter, etc. Be aware when using division; 1/32 is zero due to
631
+ integer mathematics and rounding. Use floating-point numbers like 1.0 and
632
+ 32.0. This method always returns an integer.</p>
633
+
634
+ <p>See also <a href="Sequence.html#method-i-note_to_delta">#note_to_delta</a>
635
+ and note_to_length.</p>
636
+
637
+
638
+
639
+ <div class="method-source-code" id="length_to_delta-source">
640
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 121</span>
641
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">length</span>)
642
+ <span class="ruby-keyword">return</span> (<span class="ruby-ivar">@ppqn</span> * <span class="ruby-identifier">length</span>).<span class="ruby-identifier">to_i</span>
643
+ <span class="ruby-keyword">end</span></pre>
644
+ </div><!-- length_to_delta-source -->
645
+
646
+ </div>
647
+
648
+
649
+
650
+
651
+ </div><!-- length_to_delta-method -->
652
+
653
+
654
+ <div id="method-i-name" class="method-detail ">
655
+
656
+ <div class="method-heading">
657
+ <span class="method-name">name</span><span
658
+ class="method-args">()</span>
659
+ <span class="method-click-advice">click to toggle source</span>
660
+ </div>
661
+
662
+
663
+ <div class="method-description">
664
+
665
+ <p>Returns the name of the first track (track zero). If there are no tracks,
666
+ returns <a href="Sequence.html#UNNAMED">UNNAMED</a>.</p>
667
+
668
+
669
+
670
+ <div class="method-source-code" id="name-source">
671
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 127</span>
672
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>
673
+ <span class="ruby-keyword">return</span> <span class="ruby-constant">UNNAMED</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
674
+ <span class="ruby-keyword">return</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span>()
675
+ <span class="ruby-keyword">end</span></pre>
676
+ </div><!-- name-source -->
677
+
678
+ </div>
679
+
680
+
681
+
682
+
683
+ </div><!-- name-method -->
684
+
685
+
686
+ <div id="method-i-name-3D" class="method-detail ">
687
+
688
+ <div class="method-heading">
689
+ <span class="method-name">name=</span><span
690
+ class="method-args">(name)</span>
691
+ <span class="method-click-advice">click to toggle source</span>
692
+ </div>
693
+
694
+
695
+ <div class="method-description">
696
+
697
+ <p>Hands the name to the first track. Does nothing if there are no tracks.</p>
698
+
699
+
700
+
701
+ <div class="method-source-code" id="name-3D-source">
702
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 133</span>
703
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">name=</span>(<span class="ruby-identifier">name</span>)
704
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
705
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
706
+ <span class="ruby-keyword">end</span></pre>
707
+ </div><!-- name-3D-source -->
708
+
709
+ </div>
710
+
711
+
712
+
713
+
714
+ </div><!-- name-3D-method -->
715
+
716
+
717
+ <div id="method-i-note_to_delta" class="method-detail ">
718
+
719
+ <div class="method-heading">
720
+ <span class="method-name">note_to_delta</span><span
721
+ class="method-args">(name)</span>
722
+ <span class="method-click-advice">click to toggle source</span>
723
+ </div>
724
+
725
+
726
+ <div class="method-description">
727
+
728
+ <p>Given a note length name like "whole", "dotted quarter", or "8th triplet",
729
+ return the length of that note in quarter notes as a delta time.</p>
730
+
731
+
732
+
733
+ <div class="method-source-code" id="note_to_delta-source">
734
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 88</span>
735
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">note_to_delta</span>(<span class="ruby-identifier">name</span>)
736
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">note_to_length</span>(<span class="ruby-identifier">name</span>))
737
+ <span class="ruby-keyword">end</span></pre>
738
+ </div><!-- note_to_delta-source -->
739
+
740
+ </div>
741
+
742
+
743
+
744
+
745
+ </div><!-- note_to_delta-method -->
746
+
747
+
748
+ <div id="method-i-note_to_length" class="method-detail ">
749
+
750
+ <div class="method-heading">
751
+ <span class="method-name">note_to_length</span><span
752
+ class="method-args">(name)</span>
753
+ <span class="method-click-advice">click to toggle source</span>
754
+ </div>
755
+
756
+
757
+ <div class="method-description">
758
+
759
+ <p>Given a note length name like "whole", "dotted quarter", or "8th triplet",
760
+ return the length of that note in quarter notes as a floating-point number,
761
+ suitable for use as an argument to length_to_delta.</p>
762
+
763
+ <p>Legal names are any value in <a
764
+ href="Sequence.html#NOTE_TO_LENGTH">NOTE_TO_LENGTH</a>, optionally prefixed
765
+ by "dotted_" and/or suffixed by "_triplet". So, for example,
766
+ "dotted_quarter_triplet" returns the length of a dotted quarter-note
767
+ triplet and "32nd" returns 1/32.</p>
768
+
769
+
770
+
771
+ <div class="method-source-code" id="note_to_length-source">
772
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 101</span>
773
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">note_to_length</span>(<span class="ruby-identifier">name</span>)
774
+ <span class="ruby-identifier">name</span>.<span class="ruby-identifier">strip!</span>
775
+ <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r^(dotted)?(.*?)(triplet)?$/</span>
776
+ <span class="ruby-identifier">dotted</span>, <span class="ruby-identifier">note_name</span>, <span class="ruby-identifier">triplet</span> = <span class="ruby-node">$1</span>, <span class="ruby-node">$2</span>, <span class="ruby-node">$3</span>
777
+ <span class="ruby-identifier">note_name</span>.<span class="ruby-identifier">strip!</span>
778
+ <span class="ruby-identifier">mult</span> = <span class="ruby-value">1.0</span>
779
+ <span class="ruby-identifier">mult</span> = <span class="ruby-value">1.5</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">dotted</span>
780
+ <span class="ruby-identifier">mult</span> <span class="ruby-operator">/=</span> <span class="ruby-value">3.0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">triplet</span>
781
+ <span class="ruby-identifier">len</span> = <span class="ruby-constant">NOTE_TO_LENGTH</span>[<span class="ruby-identifier">note_name</span>]
782
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Sequence.note_to_length: \&quot;#{note_name}\&quot; not understood in \&quot;#{name}\&quot;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">len</span>
783
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">len</span> * <span class="ruby-identifier">mult</span>
784
+ <span class="ruby-keyword">end</span></pre>
785
+ </div><!-- note_to_length-source -->
786
+
787
+ </div>
788
+
789
+
790
+
791
+
792
+ </div><!-- note_to_length-method -->
793
+
794
+
795
+ <div id="method-i-pulses_to_seconds" class="method-detail ">
796
+
797
+ <div class="method-heading">
798
+ <span class="method-name">pulses_to_seconds</span><span
799
+ class="method-args">(pulses)</span>
800
+ <span class="method-click-advice">click to toggle source</span>
801
+ </div>
802
+
803
+
804
+ <div class="method-description">
805
+
806
+ <p>Pulses (also called ticks) are the units of delta times and event
807
+ time_from_start values. This method converts a number of pulses to a float
808
+ value that is a time in seconds.</p>
809
+
810
+
811
+
812
+ <div class="method-source-code" id="pulses_to_seconds-source">
813
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 81</span>
814
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">pulses_to_seconds</span>(<span class="ruby-identifier">pulses</span>)
815
+ (<span class="ruby-identifier">pulses</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@ppqn</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">beats_per_minute</span>()) * <span class="ruby-value">60.0</span>
816
+ <span class="ruby-keyword">end</span></pre>
817
+ </div><!-- pulses_to_seconds-source -->
818
+
819
+ </div>
820
+
821
+
822
+
823
+
824
+ </div><!-- pulses_to_seconds-method -->
825
+
826
+
827
+ <div id="method-i-read" class="method-detail ">
828
+
829
+ <div class="method-heading">
830
+ <span class="method-name">read</span><span
831
+ class="method-args">(io, proc = nil) { |track, num_tracks, index| ... }</span>
832
+ <span class="method-click-advice">click to toggle source</span>
833
+ </div>
834
+
835
+
836
+ <div class="method-description">
837
+
838
+ <p>Reads a <a href="MIDI.html">MIDI</a> stream.</p>
839
+
840
+
841
+
842
+ <div class="method-source-code" id="read-source">
843
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 139</span>
844
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">io</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-comment"># :yields: track, num_tracks, index</span>
845
+ <span class="ruby-identifier">reader</span> = <span class="ruby-ivar">@reader_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</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>)
846
+ <span class="ruby-identifier">reader</span>.<span class="ruby-identifier">read_from</span>(<span class="ruby-identifier">io</span>)
847
+ <span class="ruby-keyword">end</span></pre>
848
+ </div><!-- read-source -->
849
+
850
+ </div>
851
+
852
+
853
+
854
+
855
+ </div><!-- read-method -->
856
+
857
+
858
+ <div id="method-i-tempo" class="method-detail method-alias">
859
+
860
+ <div class="method-heading">
861
+ <span class="method-name">tempo</span><span
862
+ class="method-args">()</span>
863
+ <span class="method-click-advice">click to toggle source</span>
864
+ </div>
865
+
866
+
867
+ <div class="method-description">
868
+
869
+
870
+
871
+
872
+
873
+ </div>
874
+
875
+
876
+
877
+
878
+ <div class="aliases">
879
+ Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
880
+ </div>
881
+
882
+ </div><!-- tempo-method -->
883
+
884
+
885
+ <div id="method-i-time_signature" class="method-detail ">
886
+
887
+ <div class="method-heading">
888
+ <span class="method-name">time_signature</span><span
889
+ class="method-args">(numer, denom, clocks, qnotes)</span>
890
+ <span class="method-click-advice">click to toggle source</span>
891
+ </div>
892
+
893
+
894
+ <div class="method-description">
895
+
896
+ <p>Sets the time signature.</p>
897
+
898
+
899
+
900
+ <div class="method-source-code" id="time_signature-source">
901
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 60</span>
902
+ <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>)
903
+ <span class="ruby-ivar">@numer</span> = <span class="ruby-identifier">numer</span>
904
+ <span class="ruby-ivar">@denom</span> = <span class="ruby-identifier">denom</span>
905
+ <span class="ruby-ivar">@clocks</span> = <span class="ruby-identifier">clocks</span>
906
+ <span class="ruby-ivar">@qnotes</span> = <span class="ruby-identifier">qnotes</span>
907
+ <span class="ruby-keyword">end</span></pre>
908
+ </div><!-- time_signature-source -->
909
+
910
+ </div>
911
+
912
+
913
+
914
+
915
+ </div><!-- time_signature-method -->
916
+
917
+
918
+ <div id="method-i-write" class="method-detail ">
919
+
920
+ <div class="method-heading">
921
+ <span class="method-name">write</span><span
922
+ class="method-args">(io, proc = nil) { |track, num_tracks, index| ... }</span>
923
+ <span class="method-click-advice">click to toggle source</span>
924
+ </div>
925
+
926
+
927
+ <div class="method-description">
928
+
929
+ <p>Writes to a <a href="MIDI.html">MIDI</a> stream.</p>
930
+
931
+
932
+
933
+ <div class="method-source-code" id="write-source">
934
+ <pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 145</span>
935
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">io</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-comment"># :yields: track, num_tracks, index</span>
936
+ <span class="ruby-identifier">writer</span> = <span class="ruby-ivar">@writer_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</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>)
937
+ <span class="ruby-identifier">writer</span>.<span class="ruby-identifier">write_to</span>(<span class="ruby-identifier">io</span>)
938
+ <span class="ruby-keyword">end</span></pre>
939
+ </div><!-- write-source -->
940
+
941
+ </div>
942
+
943
+
944
+
945
+
946
+ </div><!-- write-method -->
947
+
948
+
949
+ </section><!-- public-instance-method-details -->
950
+
951
+ </section><!-- 5Buntitled-5D -->
952
+
953
+ </div><!-- documentation -->
954
+
955
+
956
+ <footer id="validator-badges">
957
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
958
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
959
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
960
+ </footer>
961
+