midilib 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Credits +11 -2
- data/README.rdoc +17 -26
- data/Rakefile +34 -7
- data/install.rb +2 -2
- data/lib/midilib/info.rb +2 -2
- metadata +25 -119
- data/html/Array.html +0 -382
- data/html/IO.html +0 -277
- data/html/MIDI.html +0 -829
- data/html/MIDI/ActiveSense.html +0 -317
- data/html/MIDI/ChannelEvent.html +0 -347
- data/html/MIDI/ChannelPressure.html +0 -379
- data/html/MIDI/Clock.html +0 -317
- data/html/MIDI/Continue.html +0 -317
- data/html/MIDI/Controller.html +0 -398
- data/html/MIDI/Event.html +0 -659
- data/html/MIDI/IO.html +0 -238
- data/html/MIDI/IO/MIDIFile.html +0 -2269
- data/html/MIDI/IO/SeqReader.html +0 -1051
- data/html/MIDI/IO/SeqWriter.html +0 -706
- data/html/MIDI/KeySig.html +0 -487
- data/html/MIDI/Marker.html +0 -275
- data/html/MIDI/Measure.html +0 -479
- data/html/MIDI/Measures.html +0 -416
- data/html/MIDI/MetaEvent.html +0 -617
- data/html/MIDI/NoteEvent.html +0 -459
- data/html/MIDI/NoteOff.html +0 -341
- data/html/MIDI/NoteOn.html +0 -341
- data/html/MIDI/PitchBend.html +0 -380
- data/html/MIDI/PolyPressure.html +0 -390
- data/html/MIDI/ProgramChange.html +0 -379
- data/html/MIDI/Realtime.html +0 -354
- data/html/MIDI/Sequence.html +0 -1063
- data/html/MIDI/SongPointer.html +0 -380
- data/html/MIDI/SongSelect.html +0 -379
- data/html/MIDI/Start.html +0 -317
- data/html/MIDI/Stop.html +0 -317
- data/html/MIDI/SystemCommon.html +0 -275
- data/html/MIDI/SystemExclusive.html +0 -382
- data/html/MIDI/SystemReset.html +0 -317
- data/html/MIDI/Tempo.html +0 -519
- data/html/MIDI/TimeSig.html +0 -524
- data/html/MIDI/Track.html +0 -859
- data/html/MIDI/TuneRequest.html +0 -354
- data/html/MIDI/Utils.html +0 -350
- data/html/README_rdoc.html +0 -882
- data/html/TODO_rdoc.html +0 -215
- data/html/created.rid +0 -14
- 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/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_green.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 -1266
- data/html/js/darkfish.js +0 -116
- data/html/js/jquery.js +0 -32
- data/html/js/quicksearch.js +0 -114
- data/html/js/thickbox-compressed.js +0 -10
- data/html/lib/midilib/consts_rb.html +0 -55
- data/html/lib/midilib/event_rb.html +0 -56
- data/html/lib/midilib/info_rb.html +0 -52
- data/html/lib/midilib/io/midifile_rb.html +0 -54
- data/html/lib/midilib/io/seqreader_rb.html +0 -58
- data/html/lib/midilib/io/seqwriter_rb.html +0 -59
- data/html/lib/midilib/measure_rb.html +0 -54
- data/html/lib/midilib/sequence_rb.html +0 -58
- data/html/lib/midilib/track_rb.html +0 -54
- data/html/lib/midilib/utils_rb.html +0 -52
- data/html/lib/midilib_rb.html +0 -71
- data/html/rdoc.css +0 -706
data/html/MIDI/Sequence.html
DELETED
@@ -1,1063 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
-
|
8
|
-
<title>Class: MIDI::Sequence</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
-
|
12
|
-
<script src="../js/jquery.js" type="text/javascript"
|
13
|
-
charset="utf-8"></script>
|
14
|
-
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
-
charset="utf-8"></script>
|
16
|
-
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
-
charset="utf-8"></script>
|
18
|
-
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
-
charset="utf-8"></script>
|
20
|
-
|
21
|
-
</head>
|
22
|
-
<body class="class">
|
23
|
-
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="../index.html">Home</a>
|
29
|
-
<a href="../index.html#classes">Classes</a>
|
30
|
-
<a href="../index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="file-metadata">
|
36
|
-
<div id="file-list-section" class="section">
|
37
|
-
<h3 class="section-header">In Files</h3>
|
38
|
-
<div class="section-body">
|
39
|
-
<ul>
|
40
|
-
|
41
|
-
<li><a href="../lib/midilib/sequence_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
-
class="thickbox" title="lib/midilib/sequence.rb">lib/midilib/sequence.rb</a></li>
|
43
|
-
|
44
|
-
</ul>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
|
48
|
-
|
49
|
-
</div>
|
50
|
-
|
51
|
-
<div id="class-metadata">
|
52
|
-
|
53
|
-
<!-- Parent Class -->
|
54
|
-
|
55
|
-
<div id="parent-class-section" class="section">
|
56
|
-
<h3 class="section-header">Parent</h3>
|
57
|
-
|
58
|
-
<p class="link">Object</p>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
|
62
|
-
|
63
|
-
<!-- Namespace Contents -->
|
64
|
-
|
65
|
-
|
66
|
-
<!-- Method Quickref -->
|
67
|
-
|
68
|
-
<div id="method-list-section" class="section">
|
69
|
-
<h3 class="section-header">Methods</h3>
|
70
|
-
<ul class="link-list">
|
71
|
-
|
72
|
-
<li><a href="#method-c-new">::new</a></li>
|
73
|
-
|
74
|
-
<li><a href="#method-i-beats_per_minute">#beats_per_minute</a></li>
|
75
|
-
|
76
|
-
<li><a href="#method-i-bpm">#bpm</a></li>
|
77
|
-
|
78
|
-
<li><a href="#method-i-each">#each</a></li>
|
79
|
-
|
80
|
-
<li><a href="#method-i-get_measures">#get_measures</a></li>
|
81
|
-
|
82
|
-
<li><a href="#method-i-length_to_delta">#length_to_delta</a></li>
|
83
|
-
|
84
|
-
<li><a href="#method-i-name">#name</a></li>
|
85
|
-
|
86
|
-
<li><a href="#method-i-name%3D">#name=</a></li>
|
87
|
-
|
88
|
-
<li><a href="#method-i-note_to_delta">#note_to_delta</a></li>
|
89
|
-
|
90
|
-
<li><a href="#method-i-note_to_length">#note_to_length</a></li>
|
91
|
-
|
92
|
-
<li><a href="#method-i-read">#read</a></li>
|
93
|
-
|
94
|
-
<li><a href="#method-i-tempo">#tempo</a></li>
|
95
|
-
|
96
|
-
<li><a href="#method-i-time_signature">#time_signature</a></li>
|
97
|
-
|
98
|
-
<li><a href="#method-i-write">#write</a></li>
|
99
|
-
|
100
|
-
</ul>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
|
104
|
-
<!-- Included Modules -->
|
105
|
-
|
106
|
-
<div id="includes-section" class="section">
|
107
|
-
<h3 class="section-header">Included Modules</h3>
|
108
|
-
<ul class="link-list">
|
109
|
-
|
110
|
-
|
111
|
-
<li><span class="include">Enumerable</span></li>
|
112
|
-
|
113
|
-
|
114
|
-
</ul>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
</div>
|
118
|
-
|
119
|
-
<div id="project-metadata">
|
120
|
-
|
121
|
-
|
122
|
-
<div id="fileindex-section" class="section project-section">
|
123
|
-
<h3 class="section-header">Files</h3>
|
124
|
-
<ul>
|
125
|
-
|
126
|
-
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
127
|
-
|
128
|
-
<li class="file"><a href="../TODO_rdoc.html">TODO.rdoc</a></li>
|
129
|
-
|
130
|
-
</ul>
|
131
|
-
</div>
|
132
|
-
|
133
|
-
|
134
|
-
<div id="classindex-section" class="section project-section">
|
135
|
-
<h3 class="section-header">Class Index
|
136
|
-
<span class="search-toggle"><img src="../images/find.png"
|
137
|
-
height="16" width="16" alt="[+]"
|
138
|
-
title="show/hide quicksearch" /></span></h3>
|
139
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
140
|
-
<fieldset>
|
141
|
-
<legend>Quicksearch</legend>
|
142
|
-
<input type="text" name="quicksearch" value=""
|
143
|
-
class="quicksearch-field" />
|
144
|
-
</fieldset>
|
145
|
-
</form>
|
146
|
-
|
147
|
-
<ul class="link-list">
|
148
|
-
|
149
|
-
<li><a href="../MIDI.html">MIDI</a></li>
|
150
|
-
|
151
|
-
<li><a href="../MIDI/ActiveSense.html">MIDI::ActiveSense</a></li>
|
152
|
-
|
153
|
-
<li><a href="../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a></li>
|
154
|
-
|
155
|
-
<li><a href="../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a></li>
|
156
|
-
|
157
|
-
<li><a href="../MIDI/Clock.html">MIDI::Clock</a></li>
|
158
|
-
|
159
|
-
<li><a href="../MIDI/Continue.html">MIDI::Continue</a></li>
|
160
|
-
|
161
|
-
<li><a href="../MIDI/Controller.html">MIDI::Controller</a></li>
|
162
|
-
|
163
|
-
<li><a href="../MIDI/Event.html">MIDI::Event</a></li>
|
164
|
-
|
165
|
-
<li><a href="../MIDI/IO.html">MIDI::IO</a></li>
|
166
|
-
|
167
|
-
<li><a href="../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a></li>
|
168
|
-
|
169
|
-
<li><a href="../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a></li>
|
170
|
-
|
171
|
-
<li><a href="../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a></li>
|
172
|
-
|
173
|
-
<li><a href="../MIDI/KeySig.html">MIDI::KeySig</a></li>
|
174
|
-
|
175
|
-
<li><a href="../MIDI/Marker.html">MIDI::Marker</a></li>
|
176
|
-
|
177
|
-
<li><a href="../MIDI/Measure.html">MIDI::Measure</a></li>
|
178
|
-
|
179
|
-
<li><a href="../MIDI/Measures.html">MIDI::Measures</a></li>
|
180
|
-
|
181
|
-
<li><a href="../MIDI/MetaEvent.html">MIDI::MetaEvent</a></li>
|
182
|
-
|
183
|
-
<li><a href="../MIDI/NoteEvent.html">MIDI::NoteEvent</a></li>
|
184
|
-
|
185
|
-
<li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a></li>
|
186
|
-
|
187
|
-
<li><a href="../MIDI/NoteOff.html">MIDI::NoteOff</a></li>
|
188
|
-
|
189
|
-
<li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a></li>
|
190
|
-
|
191
|
-
<li><a href="../MIDI/NoteOn.html">MIDI::NoteOn</a></li>
|
192
|
-
|
193
|
-
<li><a href="../MIDI/PitchBend.html">MIDI::PitchBend</a></li>
|
194
|
-
|
195
|
-
<li><a href="../MIDI/PolyPressure.html">MIDI::PolyPressure</a></li>
|
196
|
-
|
197
|
-
<li><a href="../MIDI/ProgramChange.html">MIDI::ProgramChange</a></li>
|
198
|
-
|
199
|
-
<li><a href="../MIDI/Realtime.html">MIDI::Realtime</a></li>
|
200
|
-
|
201
|
-
<li><a href="../MIDI/Sequence.html">MIDI::Sequence</a></li>
|
202
|
-
|
203
|
-
<li><a href="../MIDI/SongPointer.html">MIDI::SongPointer</a></li>
|
204
|
-
|
205
|
-
<li><a href="../MIDI/SongSelect.html">MIDI::SongSelect</a></li>
|
206
|
-
|
207
|
-
<li><a href="../MIDI/Start.html">MIDI::Start</a></li>
|
208
|
-
|
209
|
-
<li><a href="../MIDI/Stop.html">MIDI::Stop</a></li>
|
210
|
-
|
211
|
-
<li><a href="../MIDI/SystemCommon.html">MIDI::SystemCommon</a></li>
|
212
|
-
|
213
|
-
<li><a href="../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a></li>
|
214
|
-
|
215
|
-
<li><a href="../MIDI/SystemReset.html">MIDI::SystemReset</a></li>
|
216
|
-
|
217
|
-
<li><a href="../MIDI/Tempo.html">MIDI::Tempo</a></li>
|
218
|
-
|
219
|
-
<li><a href="../MIDI/TimeSig.html">MIDI::TimeSig</a></li>
|
220
|
-
|
221
|
-
<li><a href="../MIDI/Track.html">MIDI::Track</a></li>
|
222
|
-
|
223
|
-
<li><a href="../MIDI/TuneRequest.html">MIDI::TuneRequest</a></li>
|
224
|
-
|
225
|
-
<li><a href="../MIDI/Utils.html">MIDI::Utils</a></li>
|
226
|
-
|
227
|
-
<li><a href="../Array.html">Array</a></li>
|
228
|
-
|
229
|
-
<li><a href="../IO.html">IO</a></li>
|
230
|
-
|
231
|
-
</ul>
|
232
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
233
|
-
</div>
|
234
|
-
|
235
|
-
|
236
|
-
</div>
|
237
|
-
</div>
|
238
|
-
|
239
|
-
<div id="documentation">
|
240
|
-
<h1 class="class">MIDI::Sequence</h1>
|
241
|
-
|
242
|
-
<div id="description">
|
243
|
-
<p>
|
244
|
-
A <a href="Sequence.html">MIDI::Sequence</a> contains <a
|
245
|
-
href="Track.html">MIDI::Track</a> objects.
|
246
|
-
</p>
|
247
|
-
|
248
|
-
</div>
|
249
|
-
|
250
|
-
<!-- Constants -->
|
251
|
-
|
252
|
-
<div id="constants-list" class="section">
|
253
|
-
<h3 class="section-header">Constants</h3>
|
254
|
-
<dl>
|
255
|
-
|
256
|
-
<dt><a name="UNNAMED">UNNAMED</a></dt>
|
257
|
-
|
258
|
-
<dd class="description"></dd>
|
259
|
-
|
260
|
-
|
261
|
-
<dt><a name="DEFAULT_TEMPO">DEFAULT_TEMPO</a></dt>
|
262
|
-
|
263
|
-
<dd class="description"></dd>
|
264
|
-
|
265
|
-
|
266
|
-
<dt><a name="NOTE_TO_LENGTH">NOTE_TO_LENGTH</a></dt>
|
267
|
-
|
268
|
-
<dd class="description"></dd>
|
269
|
-
|
270
|
-
|
271
|
-
</dl>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
|
275
|
-
<!-- Attributes -->
|
276
|
-
|
277
|
-
<div id="attribute-method-details" class="method-section section">
|
278
|
-
<h3 class="section-header">Attributes</h3>
|
279
|
-
|
280
|
-
|
281
|
-
<div id="tracks-attribute-method" class="method-detail">
|
282
|
-
<a name="tracks"></a>
|
283
|
-
|
284
|
-
<a name="tracks="></a>
|
285
|
-
|
286
|
-
<div class="method-heading attribute-method-heading">
|
287
|
-
<span class="method-name">tracks</span><span
|
288
|
-
class="attribute-access-type">[RW]</span>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
<div class="method-description">
|
292
|
-
|
293
|
-
<p>
|
294
|
-
<a href="../Array.html">Array</a> with all tracks for the sequence
|
295
|
-
</p>
|
296
|
-
|
297
|
-
</div>
|
298
|
-
</div>
|
299
|
-
|
300
|
-
<div id="ppqn-attribute-method" class="method-detail">
|
301
|
-
<a name="ppqn"></a>
|
302
|
-
|
303
|
-
<a name="ppqn="></a>
|
304
|
-
|
305
|
-
<div class="method-heading attribute-method-heading">
|
306
|
-
<span class="method-name">ppqn</span><span
|
307
|
-
class="attribute-access-type">[RW]</span>
|
308
|
-
</div>
|
309
|
-
|
310
|
-
<div class="method-description">
|
311
|
-
|
312
|
-
<p>
|
313
|
-
Pulses (i.e. clocks) Per Quarter Note resolution for the sequence
|
314
|
-
</p>
|
315
|
-
|
316
|
-
</div>
|
317
|
-
</div>
|
318
|
-
|
319
|
-
<div id="format-attribute-method" class="method-detail">
|
320
|
-
<a name="format"></a>
|
321
|
-
|
322
|
-
<a name="format="></a>
|
323
|
-
|
324
|
-
<div class="method-heading attribute-method-heading">
|
325
|
-
<span class="method-name">format</span><span
|
326
|
-
class="attribute-access-type">[RW]</span>
|
327
|
-
</div>
|
328
|
-
|
329
|
-
<div class="method-description">
|
330
|
-
|
331
|
-
<p>
|
332
|
-
The <a href="../MIDI.html">MIDI</a> file format (0, 1, or 2)
|
333
|
-
</p>
|
334
|
-
|
335
|
-
</div>
|
336
|
-
</div>
|
337
|
-
|
338
|
-
<div id="numer-attribute-method" class="method-detail">
|
339
|
-
<a name="numer"></a>
|
340
|
-
|
341
|
-
<a name="numer="></a>
|
342
|
-
|
343
|
-
<div class="method-heading attribute-method-heading">
|
344
|
-
<span class="method-name">numer</span><span
|
345
|
-
class="attribute-access-type">[RW]</span>
|
346
|
-
</div>
|
347
|
-
|
348
|
-
<div class="method-description">
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
</div>
|
353
|
-
</div>
|
354
|
-
|
355
|
-
<div id="denom-attribute-method" class="method-detail">
|
356
|
-
<a name="denom"></a>
|
357
|
-
|
358
|
-
<a name="denom="></a>
|
359
|
-
|
360
|
-
<div class="method-heading attribute-method-heading">
|
361
|
-
<span class="method-name">denom</span><span
|
362
|
-
class="attribute-access-type">[RW]</span>
|
363
|
-
</div>
|
364
|
-
|
365
|
-
<div class="method-description">
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
</div>
|
370
|
-
</div>
|
371
|
-
|
372
|
-
<div id="clocks-attribute-method" class="method-detail">
|
373
|
-
<a name="clocks"></a>
|
374
|
-
|
375
|
-
<a name="clocks="></a>
|
376
|
-
|
377
|
-
<div class="method-heading attribute-method-heading">
|
378
|
-
<span class="method-name">clocks</span><span
|
379
|
-
class="attribute-access-type">[RW]</span>
|
380
|
-
</div>
|
381
|
-
|
382
|
-
<div class="method-description">
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
</div>
|
387
|
-
</div>
|
388
|
-
|
389
|
-
<div id="qnotes-attribute-method" class="method-detail">
|
390
|
-
<a name="qnotes"></a>
|
391
|
-
|
392
|
-
<a name="qnotes="></a>
|
393
|
-
|
394
|
-
<div class="method-heading attribute-method-heading">
|
395
|
-
<span class="method-name">qnotes</span><span
|
396
|
-
class="attribute-access-type">[RW]</span>
|
397
|
-
</div>
|
398
|
-
|
399
|
-
<div class="method-description">
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
</div>
|
404
|
-
</div>
|
405
|
-
|
406
|
-
<div id="reader-class-attribute-method" class="method-detail">
|
407
|
-
<a name="reader_class"></a>
|
408
|
-
|
409
|
-
<a name="reader_class="></a>
|
410
|
-
|
411
|
-
<div class="method-heading attribute-method-heading">
|
412
|
-
<span class="method-name">reader_class</span><span
|
413
|
-
class="attribute-access-type">[RW]</span>
|
414
|
-
</div>
|
415
|
-
|
416
|
-
<div class="method-description">
|
417
|
-
|
418
|
-
<p>
|
419
|
-
The class to use for reading <a href="../MIDI.html">MIDI</a> from a stream.
|
420
|
-
The default is <a href="IO/SeqReader.html">MIDI::IO::SeqReader</a>. You can
|
421
|
-
change this at any time.
|
422
|
-
</p>
|
423
|
-
|
424
|
-
</div>
|
425
|
-
</div>
|
426
|
-
|
427
|
-
<div id="writer-class-attribute-method" class="method-detail">
|
428
|
-
<a name="writer_class"></a>
|
429
|
-
|
430
|
-
<a name="writer_class="></a>
|
431
|
-
|
432
|
-
<div class="method-heading attribute-method-heading">
|
433
|
-
<span class="method-name">writer_class</span><span
|
434
|
-
class="attribute-access-type">[RW]</span>
|
435
|
-
</div>
|
436
|
-
|
437
|
-
<div class="method-description">
|
438
|
-
|
439
|
-
<p>
|
440
|
-
The class to use for writeing <a href="../MIDI.html">MIDI</a> from a
|
441
|
-
stream. The default is <a href="IO/SeqWriter.html">MIDI::IO::SeqWriter</a>.
|
442
|
-
You can change this at any time.
|
443
|
-
</p>
|
444
|
-
|
445
|
-
</div>
|
446
|
-
</div>
|
447
|
-
|
448
|
-
</div>
|
449
|
-
|
450
|
-
|
451
|
-
<!-- Methods -->
|
452
|
-
|
453
|
-
<div id="public-class-method-details" class="method-section section">
|
454
|
-
<h3 class="section-header">Public Class Methods</h3>
|
455
|
-
|
456
|
-
|
457
|
-
<div id="new-method" class="method-detail ">
|
458
|
-
<a name="method-c-new"></a>
|
459
|
-
|
460
|
-
<div class="method-heading">
|
461
|
-
|
462
|
-
<span class="method-name">new</span><span
|
463
|
-
class="method-args">()</span>
|
464
|
-
<span class="method-click-advice">click to toggle source</span>
|
465
|
-
|
466
|
-
</div>
|
467
|
-
|
468
|
-
<div class="method-description">
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
<div class="method-source-code"
|
475
|
-
id="new-source">
|
476
|
-
<pre>
|
477
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 45</span>
|
478
|
-
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
479
|
-
46: <span class="ruby-ivar">@tracks</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
|
480
|
-
47: <span class="ruby-ivar">@ppqn</span> = <span class="ruby-value">480</span>
|
481
|
-
48:
|
482
|
-
49: <span class="ruby-comment cmt"># Time signature</span>
|
483
|
-
50: <span class="ruby-ivar">@numer</span> = <span class="ruby-value">4</span> <span class="ruby-comment cmt"># Numer + denom = 4/4 time default</span>
|
484
|
-
51: <span class="ruby-ivar">@denom</span> = <span class="ruby-value">2</span>
|
485
|
-
52: <span class="ruby-ivar">@clocks</span> = <span class="ruby-value">24</span> <span class="ruby-comment cmt"># Bug fix Nov 11, 2007 - this is not the same as ppqn!</span>
|
486
|
-
53: <span class="ruby-ivar">@qnotes</span> = <span class="ruby-value">8</span>
|
487
|
-
54:
|
488
|
-
55: <span class="ruby-ivar">@reader_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqReader</span>
|
489
|
-
56: <span class="ruby-ivar">@writer_class</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SeqWriter</span>
|
490
|
-
57: <span class="ruby-keyword kw">end</span></pre>
|
491
|
-
</div>
|
492
|
-
|
493
|
-
</div>
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
</div>
|
499
|
-
|
500
|
-
|
501
|
-
</div>
|
502
|
-
|
503
|
-
<div id="public-instance-method-details" class="method-section section">
|
504
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
505
|
-
|
506
|
-
|
507
|
-
<div id="beats-per-minute-method" class="method-detail ">
|
508
|
-
<a name="method-i-beats_per_minute"></a>
|
509
|
-
|
510
|
-
<div class="method-heading">
|
511
|
-
|
512
|
-
<span class="method-name">beats_per_minute</span><span
|
513
|
-
class="method-args">()</span>
|
514
|
-
<span class="method-click-advice">click to toggle source</span>
|
515
|
-
|
516
|
-
</div>
|
517
|
-
|
518
|
-
<div class="method-description">
|
519
|
-
|
520
|
-
<p>
|
521
|
-
Returns the song tempo in beats per minute.
|
522
|
-
</p>
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
<div class="method-source-code"
|
527
|
-
id="beats-per-minute-source">
|
528
|
-
<pre>
|
529
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 68</span>
|
530
|
-
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beats_per_minute</span>
|
531
|
-
69: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">DEFAULT_TEMPO</span> <span class="ruby-keyword kw">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>
|
532
|
-
70: <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>
|
533
|
-
71: <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>)
|
534
|
-
72: }
|
535
|
-
73: <span class="ruby-keyword kw">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>
|
536
|
-
74: <span class="ruby-keyword kw">end</span></pre>
|
537
|
-
</div>
|
538
|
-
|
539
|
-
</div>
|
540
|
-
|
541
|
-
|
542
|
-
<div class="aliases">
|
543
|
-
Also aliased as: <a href="Sequence.html#method-i-bpm">bpm</a>, <a href="Sequence.html#method-i-tempo">tempo</a>
|
544
|
-
</div>
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
</div>
|
549
|
-
|
550
|
-
|
551
|
-
<div id="bpm-method" class="method-detail method-alias">
|
552
|
-
<a name="method-i-bpm"></a>
|
553
|
-
|
554
|
-
<div class="method-heading">
|
555
|
-
|
556
|
-
<span class="method-name">bpm</span><span
|
557
|
-
class="method-args">()</span>
|
558
|
-
<span class="method-click-advice">click to toggle source</span>
|
559
|
-
|
560
|
-
</div>
|
561
|
-
|
562
|
-
<div class="method-description">
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
</div>
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
<div class="aliases">
|
574
|
-
Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
|
575
|
-
</div>
|
576
|
-
|
577
|
-
</div>
|
578
|
-
|
579
|
-
|
580
|
-
<div id="each-method" class="method-detail ">
|
581
|
-
<a name="method-i-each"></a>
|
582
|
-
|
583
|
-
<div class="method-heading">
|
584
|
-
|
585
|
-
<span class="method-name">each</span><span
|
586
|
-
class="method-args">()</span>
|
587
|
-
<span class="method-click-advice">click to toggle source</span>
|
588
|
-
|
589
|
-
</div>
|
590
|
-
|
591
|
-
<div class="method-description">
|
592
|
-
|
593
|
-
<p>
|
594
|
-
Iterates over the tracks.
|
595
|
-
</p>
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
<div class="method-source-code"
|
600
|
-
id="each-source">
|
601
|
-
<pre>
|
602
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 144</span>
|
603
|
-
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span> <span class="ruby-comment cmt"># :yields: track</span>
|
604
|
-
145: <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 kw">yield</span> <span class="ruby-identifier">track</span> }
|
605
|
-
146: <span class="ruby-keyword kw">end</span></pre>
|
606
|
-
</div>
|
607
|
-
|
608
|
-
</div>
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
</div>
|
614
|
-
|
615
|
-
|
616
|
-
<div id="get-measures-method" class="method-detail ">
|
617
|
-
<a name="method-i-get_measures"></a>
|
618
|
-
|
619
|
-
<div class="method-heading">
|
620
|
-
|
621
|
-
<span class="method-name">get_measures</span><span
|
622
|
-
class="method-args">()</span>
|
623
|
-
<span class="method-click-advice">click to toggle source</span>
|
624
|
-
|
625
|
-
</div>
|
626
|
-
|
627
|
-
<div class="method-description">
|
628
|
-
|
629
|
-
<p>
|
630
|
-
Returns a <a href="Measures.html">Measures</a> object, which is an array
|
631
|
-
container for all measures in the sequence
|
632
|
-
</p>
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
<div class="method-source-code"
|
637
|
-
id="get-measures-source">
|
638
|
-
<pre>
|
639
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 150</span>
|
640
|
-
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_measures</span>
|
641
|
-
151: <span class="ruby-comment cmt"># Collect time sig events and scan for last event time</span>
|
642
|
-
152: <span class="ruby-identifier">time_sigs</span> = []
|
643
|
-
153: <span class="ruby-identifier">max_pos</span> = <span class="ruby-value">0</span>
|
644
|
-
154: <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>
|
645
|
-
155: <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>
|
646
|
-
156: <span class="ruby-identifier">time_sigs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">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>)
|
647
|
-
157: <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 kw">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>
|
648
|
-
158: }
|
649
|
-
159: }
|
650
|
-
160: <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> }
|
651
|
-
161:
|
652
|
-
162: <span class="ruby-comment cmt"># Add a "fake" time sig event at the very last position of the sequence,</span>
|
653
|
-
163: <span class="ruby-comment cmt"># just to make sure the whole sequence is calculated.</span>
|
654
|
-
164: <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>)
|
655
|
-
165: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time_from_start</span> = <span class="ruby-identifier">max_pos</span>
|
656
|
-
166: <span class="ruby-identifier">time_sigs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span>
|
657
|
-
167:
|
658
|
-
168: <span class="ruby-comment cmt"># Default to 4/4</span>
|
659
|
-
169: <span class="ruby-identifier">measure_length</span> = <span class="ruby-ivar">@ppqn</span> * <span class="ruby-value">4</span>
|
660
|
-
170: <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>
|
661
|
-
171:
|
662
|
-
172: <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>)
|
663
|
-
173: <span class="ruby-identifier">curr_pos</span> = <span class="ruby-value">0</span>
|
664
|
-
174: <span class="ruby-identifier">curr_meas_no</span> = <span class="ruby-value">1</span>
|
665
|
-
175: <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>
|
666
|
-
176: <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>
|
667
|
-
177: <span class="ruby-identifier">meas_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">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>
|
668
|
-
178: <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>
|
669
|
-
179: <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>,
|
670
|
-
180: <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>)
|
671
|
-
181: <span class="ruby-identifier">curr_meas_no</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
672
|
-
182: <span class="ruby-identifier">curr_pos</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">measure_length</span>
|
673
|
-
183: }
|
674
|
-
184: <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>
|
675
|
-
185: <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>)
|
676
|
-
186: }
|
677
|
-
187: <span class="ruby-identifier">measures</span>
|
678
|
-
188: <span class="ruby-keyword kw">end</span></pre>
|
679
|
-
</div>
|
680
|
-
|
681
|
-
</div>
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
</div>
|
687
|
-
|
688
|
-
|
689
|
-
<div id="length-to-delta-method" class="method-detail ">
|
690
|
-
<a name="method-i-length_to_delta"></a>
|
691
|
-
|
692
|
-
<div class="method-heading">
|
693
|
-
|
694
|
-
<span class="method-name">length_to_delta</span><span
|
695
|
-
class="method-args">(length)</span>
|
696
|
-
<span class="method-click-advice">click to toggle source</span>
|
697
|
-
|
698
|
-
</div>
|
699
|
-
|
700
|
-
<div class="method-description">
|
701
|
-
|
702
|
-
<p>
|
703
|
-
Translates <tt>length</tt> (a multiple of a quarter note) into a delta
|
704
|
-
time. For example, 1 is a quarter note, 1.0/32.0 is a 32nd note, 1.5 is a
|
705
|
-
dotted quarter, etc. Be aware when using division; 1/32 is zero due to
|
706
|
-
integer mathematics and rounding. Use floating-point numbers like 1.0 and
|
707
|
-
32.0. This method always returns an integer.
|
708
|
-
</p>
|
709
|
-
<p>
|
710
|
-
See also <a href="Sequence.html#method-i-note_to_delta">note_to_delta</a>
|
711
|
-
and note_to_length.
|
712
|
-
</p>
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
<div class="method-source-code"
|
717
|
-
id="length-to-delta-source">
|
718
|
-
<pre>
|
719
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 114</span>
|
720
|
-
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">length</span>)
|
721
|
-
115: <span class="ruby-keyword kw">return</span> (<span class="ruby-ivar">@ppqn</span> * <span class="ruby-identifier">length</span>).<span class="ruby-identifier">to_i</span>
|
722
|
-
116: <span class="ruby-keyword kw">end</span></pre>
|
723
|
-
</div>
|
724
|
-
|
725
|
-
</div>
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
</div>
|
731
|
-
|
732
|
-
|
733
|
-
<div id="name-method" class="method-detail ">
|
734
|
-
<a name="method-i-name"></a>
|
735
|
-
|
736
|
-
<div class="method-heading">
|
737
|
-
|
738
|
-
<span class="method-name">name</span><span
|
739
|
-
class="method-args">()</span>
|
740
|
-
<span class="method-click-advice">click to toggle source</span>
|
741
|
-
|
742
|
-
</div>
|
743
|
-
|
744
|
-
<div class="method-description">
|
745
|
-
|
746
|
-
<p>
|
747
|
-
Returns the name of the first track (track zero). If there are no tracks,
|
748
|
-
returns <a href="Sequence.html#UNNAMED">UNNAMED</a>.
|
749
|
-
</p>
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
<div class="method-source-code"
|
754
|
-
id="name-source">
|
755
|
-
<pre>
|
756
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 120</span>
|
757
|
-
120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
|
758
|
-
121: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UNNAMED</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
|
759
|
-
122: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span>()
|
760
|
-
123: <span class="ruby-keyword kw">end</span></pre>
|
761
|
-
</div>
|
762
|
-
|
763
|
-
</div>
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
</div>
|
769
|
-
|
770
|
-
|
771
|
-
<div id="name--method" class="method-detail ">
|
772
|
-
<a name="method-i-name%3D"></a>
|
773
|
-
|
774
|
-
<div class="method-heading">
|
775
|
-
|
776
|
-
<span class="method-name">name=</span><span
|
777
|
-
class="method-args">(name)</span>
|
778
|
-
<span class="method-click-advice">click to toggle source</span>
|
779
|
-
|
780
|
-
</div>
|
781
|
-
|
782
|
-
<div class="method-description">
|
783
|
-
|
784
|
-
<p>
|
785
|
-
Hands the name to the first track. Does nothing if there are no tracks.
|
786
|
-
</p>
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
<div class="method-source-code"
|
791
|
-
id="name--source">
|
792
|
-
<pre>
|
793
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 126</span>
|
794
|
-
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name=</span>(<span class="ruby-identifier">name</span>)
|
795
|
-
127: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">empty?</span>
|
796
|
-
128: <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
|
797
|
-
129: <span class="ruby-keyword kw">end</span></pre>
|
798
|
-
</div>
|
799
|
-
|
800
|
-
</div>
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
</div>
|
806
|
-
|
807
|
-
|
808
|
-
<div id="note-to-delta-method" class="method-detail ">
|
809
|
-
<a name="method-i-note_to_delta"></a>
|
810
|
-
|
811
|
-
<div class="method-heading">
|
812
|
-
|
813
|
-
<span class="method-name">note_to_delta</span><span
|
814
|
-
class="method-args">(name)</span>
|
815
|
-
<span class="method-click-advice">click to toggle source</span>
|
816
|
-
|
817
|
-
</div>
|
818
|
-
|
819
|
-
<div class="method-description">
|
820
|
-
|
821
|
-
<p>
|
822
|
-
Given a note length name like “whole”, “dotted
|
823
|
-
quarter”, or “8th triplet”, return the length of that
|
824
|
-
note in quarter notes as a delta time.
|
825
|
-
</p>
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
<div class="method-source-code"
|
830
|
-
id="note-to-delta-source">
|
831
|
-
<pre>
|
832
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 81</span>
|
833
|
-
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">note_to_delta</span>(<span class="ruby-identifier">name</span>)
|
834
|
-
82: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">length_to_delta</span>(<span class="ruby-identifier">note_to_length</span>(<span class="ruby-identifier">name</span>))
|
835
|
-
83: <span class="ruby-keyword kw">end</span></pre>
|
836
|
-
</div>
|
837
|
-
|
838
|
-
</div>
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
</div>
|
844
|
-
|
845
|
-
|
846
|
-
<div id="note-to-length-method" class="method-detail ">
|
847
|
-
<a name="method-i-note_to_length"></a>
|
848
|
-
|
849
|
-
<div class="method-heading">
|
850
|
-
|
851
|
-
<span class="method-name">note_to_length</span><span
|
852
|
-
class="method-args">(name)</span>
|
853
|
-
<span class="method-click-advice">click to toggle source</span>
|
854
|
-
|
855
|
-
</div>
|
856
|
-
|
857
|
-
<div class="method-description">
|
858
|
-
|
859
|
-
<p>
|
860
|
-
Given a note length name like “whole”, “dotted
|
861
|
-
quarter”, or “8th triplet”, return the length of that
|
862
|
-
note in quarter notes as a floating-point number, suitable for use as an
|
863
|
-
argument to length_to_delta.
|
864
|
-
</p>
|
865
|
-
<p>
|
866
|
-
Legal names are any value in <a
|
867
|
-
href="Sequence.html#NOTE_TO_LENGTH">NOTE_TO_LENGTH</a>, optionally prefixed
|
868
|
-
by “dotted_” and/or suffixed by “_triplet”. So, for
|
869
|
-
example, “dotted_quarter_triplet“ returns the length of a
|
870
|
-
dotted quarter-note triplet and “32nd” returns 1/32.
|
871
|
-
</p>
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
<div class="method-source-code"
|
876
|
-
id="note-to-length-source">
|
877
|
-
<pre>
|
878
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 94</span>
|
879
|
-
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">note_to_length</span>(<span class="ruby-identifier">name</span>)
|
880
|
-
95: <span class="ruby-identifier">name</span>.<span class="ruby-identifier">strip!</span>
|
881
|
-
96: <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(dotted)?(.*?)(triplet)?$/</span>
|
882
|
-
97: <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>
|
883
|
-
98: <span class="ruby-identifier">note_name</span>.<span class="ruby-identifier">strip!</span>
|
884
|
-
99: <span class="ruby-identifier">mult</span> = <span class="ruby-value">1.0</span>
|
885
|
-
100: <span class="ruby-identifier">mult</span> = <span class="ruby-value">1.5</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dotted</span>
|
886
|
-
101: <span class="ruby-identifier">mult</span> <span class="ruby-operator">/=</span> <span class="ruby-value">3.0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">triplet</span>
|
887
|
-
102: <span class="ruby-identifier">len</span> = <span class="ruby-constant">NOTE_TO_LENGTH</span>[<span class="ruby-identifier">note_name</span>]
|
888
|
-
103: <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 kw">unless</span> <span class="ruby-identifier">len</span>
|
889
|
-
104: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">len</span> * <span class="ruby-identifier">mult</span>
|
890
|
-
105: <span class="ruby-keyword kw">end</span></pre>
|
891
|
-
</div>
|
892
|
-
|
893
|
-
</div>
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
</div>
|
899
|
-
|
900
|
-
|
901
|
-
<div id="read-method" class="method-detail ">
|
902
|
-
<a name="method-i-read"></a>
|
903
|
-
|
904
|
-
<div class="method-heading">
|
905
|
-
|
906
|
-
<span class="method-name">read</span><span
|
907
|
-
class="method-args">(io, proc = nil)</span>
|
908
|
-
<span class="method-click-advice">click to toggle source</span>
|
909
|
-
|
910
|
-
</div>
|
911
|
-
|
912
|
-
<div class="method-description">
|
913
|
-
|
914
|
-
<p>
|
915
|
-
Reads a <a href="../MIDI.html">MIDI</a> stream.
|
916
|
-
</p>
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
<div class="method-source-code"
|
921
|
-
id="read-source">
|
922
|
-
<pre>
|
923
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 132</span>
|
924
|
-
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">io</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt"># :yields: track, num_tracks, index</span>
|
925
|
-
133: <span class="ruby-identifier">reader</span> = <span class="ruby-ivar">@reader_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">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>)
|
926
|
-
134: <span class="ruby-identifier">reader</span>.<span class="ruby-identifier">read_from</span>(<span class="ruby-identifier">io</span>)
|
927
|
-
135: <span class="ruby-keyword kw">end</span></pre>
|
928
|
-
</div>
|
929
|
-
|
930
|
-
</div>
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
</div>
|
936
|
-
|
937
|
-
|
938
|
-
<div id="tempo-method" class="method-detail method-alias">
|
939
|
-
<a name="method-i-tempo"></a>
|
940
|
-
|
941
|
-
<div class="method-heading">
|
942
|
-
|
943
|
-
<span class="method-name">tempo</span><span
|
944
|
-
class="method-args">()</span>
|
945
|
-
<span class="method-click-advice">click to toggle source</span>
|
946
|
-
|
947
|
-
</div>
|
948
|
-
|
949
|
-
<div class="method-description">
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
</div>
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
<div class="aliases">
|
961
|
-
Alias for: <a href="Sequence.html#method-i-beats_per_minute">beats_per_minute</a>
|
962
|
-
</div>
|
963
|
-
|
964
|
-
</div>
|
965
|
-
|
966
|
-
|
967
|
-
<div id="time-signature-method" class="method-detail ">
|
968
|
-
<a name="method-i-time_signature"></a>
|
969
|
-
|
970
|
-
<div class="method-heading">
|
971
|
-
|
972
|
-
<span class="method-name">time_signature</span><span
|
973
|
-
class="method-args">(numer, denom, clocks, qnotes)</span>
|
974
|
-
<span class="method-click-advice">click to toggle source</span>
|
975
|
-
|
976
|
-
</div>
|
977
|
-
|
978
|
-
<div class="method-description">
|
979
|
-
|
980
|
-
<p>
|
981
|
-
Sets the time signature.
|
982
|
-
</p>
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
<div class="method-source-code"
|
987
|
-
id="time-signature-source">
|
988
|
-
<pre>
|
989
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 60</span>
|
990
|
-
60: <span class="ruby-keyword kw">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>)
|
991
|
-
61: <span class="ruby-ivar">@numer</span> = <span class="ruby-identifier">numer</span>
|
992
|
-
62: <span class="ruby-ivar">@denom</span> = <span class="ruby-identifier">denom</span>
|
993
|
-
63: <span class="ruby-ivar">@clocks</span> = <span class="ruby-identifier">clocks</span>
|
994
|
-
64: <span class="ruby-ivar">@qnotes</span> = <span class="ruby-identifier">qnotes</span>
|
995
|
-
65: <span class="ruby-keyword kw">end</span></pre>
|
996
|
-
</div>
|
997
|
-
|
998
|
-
</div>
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
</div>
|
1004
|
-
|
1005
|
-
|
1006
|
-
<div id="write-method" class="method-detail ">
|
1007
|
-
<a name="method-i-write"></a>
|
1008
|
-
|
1009
|
-
<div class="method-heading">
|
1010
|
-
|
1011
|
-
<span class="method-name">write</span><span
|
1012
|
-
class="method-args">(io, proc = nil)</span>
|
1013
|
-
<span class="method-click-advice">click to toggle source</span>
|
1014
|
-
|
1015
|
-
</div>
|
1016
|
-
|
1017
|
-
<div class="method-description">
|
1018
|
-
|
1019
|
-
<p>
|
1020
|
-
Writes to a <a href="../MIDI.html">MIDI</a> stream.
|
1021
|
-
</p>
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
<div class="method-source-code"
|
1026
|
-
id="write-source">
|
1027
|
-
<pre>
|
1028
|
-
<span class="ruby-comment cmt"># File lib/midilib/sequence.rb, line 138</span>
|
1029
|
-
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">io</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt"># :yields: track, num_tracks, index</span>
|
1030
|
-
139: <span class="ruby-identifier">writer</span> = <span class="ruby-ivar">@writer_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">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>)
|
1031
|
-
140: <span class="ruby-identifier">writer</span>.<span class="ruby-identifier">write_to</span>(<span class="ruby-identifier">io</span>)
|
1032
|
-
141: <span class="ruby-keyword kw">end</span></pre>
|
1033
|
-
</div>
|
1034
|
-
|
1035
|
-
</div>
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
</div>
|
1041
|
-
|
1042
|
-
|
1043
|
-
</div>
|
1044
|
-
|
1045
|
-
|
1046
|
-
</div>
|
1047
|
-
|
1048
|
-
|
1049
|
-
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
1050
|
-
|
1051
|
-
<p>Disabled; run with --debug to generate this.</p>
|
1052
|
-
|
1053
|
-
</div>
|
1054
|
-
|
1055
|
-
<div id="validator-badges">
|
1056
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1057
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
1058
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
1059
|
-
</div>
|
1060
|
-
|
1061
|
-
</body>
|
1062
|
-
</html>
|
1063
|
-
|