midilib 2.0.5 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog +2 -1
- data/Credits +39 -2
- data/README.rdoc +5 -6
- data/Rakefile +36 -49
- data/TODO.rdoc +13 -2
- data/examples/from_scratch.rb +1 -1
- data/examples/measures_mbt.rb +11 -11
- data/examples/print_program_changes.rb +2 -2
- data/examples/reader2text.rb +47 -47
- data/examples/seq2text.rb +1 -1
- data/examples/split.rb +4 -3
- data/examples/strings.rb +4 -4
- data/examples/transpose.rb +19 -20
- data/install.rb +21 -13
- data/lib/midilib/consts.rb +237 -239
- data/lib/midilib/event.rb +128 -100
- data/lib/midilib/info.rb +3 -5
- data/lib/midilib/io/midifile.rb +155 -182
- data/lib/midilib/io/seqreader.rb +80 -85
- data/lib/midilib/io/seqwriter.rb +93 -88
- data/lib/midilib/measure.rb +78 -80
- data/lib/midilib/mergesort.rb +39 -0
- data/lib/midilib/sequence.rb +40 -32
- data/lib/midilib/track.rb +16 -57
- data/lib/midilib/utils.rb +4 -7
- data/lib/midilib.rb +5 -5
- data/test/event_equality.rb +28 -30
- data/test/test_event.rb +9 -11
- data/test/test_io.rb +83 -3
- data/test/test_mergesort.rb +37 -0
- data/test/test_midifile.rb +6 -19
- data/test/test_sequence.rb +5 -4
- data/test/test_track.rb +9 -38
- data/test/test_varlen.rb +1 -3
- metadata +8 -95
- data/html/IO.html +0 -155
- data/html/MIDI/ActiveSense.html +0 -206
- data/html/MIDI/ChannelEvent.html +0 -231
- data/html/MIDI/ChannelPressure.html +0 -265
- data/html/MIDI/Clock.html +0 -206
- data/html/MIDI/Continue.html +0 -206
- data/html/MIDI/Controller.html +0 -280
- data/html/MIDI/Event.html +0 -489
- data/html/MIDI/IO/MIDIFile.html +0 -2024
- data/html/MIDI/IO/SeqReader.html +0 -904
- data/html/MIDI/IO/SeqWriter.html +0 -572
- data/html/MIDI/IO.html +0 -95
- data/html/MIDI/KeySig.html +0 -353
- data/html/MIDI/MIDI/MIDI/Array.html +0 -255
- data/html/MIDI/MIDI/MIDI.html +0 -95
- data/html/MIDI/MIDI.html +0 -95
- data/html/MIDI/Marker.html +0 -158
- data/html/MIDI/Measure.html +0 -328
- data/html/MIDI/Measures.html +0 -285
- data/html/MIDI/MetaEvent.html +0 -461
- data/html/MIDI/NoteEvent.html +0 -331
- data/html/MIDI/NoteOff.html +0 -228
- data/html/MIDI/NoteOn.html +0 -228
- data/html/MIDI/PitchBend.html +0 -266
- data/html/MIDI/PolyPressure.html +0 -277
- data/html/MIDI/ProgramChange.html +0 -265
- data/html/MIDI/Realtime.html +0 -242
- data/html/MIDI/Sequence.html +0 -896
- data/html/MIDI/SongPointer.html +0 -266
- data/html/MIDI/SongSelect.html +0 -265
- data/html/MIDI/Start.html +0 -206
- data/html/MIDI/Stop.html +0 -206
- data/html/MIDI/SystemCommon.html +0 -158
- data/html/MIDI/SystemExclusive.html +0 -268
- data/html/MIDI/SystemReset.html +0 -206
- data/html/MIDI/Tempo.html +0 -396
- data/html/MIDI/TimeSig.html +0 -388
- data/html/MIDI/Track.html +0 -695
- data/html/MIDI/TuneRequest.html +0 -242
- data/html/MIDI/Utils.html +0 -220
- data/html/MIDI.html +0 -547
- data/html/README_rdoc.html +0 -731
- data/html/TODO_rdoc.html +0 -125
- data/html/created.rid +0 -14
- data/html/css/fonts.css +0 -167
- data/html/css/rdoc.css +0 -590
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +0 -768
- data/html/js/darkfish.js +0 -161
- data/html/js/jquery.js +0 -4
- data/html/js/navigation.js +0 -142
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +0 -109
- data/html/js/search_index.js +0 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +0 -228
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +0 -1265
data/html/MIDI/Sequence.html
DELETED
@@ -1,896 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class MIDI::Sequence - midilib</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../js/jquery.js"></script>
|
14
|
-
<script src="../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="class">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
<div id="parent-class-section" class="nav-section">
|
58
|
-
<h3>Parent</h3>
|
59
|
-
|
60
|
-
|
61
|
-
<p class="link">Object
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
<div id="includes-section" class="nav-section">
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><span class="include">Enumerable</span>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
|
78
|
-
<!-- Method Quickref -->
|
79
|
-
<div id="method-list-section" class="nav-section">
|
80
|
-
<h3>Methods</h3>
|
81
|
-
|
82
|
-
<ul class="link-list" role="directory">
|
83
|
-
|
84
|
-
<li ><a href="#method-c-new">::new</a>
|
85
|
-
|
86
|
-
<li ><a href="#method-i-beats_per_minute">#beats_per_minute</a>
|
87
|
-
|
88
|
-
<li ><a href="#method-i-bpm">#bpm</a>
|
89
|
-
|
90
|
-
<li ><a href="#method-i-each">#each</a>
|
91
|
-
|
92
|
-
<li ><a href="#method-i-get_measures">#get_measures</a>
|
93
|
-
|
94
|
-
<li ><a href="#method-i-length_to_delta">#length_to_delta</a>
|
95
|
-
|
96
|
-
<li ><a href="#method-i-name">#name</a>
|
97
|
-
|
98
|
-
<li ><a href="#method-i-name-3D">#name=</a>
|
99
|
-
|
100
|
-
<li ><a href="#method-i-note_to_delta">#note_to_delta</a>
|
101
|
-
|
102
|
-
<li ><a href="#method-i-note_to_length">#note_to_length</a>
|
103
|
-
|
104
|
-
<li ><a href="#method-i-pulses_to_seconds">#pulses_to_seconds</a>
|
105
|
-
|
106
|
-
<li ><a href="#method-i-read">#read</a>
|
107
|
-
|
108
|
-
<li ><a href="#method-i-tempo">#tempo</a>
|
109
|
-
|
110
|
-
<li ><a href="#method-i-time_signature">#time_signature</a>
|
111
|
-
|
112
|
-
<li ><a href="#method-i-write">#write</a>
|
113
|
-
|
114
|
-
</ul>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
</div>
|
118
|
-
</nav>
|
119
|
-
|
120
|
-
<main role="main" aria-labelledby="class-MIDI::Sequence">
|
121
|
-
<h1 id="class-MIDI::Sequence" class="class">
|
122
|
-
class MIDI::Sequence
|
123
|
-
</h1>
|
124
|
-
|
125
|
-
<section class="description">
|
126
|
-
|
127
|
-
<p>A <a href="Sequence.html">MIDI::Sequence</a> contains <a
|
128
|
-
href="Track.html">MIDI::Track</a> objects.</p>
|
129
|
-
|
130
|
-
</section>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
<section class="constants-list">
|
142
|
-
<header>
|
143
|
-
<h3>Constants</h3>
|
144
|
-
</header>
|
145
|
-
<dl>
|
146
|
-
|
147
|
-
<dt id="DEFAULT_TEMPO">DEFAULT_TEMPO
|
148
|
-
|
149
|
-
<dd>
|
150
|
-
|
151
|
-
|
152
|
-
<dt id="NOTE_TO_LENGTH">NOTE_TO_LENGTH
|
153
|
-
|
154
|
-
<dd>
|
155
|
-
|
156
|
-
|
157
|
-
<dt id="UNNAMED">UNNAMED
|
158
|
-
|
159
|
-
<dd>
|
160
|
-
|
161
|
-
|
162
|
-
</dl>
|
163
|
-
</section>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
<section class="attribute-method-details" class="method-section">
|
168
|
-
<header>
|
169
|
-
<h3>Attributes</h3>
|
170
|
-
</header>
|
171
|
-
|
172
|
-
|
173
|
-
<div id="attribute-i-clocks" class="method-detail">
|
174
|
-
<div class="method-heading attribute-method-heading">
|
175
|
-
<span class="method-name">clocks</span><span
|
176
|
-
class="attribute-access-type">[RW]</span>
|
177
|
-
</div>
|
178
|
-
|
179
|
-
<div class="method-description">
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div id="attribute-i-denom" class="method-detail">
|
187
|
-
<div class="method-heading attribute-method-heading">
|
188
|
-
<span class="method-name">denom</span><span
|
189
|
-
class="attribute-access-type">[RW]</span>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div class="method-description">
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
</div>
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<div id="attribute-i-format" class="method-detail">
|
200
|
-
<div class="method-heading attribute-method-heading">
|
201
|
-
<span class="method-name">format</span><span
|
202
|
-
class="attribute-access-type">[RW]</span>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
<div class="method-description">
|
206
|
-
|
207
|
-
<p>The <a href="MIDI.html">MIDI</a> file format (0, 1, or 2)</p>
|
208
|
-
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
<div id="attribute-i-numer" class="method-detail">
|
213
|
-
<div class="method-heading attribute-method-heading">
|
214
|
-
<span class="method-name">numer</span><span
|
215
|
-
class="attribute-access-type">[RW]</span>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
</div>
|
223
|
-
</div>
|
224
|
-
|
225
|
-
<div id="attribute-i-ppqn" class="method-detail">
|
226
|
-
<div class="method-heading attribute-method-heading">
|
227
|
-
<span class="method-name">ppqn</span><span
|
228
|
-
class="attribute-access-type">[RW]</span>
|
229
|
-
</div>
|
230
|
-
|
231
|
-
<div class="method-description">
|
232
|
-
|
233
|
-
<p>Pulses (i.e. clocks) Per Quarter Note resolution for the sequence</p>
|
234
|
-
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
|
238
|
-
<div id="attribute-i-qnotes" class="method-detail">
|
239
|
-
<div class="method-heading attribute-method-heading">
|
240
|
-
<span class="method-name">qnotes</span><span
|
241
|
-
class="attribute-access-type">[RW]</span>
|
242
|
-
</div>
|
243
|
-
|
244
|
-
<div class="method-description">
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
</div>
|
249
|
-
</div>
|
250
|
-
|
251
|
-
<div id="attribute-i-reader_class" class="method-detail">
|
252
|
-
<div class="method-heading attribute-method-heading">
|
253
|
-
<span class="method-name">reader_class</span><span
|
254
|
-
class="attribute-access-type">[RW]</span>
|
255
|
-
</div>
|
256
|
-
|
257
|
-
<div class="method-description">
|
258
|
-
|
259
|
-
<p>The class to use for reading <a href="MIDI.html">MIDI</a> from a stream.
|
260
|
-
The default is <a href="IO/SeqReader.html">MIDI::IO::SeqReader</a>. You can
|
261
|
-
change this at any time.</p>
|
262
|
-
|
263
|
-
</div>
|
264
|
-
</div>
|
265
|
-
|
266
|
-
<div id="attribute-i-tracks" class="method-detail">
|
267
|
-
<div class="method-heading attribute-method-heading">
|
268
|
-
<span class="method-name">tracks</span><span
|
269
|
-
class="attribute-access-type">[RW]</span>
|
270
|
-
</div>
|
271
|
-
|
272
|
-
<div class="method-description">
|
273
|
-
|
274
|
-
<p>Array with all tracks for the sequence</p>
|
275
|
-
|
276
|
-
</div>
|
277
|
-
</div>
|
278
|
-
|
279
|
-
<div id="attribute-i-writer_class" class="method-detail">
|
280
|
-
<div class="method-heading attribute-method-heading">
|
281
|
-
<span class="method-name">writer_class</span><span
|
282
|
-
class="attribute-access-type">[RW]</span>
|
283
|
-
</div>
|
284
|
-
|
285
|
-
<div class="method-description">
|
286
|
-
|
287
|
-
<p>The class to use for writeing <a href="MIDI.html">MIDI</a> from a stream.
|
288
|
-
The default is <a href="IO/SeqWriter.html">MIDI::IO::SeqWriter</a>. You can
|
289
|
-
change this at any time.</p>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
</div>
|
293
|
-
|
294
|
-
</section>
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
299
|
-
<header>
|
300
|
-
<h3>Public Class Methods</h3>
|
301
|
-
</header>
|
302
|
-
|
303
|
-
|
304
|
-
<div id="method-c-new" class="method-detail ">
|
305
|
-
|
306
|
-
<div class="method-heading">
|
307
|
-
<span class="method-name">new</span><span
|
308
|
-
class="method-args">()</span>
|
309
|
-
|
310
|
-
<span class="method-click-advice">click to toggle source</span>
|
311
|
-
|
312
|
-
</div>
|
313
|
-
|
314
|
-
|
315
|
-
<div class="method-description">
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
<div class="method-source-code" id="new-source">
|
323
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 45</span>
|
324
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
|
325
|
-
<span class="ruby-ivar">@tracks</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
|
326
|
-
<span class="ruby-ivar">@ppqn</span> = <span class="ruby-value">480</span>
|
327
|
-
|
328
|
-
<span class="ruby-comment"># Time signature</span>
|
329
|
-
<span class="ruby-ivar">@numer</span> = <span class="ruby-value">4</span> <span class="ruby-comment"># Numer + denom = 4/4 time default</span>
|
330
|
-
<span class="ruby-ivar">@denom</span> = <span class="ruby-value">2</span>
|
331
|
-
<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>
|
332
|
-
<span class="ruby-ivar">@qnotes</span> = <span class="ruby-value">8</span>
|
333
|
-
|
334
|
-
<span class="ruby-ivar">@reader_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqReader</span>
|
335
|
-
<span class="ruby-ivar">@writer_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqWriter</span>
|
336
|
-
<span class="ruby-keyword">end</span></pre>
|
337
|
-
</div>
|
338
|
-
|
339
|
-
</div>
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
</div>
|
345
|
-
|
346
|
-
|
347
|
-
</section>
|
348
|
-
|
349
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
350
|
-
<header>
|
351
|
-
<h3>Public Instance Methods</h3>
|
352
|
-
</header>
|
353
|
-
|
354
|
-
|
355
|
-
<div id="method-i-beats_per_minute" class="method-detail ">
|
356
|
-
|
357
|
-
<div class="method-heading">
|
358
|
-
<span class="method-name">beats_per_minute</span><span
|
359
|
-
class="method-args">()</span>
|
360
|
-
|
361
|
-
<span class="method-click-advice">click to toggle source</span>
|
362
|
-
|
363
|
-
</div>
|
364
|
-
|
365
|
-
|
366
|
-
<div class="method-description">
|
367
|
-
|
368
|
-
<p>Returns the song tempo in beats per minute.</p>
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
<div class="method-source-code" id="beats_per_minute-source">
|
374
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 68</span>
|
375
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">beats_per_minute</span>
|
376
|
-
<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>
|
377
|
-
<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> <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>) }
|
378
|
-
<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>
|
379
|
-
<span class="ruby-keyword">end</span></pre>
|
380
|
-
</div>
|
381
|
-
|
382
|
-
</div>
|
383
|
-
|
384
|
-
|
385
|
-
<div class="aliases">
|
386
|
-
Also aliased as: <a href="Sequence.html#method-i-bpm">bpm</a>, <a href="Sequence.html#method-i-tempo">tempo</a>
|
387
|
-
</div>
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
</div>
|
392
|
-
|
393
|
-
|
394
|
-
<div id="method-i-bpm" class="method-detail method-alias">
|
395
|
-
|
396
|
-
<div class="method-heading">
|
397
|
-
<span class="method-name">bpm</span><span
|
398
|
-
class="method-args">()</span>
|
399
|
-
|
400
|
-
</div>
|
401
|
-
|
402
|
-
|
403
|
-
<div class="method-description">
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
</div>
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
<div class="aliases">
|
416
|
-
Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
|
417
|
-
</div>
|
418
|
-
|
419
|
-
</div>
|
420
|
-
|
421
|
-
|
422
|
-
<div id="method-i-each" class="method-detail ">
|
423
|
-
|
424
|
-
<div class="method-heading">
|
425
|
-
<span class="method-name">each</span><span
|
426
|
-
class="method-args">() { |track| ... }</span>
|
427
|
-
|
428
|
-
<span class="method-click-advice">click to toggle source</span>
|
429
|
-
|
430
|
-
</div>
|
431
|
-
|
432
|
-
|
433
|
-
<div class="method-description">
|
434
|
-
|
435
|
-
<p>Iterates over the tracks.</p>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
<div class="method-source-code" id="each-source">
|
441
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 149</span>
|
442
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">each</span> <span class="ruby-comment"># :yields: track</span>
|
443
|
-
<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> }
|
444
|
-
<span class="ruby-keyword">end</span></pre>
|
445
|
-
</div>
|
446
|
-
|
447
|
-
</div>
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
</div>
|
453
|
-
|
454
|
-
|
455
|
-
<div id="method-i-get_measures" class="method-detail ">
|
456
|
-
|
457
|
-
<div class="method-heading">
|
458
|
-
<span class="method-name">get_measures</span><span
|
459
|
-
class="method-args">()</span>
|
460
|
-
|
461
|
-
<span class="method-click-advice">click to toggle source</span>
|
462
|
-
|
463
|
-
</div>
|
464
|
-
|
465
|
-
|
466
|
-
<div class="method-description">
|
467
|
-
|
468
|
-
<p>Returns a <a href="Measures.html">Measures</a> object, which is an array
|
469
|
-
container for all measures in the sequence</p>
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
<div class="method-source-code" id="get_measures-source">
|
475
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 155</span>
|
476
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_measures</span>
|
477
|
-
<span class="ruby-comment"># Collect time sig events and scan for last event time</span>
|
478
|
-
<span class="ruby-identifier">time_sigs</span> = []
|
479
|
-
<span class="ruby-identifier">max_pos</span> = <span class="ruby-value">0</span>
|
480
|
-
<span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
481
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
482
|
-
<span class="ruby-identifier">time_sigs</span> <span class="ruby-operator"><<</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>)
|
483
|
-
<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">></span> <span class="ruby-identifier">max_pos</span>
|
484
|
-
<span class="ruby-keyword">end</span>
|
485
|
-
<span class="ruby-keyword">end</span>
|
486
|
-
<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"><=></span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">time_from_start</span> }
|
487
|
-
|
488
|
-
<span class="ruby-comment"># Add a "fake" time sig event at the very last position of the sequence,</span>
|
489
|
-
<span class="ruby-comment"># just to make sure the whole sequence is calculated.</span>
|
490
|
-
<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>)
|
491
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">time_from_start</span> = <span class="ruby-identifier">max_pos</span>
|
492
|
-
<span class="ruby-identifier">time_sigs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span>
|
493
|
-
|
494
|
-
<span class="ruby-comment"># Default to 4/4</span>
|
495
|
-
<span class="ruby-identifier">measure_length</span> = <span class="ruby-ivar">@ppqn</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>
|
496
|
-
<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>
|
497
|
-
|
498
|
-
<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>)
|
499
|
-
<span class="ruby-identifier">curr_pos</span> = <span class="ruby-value">0</span>
|
500
|
-
<span class="ruby-identifier">curr_meas_no</span> = <span class="ruby-value">1</span>
|
501
|
-
<span class="ruby-identifier">time_sigs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">te</span><span class="ruby-operator">|</span>
|
502
|
-
<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>
|
503
|
-
<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">></span> <span class="ruby-value">0</span>
|
504
|
-
<span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">meas_count</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
505
|
-
<span class="ruby-identifier">measures</span> <span class="ruby-operator"><<</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>, <span class="ruby-identifier">curr_pos</span>, <span class="ruby-identifier">measure_length</span>,
|
506
|
-
<span class="ruby-identifier">oldnumer</span>, <span class="ruby-identifier">olddenom</span>, <span class="ruby-identifier">oldbeats</span>)
|
507
|
-
<span class="ruby-identifier">curr_meas_no</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
508
|
-
<span class="ruby-identifier">curr_pos</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">measure_length</span>
|
509
|
-
<span class="ruby-keyword">end</span>
|
510
|
-
<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>
|
511
|
-
<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>)
|
512
|
-
<span class="ruby-keyword">end</span>
|
513
|
-
<span class="ruby-identifier">measures</span>
|
514
|
-
<span class="ruby-keyword">end</span></pre>
|
515
|
-
</div>
|
516
|
-
|
517
|
-
</div>
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
</div>
|
523
|
-
|
524
|
-
|
525
|
-
<div id="method-i-length_to_delta" class="method-detail ">
|
526
|
-
|
527
|
-
<div class="method-heading">
|
528
|
-
<span class="method-name">length_to_delta</span><span
|
529
|
-
class="method-args">(length)</span>
|
530
|
-
|
531
|
-
<span class="method-click-advice">click to toggle source</span>
|
532
|
-
|
533
|
-
</div>
|
534
|
-
|
535
|
-
|
536
|
-
<div class="method-description">
|
537
|
-
|
538
|
-
<p>Translates <code>length</code> (a multiple of a quarter note) into a delta
|
539
|
-
time. For example, 1 is a quarter note, 1.0/32.0 is a 32nd note, 1.5 is a
|
540
|
-
dotted quarter, etc. Be aware when using division; 1/32 is zero due to
|
541
|
-
integer mathematics and rounding. Use floating-point numbers like 1.0 and
|
542
|
-
32.0. This method always returns an integer.</p>
|
543
|
-
|
544
|
-
<p>See also <a href="Sequence.html#method-i-note_to_delta">#note_to_delta</a>
|
545
|
-
and note_to_length.</p>
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
<div class="method-source-code" id="length_to_delta-source">
|
551
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 119</span>
|
552
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">length</span>)
|
553
|
-
<span class="ruby-keyword">return</span> (<span class="ruby-ivar">@ppqn</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">length</span>).<span class="ruby-identifier">to_i</span>
|
554
|
-
<span class="ruby-keyword">end</span></pre>
|
555
|
-
</div>
|
556
|
-
|
557
|
-
</div>
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
</div>
|
563
|
-
|
564
|
-
|
565
|
-
<div id="method-i-name" class="method-detail ">
|
566
|
-
|
567
|
-
<div class="method-heading">
|
568
|
-
<span class="method-name">name</span><span
|
569
|
-
class="method-args">()</span>
|
570
|
-
|
571
|
-
<span class="method-click-advice">click to toggle source</span>
|
572
|
-
|
573
|
-
</div>
|
574
|
-
|
575
|
-
|
576
|
-
<div class="method-description">
|
577
|
-
|
578
|
-
<p>Returns the name of the first track (track zero). If there are no tracks,
|
579
|
-
returns <a href="Sequence.html#UNNAMED">UNNAMED</a>.</p>
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
<div class="method-source-code" id="name-source">
|
585
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 125</span>
|
586
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>
|
587
|
-
<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>
|
588
|
-
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span>()
|
589
|
-
<span class="ruby-keyword">end</span></pre>
|
590
|
-
</div>
|
591
|
-
|
592
|
-
</div>
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
</div>
|
598
|
-
|
599
|
-
|
600
|
-
<div id="method-i-name-3D" class="method-detail ">
|
601
|
-
|
602
|
-
<div class="method-heading">
|
603
|
-
<span class="method-name">name=</span><span
|
604
|
-
class="method-args">(name)</span>
|
605
|
-
|
606
|
-
<span class="method-click-advice">click to toggle source</span>
|
607
|
-
|
608
|
-
</div>
|
609
|
-
|
610
|
-
|
611
|
-
<div class="method-description">
|
612
|
-
|
613
|
-
<p>Hands the name to the first track. Does nothing if there are no tracks.</p>
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
<div class="method-source-code" id="name-3D-source">
|
619
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 131</span>
|
620
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">name=</span>(<span class="ruby-identifier">name</span>)
|
621
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
|
622
|
-
<span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
|
623
|
-
<span class="ruby-keyword">end</span></pre>
|
624
|
-
</div>
|
625
|
-
|
626
|
-
</div>
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
</div>
|
632
|
-
|
633
|
-
|
634
|
-
<div id="method-i-note_to_delta" class="method-detail ">
|
635
|
-
|
636
|
-
<div class="method-heading">
|
637
|
-
<span class="method-name">note_to_delta</span><span
|
638
|
-
class="method-args">(name)</span>
|
639
|
-
|
640
|
-
<span class="method-click-advice">click to toggle source</span>
|
641
|
-
|
642
|
-
</div>
|
643
|
-
|
644
|
-
|
645
|
-
<div class="method-description">
|
646
|
-
|
647
|
-
<p>Given a note length name like “whole”, “dotted quarter”, or “8th triplet”,
|
648
|
-
return the length of that note in quarter notes as a delta time.</p>
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
<div class="method-source-code" id="note_to_delta-source">
|
654
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 86</span>
|
655
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">note_to_delta</span>(<span class="ruby-identifier">name</span>)
|
656
|
-
<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>))
|
657
|
-
<span class="ruby-keyword">end</span></pre>
|
658
|
-
</div>
|
659
|
-
|
660
|
-
</div>
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
</div>
|
666
|
-
|
667
|
-
|
668
|
-
<div id="method-i-note_to_length" class="method-detail ">
|
669
|
-
|
670
|
-
<div class="method-heading">
|
671
|
-
<span class="method-name">note_to_length</span><span
|
672
|
-
class="method-args">(name)</span>
|
673
|
-
|
674
|
-
<span class="method-click-advice">click to toggle source</span>
|
675
|
-
|
676
|
-
</div>
|
677
|
-
|
678
|
-
|
679
|
-
<div class="method-description">
|
680
|
-
|
681
|
-
<p>Given a note length name like “whole”, “dotted quarter”, or “8th triplet”,
|
682
|
-
return the length of that note in quarter notes as a floating-point number,
|
683
|
-
suitable for use as an argument to length_to_delta.</p>
|
684
|
-
|
685
|
-
<p>Legal names are any value in <a
|
686
|
-
href="Sequence.html#NOTE_TO_LENGTH">NOTE_TO_LENGTH</a>, optionally prefixed
|
687
|
-
by “dotted_” and/or suffixed by “_triplet”. So, for example,
|
688
|
-
“dotted_quarter_triplet” returns the length of a dotted quarter-note
|
689
|
-
triplet and “32nd” returns 1/32.</p>
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
<div class="method-source-code" id="note_to_length-source">
|
695
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 99</span>
|
696
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">note_to_length</span>(<span class="ruby-identifier">name</span>)
|
697
|
-
<span class="ruby-identifier">name</span>.<span class="ruby-identifier">strip!</span>
|
698
|
-
<span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(dotted)?(.*?)(triplet)?$/</span>
|
699
|
-
<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>
|
700
|
-
<span class="ruby-identifier">note_name</span>.<span class="ruby-identifier">strip!</span>
|
701
|
-
<span class="ruby-identifier">mult</span> = <span class="ruby-value">1.0</span>
|
702
|
-
<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>
|
703
|
-
<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>
|
704
|
-
<span class="ruby-identifier">len</span> = <span class="ruby-constant">NOTE_TO_LENGTH</span>[<span class="ruby-identifier">note_name</span>]
|
705
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Sequence.note_to_length: \"#{note_name}\" not understood in \"#{name}\""</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">len</span>
|
706
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">mult</span>
|
707
|
-
<span class="ruby-keyword">end</span></pre>
|
708
|
-
</div>
|
709
|
-
|
710
|
-
</div>
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
</div>
|
716
|
-
|
717
|
-
|
718
|
-
<div id="method-i-pulses_to_seconds" class="method-detail ">
|
719
|
-
|
720
|
-
<div class="method-heading">
|
721
|
-
<span class="method-name">pulses_to_seconds</span><span
|
722
|
-
class="method-args">(pulses)</span>
|
723
|
-
|
724
|
-
<span class="method-click-advice">click to toggle source</span>
|
725
|
-
|
726
|
-
</div>
|
727
|
-
|
728
|
-
|
729
|
-
<div class="method-description">
|
730
|
-
|
731
|
-
<p>Pulses (also called ticks) are the units of delta times and event
|
732
|
-
time_from_start values. This method converts a number of pulses to a float
|
733
|
-
value that is a time in seconds.</p>
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
<div class="method-source-code" id="pulses_to_seconds-source">
|
739
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 79</span>
|
740
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pulses_to_seconds</span>(<span class="ruby-identifier">pulses</span>)
|
741
|
-
(<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-operator">*</span> <span class="ruby-value">60.0</span>
|
742
|
-
<span class="ruby-keyword">end</span></pre>
|
743
|
-
</div>
|
744
|
-
|
745
|
-
</div>
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
</div>
|
751
|
-
|
752
|
-
|
753
|
-
<div id="method-i-read" class="method-detail ">
|
754
|
-
|
755
|
-
<div class="method-heading">
|
756
|
-
<span class="method-name">read</span><span
|
757
|
-
class="method-args">(io, proc = nil) { |track, num_tracks, index| ... }</span>
|
758
|
-
|
759
|
-
<span class="method-click-advice">click to toggle source</span>
|
760
|
-
|
761
|
-
</div>
|
762
|
-
|
763
|
-
|
764
|
-
<div class="method-description">
|
765
|
-
|
766
|
-
<p>Reads a <a href="MIDI.html">MIDI</a> stream.</p>
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
<div class="method-source-code" id="read-source">
|
772
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 137</span>
|
773
|
-
<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>
|
774
|
-
<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>)
|
775
|
-
<span class="ruby-identifier">reader</span>.<span class="ruby-identifier">read_from</span>(<span class="ruby-identifier">io</span>)
|
776
|
-
<span class="ruby-keyword">end</span></pre>
|
777
|
-
</div>
|
778
|
-
|
779
|
-
</div>
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
</div>
|
785
|
-
|
786
|
-
|
787
|
-
<div id="method-i-tempo" class="method-detail method-alias">
|
788
|
-
|
789
|
-
<div class="method-heading">
|
790
|
-
<span class="method-name">tempo</span><span
|
791
|
-
class="method-args">()</span>
|
792
|
-
|
793
|
-
</div>
|
794
|
-
|
795
|
-
|
796
|
-
<div class="method-description">
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
</div>
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
<div class="aliases">
|
809
|
-
Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
|
810
|
-
</div>
|
811
|
-
|
812
|
-
</div>
|
813
|
-
|
814
|
-
|
815
|
-
<div id="method-i-time_signature" class="method-detail ">
|
816
|
-
|
817
|
-
<div class="method-heading">
|
818
|
-
<span class="method-name">time_signature</span><span
|
819
|
-
class="method-args">(numer, denom, clocks, qnotes)</span>
|
820
|
-
|
821
|
-
<span class="method-click-advice">click to toggle source</span>
|
822
|
-
|
823
|
-
</div>
|
824
|
-
|
825
|
-
|
826
|
-
<div class="method-description">
|
827
|
-
|
828
|
-
<p>Sets the time signature.</p>
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
<div class="method-source-code" id="time_signature-source">
|
834
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 60</span>
|
835
|
-
<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>)
|
836
|
-
<span class="ruby-ivar">@numer</span> = <span class="ruby-identifier">numer</span>
|
837
|
-
<span class="ruby-ivar">@denom</span> = <span class="ruby-identifier">denom</span>
|
838
|
-
<span class="ruby-ivar">@clocks</span> = <span class="ruby-identifier">clocks</span>
|
839
|
-
<span class="ruby-ivar">@qnotes</span> = <span class="ruby-identifier">qnotes</span>
|
840
|
-
<span class="ruby-keyword">end</span></pre>
|
841
|
-
</div>
|
842
|
-
|
843
|
-
</div>
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
</div>
|
849
|
-
|
850
|
-
|
851
|
-
<div id="method-i-write" class="method-detail ">
|
852
|
-
|
853
|
-
<div class="method-heading">
|
854
|
-
<span class="method-name">write</span><span
|
855
|
-
class="method-args">(io, proc = nil) { |track, num_tracks, index| ... }</span>
|
856
|
-
|
857
|
-
<span class="method-click-advice">click to toggle source</span>
|
858
|
-
|
859
|
-
</div>
|
860
|
-
|
861
|
-
|
862
|
-
<div class="method-description">
|
863
|
-
|
864
|
-
<p>Writes to a <a href="MIDI.html">MIDI</a> stream.</p>
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
<div class="method-source-code" id="write-source">
|
870
|
-
<pre><span class="ruby-comment"># File lib/midilib/sequence.rb, line 143</span>
|
871
|
-
<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>
|
872
|
-
<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>)
|
873
|
-
<span class="ruby-identifier">writer</span>.<span class="ruby-identifier">write_to</span>(<span class="ruby-identifier">io</span>)
|
874
|
-
<span class="ruby-keyword">end</span></pre>
|
875
|
-
</div>
|
876
|
-
|
877
|
-
</div>
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
</div>
|
883
|
-
|
884
|
-
|
885
|
-
</section>
|
886
|
-
|
887
|
-
</section>
|
888
|
-
</main>
|
889
|
-
|
890
|
-
|
891
|
-
<footer id="validator-badges" role="contentinfo">
|
892
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
893
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
894
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
895
|
-
</footer>
|
896
|
-
|