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/Measure.html
DELETED
@@ -1,328 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class MIDI::Measure - 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
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li ><a href="#method-c-new">::new</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-contains_event-3F">#contains_event?</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-i-to_s">#to_s</a>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
</div>
|
81
|
-
|
82
|
-
</div>
|
83
|
-
</nav>
|
84
|
-
|
85
|
-
<main role="main" aria-labelledby="class-MIDI::Measure">
|
86
|
-
<h1 id="class-MIDI::Measure" class="class">
|
87
|
-
class MIDI::Measure
|
88
|
-
</h1>
|
89
|
-
|
90
|
-
<section class="description">
|
91
|
-
|
92
|
-
<p>The <a href="Measure.html">Measure</a> class contains information about a
|
93
|
-
measure from the sequence. The measure data is based on the time signature
|
94
|
-
information from the sequence and is not stored in the sequence itself</p>
|
95
|
-
|
96
|
-
</section>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<section class="attribute-method-details" class="method-section">
|
110
|
-
<header>
|
111
|
-
<h3>Attributes</h3>
|
112
|
-
</header>
|
113
|
-
|
114
|
-
|
115
|
-
<div id="attribute-i-denominator" class="method-detail">
|
116
|
-
<div class="method-heading attribute-method-heading">
|
117
|
-
<span class="method-name">denominator</span><span
|
118
|
-
class="attribute-access-type">[R]</span>
|
119
|
-
</div>
|
120
|
-
|
121
|
-
<div class="method-description">
|
122
|
-
|
123
|
-
<p>The denominator for the measure's time signature</p>
|
124
|
-
|
125
|
-
</div>
|
126
|
-
</div>
|
127
|
-
|
128
|
-
<div id="attribute-i-end" class="method-detail">
|
129
|
-
<div class="method-heading attribute-method-heading">
|
130
|
-
<span class="method-name">end</span><span
|
131
|
-
class="attribute-access-type">[R]</span>
|
132
|
-
</div>
|
133
|
-
|
134
|
-
<div class="method-description">
|
135
|
-
|
136
|
-
<p>End clock tick for the measure (inclusive)</p>
|
137
|
-
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div id="attribute-i-measure_number" class="method-detail">
|
142
|
-
<div class="method-heading attribute-method-heading">
|
143
|
-
<span class="method-name">measure_number</span><span
|
144
|
-
class="attribute-access-type">[R]</span>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div class="method-description">
|
148
|
-
|
149
|
-
<p>The measure number (1-based)</p>
|
150
|
-
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
|
154
|
-
<div id="attribute-i-metronome_ticks" class="method-detail">
|
155
|
-
<div class="method-heading attribute-method-heading">
|
156
|
-
<span class="method-name">metronome_ticks</span><span
|
157
|
-
class="attribute-access-type">[R]</span>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<div class="method-description">
|
161
|
-
|
162
|
-
<p>The metronome tick for the measure</p>
|
163
|
-
|
164
|
-
</div>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
<div id="attribute-i-numerator" class="method-detail">
|
168
|
-
<div class="method-heading attribute-method-heading">
|
169
|
-
<span class="method-name">numerator</span><span
|
170
|
-
class="attribute-access-type">[R]</span>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
<div class="method-description">
|
174
|
-
|
175
|
-
<p>The numerator (top digit) for the measure's time signature</p>
|
176
|
-
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div id="attribute-i-start" class="method-detail">
|
181
|
-
<div class="method-heading attribute-method-heading">
|
182
|
-
<span class="method-name">start</span><span
|
183
|
-
class="attribute-access-type">[R]</span>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div class="method-description">
|
187
|
-
|
188
|
-
<p><a href="Start.html">Start</a> clock tick for the measure</p>
|
189
|
-
|
190
|
-
</div>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
</section>
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
198
|
-
<header>
|
199
|
-
<h3>Public Class Methods</h3>
|
200
|
-
</header>
|
201
|
-
|
202
|
-
|
203
|
-
<div id="method-c-new" class="method-detail ">
|
204
|
-
|
205
|
-
<div class="method-heading">
|
206
|
-
<span class="method-name">new</span><span
|
207
|
-
class="method-args">(meas_no, start_time, duration, numer, denom, met_ticks)</span>
|
208
|
-
|
209
|
-
<span class="method-click-advice">click to toggle source</span>
|
210
|
-
|
211
|
-
</div>
|
212
|
-
|
213
|
-
|
214
|
-
<div class="method-description">
|
215
|
-
|
216
|
-
<p>Constructor</p>
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
<div class="method-source-code" id="new-source">
|
222
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 23</span>
|
223
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">meas_no</span>, <span class="ruby-identifier">start_time</span>, <span class="ruby-identifier">duration</span>, <span class="ruby-identifier">numer</span>, <span class="ruby-identifier">denom</span>, <span class="ruby-identifier">met_ticks</span>)
|
224
|
-
<span class="ruby-ivar">@measure_number</span> = <span class="ruby-identifier">meas_no</span>
|
225
|
-
<span class="ruby-ivar">@start</span> = <span class="ruby-identifier">start_time</span>
|
226
|
-
<span class="ruby-ivar">@end</span> = <span class="ruby-identifier">start_time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">duration</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
227
|
-
<span class="ruby-ivar">@numerator</span> = <span class="ruby-identifier">numer</span>
|
228
|
-
<span class="ruby-ivar">@denominator</span> = <span class="ruby-identifier">denom</span>
|
229
|
-
<span class="ruby-ivar">@metronome_ticks</span> = <span class="ruby-identifier">met_ticks</span>
|
230
|
-
<span class="ruby-keyword">end</span></pre>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
</div>
|
239
|
-
|
240
|
-
|
241
|
-
</section>
|
242
|
-
|
243
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
244
|
-
<header>
|
245
|
-
<h3>Public Instance Methods</h3>
|
246
|
-
</header>
|
247
|
-
|
248
|
-
|
249
|
-
<div id="method-i-contains_event-3F" class="method-detail ">
|
250
|
-
|
251
|
-
<div class="method-heading">
|
252
|
-
<span class="method-name">contains_event?</span><span
|
253
|
-
class="method-args">(e)</span>
|
254
|
-
|
255
|
-
<span class="method-click-advice">click to toggle source</span>
|
256
|
-
|
257
|
-
</div>
|
258
|
-
|
259
|
-
|
260
|
-
<div class="method-description">
|
261
|
-
|
262
|
-
<p>Returns <code>true</code> if the event is in the measure</p>
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
<div class="method-source-code" id="contains_event-3F-source">
|
268
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 40</span>
|
269
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">contains_event?</span>(<span class="ruby-identifier">e</span>)
|
270
|
-
(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@start</span>) <span class="ruby-operator">&&</span> (<span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span> <span class="ruby-operator"><=</span> <span class="ruby-ivar">@end</span>)
|
271
|
-
<span class="ruby-keyword">end</span></pre>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
</div>
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
</div>
|
280
|
-
|
281
|
-
|
282
|
-
<div id="method-i-to_s" class="method-detail ">
|
283
|
-
|
284
|
-
<div class="method-heading">
|
285
|
-
<span class="method-name">to_s</span><span
|
286
|
-
class="method-args">()</span>
|
287
|
-
|
288
|
-
<span class="method-click-advice">click to toggle source</span>
|
289
|
-
|
290
|
-
</div>
|
291
|
-
|
292
|
-
|
293
|
-
<div class="method-description">
|
294
|
-
|
295
|
-
<p>Returns a detailed string with information about the measure</p>
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
<div class="method-source-code" id="to_s-source">
|
301
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 33</span>
|
302
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
303
|
-
<span class="ruby-identifier">t</span> = <span class="ruby-node">"#{@numerator}/#{2**@denominator}"</span>
|
304
|
-
<span class="ruby-identifier">m</span> = <span class="ruby-ivar">@metronome_ticks</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">24</span>
|
305
|
-
<span class="ruby-node">"measure #{@measure_number} #{@start}-#{@end} #{t} #{m} qs metronome"</span>
|
306
|
-
<span class="ruby-keyword">end</span></pre>
|
307
|
-
</div>
|
308
|
-
|
309
|
-
</div>
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
</div>
|
315
|
-
|
316
|
-
|
317
|
-
</section>
|
318
|
-
|
319
|
-
</section>
|
320
|
-
</main>
|
321
|
-
|
322
|
-
|
323
|
-
<footer id="validator-badges" role="contentinfo">
|
324
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
325
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
326
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
327
|
-
</footer>
|
328
|
-
|
data/html/MIDI/Measures.html
DELETED
@@ -1,285 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class MIDI::Measures - 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">Array
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li class="calls-super" ><a href="#method-c-new">::new</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-measure_for_event">#measure_for_event</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-i-to_mbt">#to_mbt</a>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
</div>
|
81
|
-
|
82
|
-
</div>
|
83
|
-
</nav>
|
84
|
-
|
85
|
-
<main role="main" aria-labelledby="class-MIDI::Measures">
|
86
|
-
<h1 id="class-MIDI::Measures" class="class">
|
87
|
-
class MIDI::Measures
|
88
|
-
</h1>
|
89
|
-
|
90
|
-
<section class="description">
|
91
|
-
|
92
|
-
<p>A specialized container for <a href="Measure.html">MIDI::Measure</a>
|
93
|
-
objects, which can be use to map event times to measure numbers. Please
|
94
|
-
note that this object has to be remade when events are deleted/added in the
|
95
|
-
sequence.</p>
|
96
|
-
|
97
|
-
</section>
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<section class="attribute-method-details" class="method-section">
|
111
|
-
<header>
|
112
|
-
<h3>Attributes</h3>
|
113
|
-
</header>
|
114
|
-
|
115
|
-
|
116
|
-
<div id="attribute-i-max_time" class="method-detail">
|
117
|
-
<div class="method-heading attribute-method-heading">
|
118
|
-
<span class="method-name">max_time</span><span
|
119
|
-
class="attribute-access-type">[R]</span>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
<div class="method-description">
|
123
|
-
|
124
|
-
<p>The highest event time in the sequence (at the time when the object was
|
125
|
-
created)</p>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div id="attribute-i-ppqd" class="method-detail">
|
131
|
-
<div class="method-heading attribute-method-heading">
|
132
|
-
<span class="method-name">ppqd</span><span
|
133
|
-
class="attribute-access-type">[R]</span>
|
134
|
-
</div>
|
135
|
-
|
136
|
-
<div class="method-description">
|
137
|
-
|
138
|
-
<p>The ppqd from the sequence</p>
|
139
|
-
|
140
|
-
</div>
|
141
|
-
</div>
|
142
|
-
|
143
|
-
</section>
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
148
|
-
<header>
|
149
|
-
<h3>Public Class Methods</h3>
|
150
|
-
</header>
|
151
|
-
|
152
|
-
|
153
|
-
<div id="method-c-new" class="method-detail ">
|
154
|
-
|
155
|
-
<div class="method-heading">
|
156
|
-
<span class="method-name">new</span><span
|
157
|
-
class="method-args">(max_time, ppqd)</span>
|
158
|
-
|
159
|
-
<span class="method-click-advice">click to toggle source</span>
|
160
|
-
|
161
|
-
</div>
|
162
|
-
|
163
|
-
|
164
|
-
<div class="method-description">
|
165
|
-
|
166
|
-
<p>Constructor</p>
|
167
|
-
|
168
|
-
|
169
|
-
<div class="method-calls-super">
|
170
|
-
Calls superclass method
|
171
|
-
|
172
|
-
</div>
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<div class="method-source-code" id="new-source">
|
177
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 57</span>
|
178
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">max_time</span>, <span class="ruby-identifier">ppqd</span>)
|
179
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-value">0</span>)
|
180
|
-
<span class="ruby-ivar">@max_time</span> = <span class="ruby-identifier">max_time</span>
|
181
|
-
<span class="ruby-ivar">@ppqd</span> = <span class="ruby-identifier">ppqd</span>
|
182
|
-
<span class="ruby-keyword">end</span></pre>
|
183
|
-
</div>
|
184
|
-
|
185
|
-
</div>
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
</div>
|
191
|
-
|
192
|
-
|
193
|
-
</section>
|
194
|
-
|
195
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
196
|
-
<header>
|
197
|
-
<h3>Public Instance Methods</h3>
|
198
|
-
</header>
|
199
|
-
|
200
|
-
|
201
|
-
<div id="method-i-measure_for_event" class="method-detail ">
|
202
|
-
|
203
|
-
<div class="method-heading">
|
204
|
-
<span class="method-name">measure_for_event</span><span
|
205
|
-
class="method-args">(e)</span>
|
206
|
-
|
207
|
-
<span class="method-click-advice">click to toggle source</span>
|
208
|
-
|
209
|
-
</div>
|
210
|
-
|
211
|
-
|
212
|
-
<div class="method-description">
|
213
|
-
|
214
|
-
<p>Returns the <a href="Measure.html">MIDI::Measure</a> object where the event
|
215
|
-
is located. Returns <code>nil</code> if the event isn't found in the
|
216
|
-
container (should never happen if the <a
|
217
|
-
href="Measures.html">MIDI::Measures</a> object is up to date).</p>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
<div class="method-source-code" id="measure_for_event-source">
|
223
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 66</span>
|
224
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">measure_for_event</span>(<span class="ruby-identifier">e</span>)
|
225
|
-
<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">contains_event?</span>(<span class="ruby-identifier">e</span>) }
|
226
|
-
<span class="ruby-keyword">end</span></pre>
|
227
|
-
</div>
|
228
|
-
|
229
|
-
</div>
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
</div>
|
235
|
-
|
236
|
-
|
237
|
-
<div id="method-i-to_mbt" class="method-detail ">
|
238
|
-
|
239
|
-
<div class="method-heading">
|
240
|
-
<span class="method-name">to_mbt</span><span
|
241
|
-
class="method-args">(e)</span>
|
242
|
-
|
243
|
-
<span class="method-click-advice">click to toggle source</span>
|
244
|
-
|
245
|
-
</div>
|
246
|
-
|
247
|
-
|
248
|
-
<div class="method-description">
|
249
|
-
|
250
|
-
<p>Returns the event's time as a formatted MBT string (Measure:Beat:Ticks)
|
251
|
-
as found in <a href="MIDI.html">MIDI</a> sequencers.</p>
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
<div class="method-source-code" id="to_mbt-source">
|
257
|
-
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 72</span>
|
258
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_mbt</span>(<span class="ruby-identifier">e</span>)
|
259
|
-
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">measure_for_event</span>(<span class="ruby-identifier">e</span>)
|
260
|
-
<span class="ruby-identifier">b</span> = (<span class="ruby-identifier">e</span>.<span class="ruby-identifier">time_from_start</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">start</span>.<span class="ruby-identifier">to_f</span>) <span class="ruby-operator">/</span> <span class="ruby-ivar">@ppqd</span>
|
261
|
-
<span class="ruby-identifier">b</span> <span class="ruby-operator">*=</span> <span class="ruby-value">24</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">metronome_ticks</span>
|
262
|
-
<span class="ruby-identifier">sprintf</span>(<span class="ruby-string">"%d:%02d:%03d"</span>, <span class="ruby-identifier">m</span>.<span class="ruby-identifier">measure_number</span>, <span class="ruby-identifier">b</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, (<span class="ruby-identifier">b</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">to_i</span>) <span class="ruby-operator">*</span> <span class="ruby-ivar">@ppqd</span>)
|
263
|
-
<span class="ruby-keyword">end</span></pre>
|
264
|
-
</div>
|
265
|
-
|
266
|
-
</div>
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
</div>
|
272
|
-
|
273
|
-
|
274
|
-
</section>
|
275
|
-
|
276
|
-
</section>
|
277
|
-
</main>
|
278
|
-
|
279
|
-
|
280
|
-
<footer id="validator-badges" role="contentinfo">
|
281
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
282
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
283
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
284
|
-
</footer>
|
285
|
-
|