midilib 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Credits +5 -0
- data/html/MIDI/ActiveSense.html +171 -0
- data/html/MIDI/ChannelEvent.html +190 -0
- data/html/MIDI/ChannelPressure.html +212 -0
- data/html/MIDI/Clock.html +171 -0
- data/html/MIDI/Continue.html +171 -0
- data/html/MIDI/Controller.html +224 -0
- data/html/MIDI/Event.html +349 -0
- data/html/MIDI/IO/MIDIFile.html +1392 -0
- data/html/MIDI/IO/SeqReader.html +642 -0
- data/html/MIDI/IO/SeqWriter.html +442 -0
- data/html/MIDI/IO.html +91 -0
- data/html/MIDI/KeySig.html +292 -0
- data/html/MIDI/Marker.html +138 -0
- data/html/MIDI/Measure.html +260 -0
- data/html/MIDI/Measures.html +222 -0
- data/html/MIDI/MetaEvent.html +353 -0
- data/html/MIDI/NoteEvent.html +255 -0
- data/html/MIDI/NoteOff.html +188 -0
- data/html/MIDI/NoteOn.html +188 -0
- data/html/MIDI/PitchBend.html +213 -0
- data/html/MIDI/PolyPressure.html +216 -0
- data/html/MIDI/ProgramChange.html +212 -0
- data/html/MIDI/Realtime.html +194 -0
- data/html/MIDI/Sequence.html +641 -0
- data/html/MIDI/SongPointer.html +213 -0
- data/html/MIDI/SongSelect.html +212 -0
- data/html/MIDI/Start.html +171 -0
- data/html/MIDI/Stop.html +171 -0
- data/html/MIDI/SystemCommon.html +138 -0
- data/html/MIDI/SystemExclusive.html +215 -0
- data/html/MIDI/SystemReset.html +171 -0
- data/html/MIDI/Tempo.html +292 -0
- data/html/MIDI/TimeSig.html +286 -0
- data/html/MIDI/Track.html +489 -0
- data/html/MIDI/TuneRequest.html +194 -0
- data/html/MIDI/Utils.html +178 -0
- data/html/MIDI.html +281 -0
- data/html/Object.html +197 -0
- data/html/README_rdoc.html +545 -0
- data/html/TODO_rdoc.html +123 -0
- data/html/created.rid +15 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -0
- 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 +534 -0
- data/html/js/darkfish.js +84 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +1258 -0
- data/lib/midilib/info.rb +2 -2
- data/lib/midilib/io/seqreader.rb +18 -5
- data/test/test_io.rb +18 -5
- metadata +85 -1
@@ -0,0 +1,260 @@
|
|
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
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link"><a href="../Object.html">Object</a>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li ><a href="#method-c-new">::new</a>
|
76
|
+
<li ><a href="#method-i-contains_event-3F">#contains_event?</a>
|
77
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
78
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<main role="main" aria-labelledby="class-MIDI::Measure">
|
85
|
+
<h1 id="class-MIDI::Measure" class="class">
|
86
|
+
class MIDI::Measure
|
87
|
+
</h1>
|
88
|
+
|
89
|
+
<section class="description">
|
90
|
+
|
91
|
+
<p>The <a href="Measure.html"><code>Measure</code></a> class contains information about a measure from the sequence. The measure data is based on the time signature information from the sequence and is not stored in the sequence itself</p>
|
92
|
+
|
93
|
+
</section>
|
94
|
+
|
95
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<section class="attribute-method-details" class="method-section">
|
100
|
+
<header>
|
101
|
+
<h3>Attributes</h3>
|
102
|
+
</header>
|
103
|
+
|
104
|
+
<div id="attribute-i-denominator" class="method-detail">
|
105
|
+
<div class="method-heading attribute-method-heading">
|
106
|
+
<span class="method-name">denominator</span><span
|
107
|
+
class="attribute-access-type">[R]</span>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div class="method-description">
|
111
|
+
<p>The denominator for the measure’s time signature</p>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div id="attribute-i-end" class="method-detail">
|
115
|
+
<div class="method-heading attribute-method-heading">
|
116
|
+
<span class="method-name">end</span><span
|
117
|
+
class="attribute-access-type">[R]</span>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p>End clock tick for the measure (inclusive)</p>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
<div id="attribute-i-measure_number" class="method-detail">
|
125
|
+
<div class="method-heading attribute-method-heading">
|
126
|
+
<span class="method-name">measure_number</span><span
|
127
|
+
class="attribute-access-type">[R]</span>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="method-description">
|
131
|
+
<p>The measure number (1-based)</p>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
<div id="attribute-i-metronome_ticks" class="method-detail">
|
135
|
+
<div class="method-heading attribute-method-heading">
|
136
|
+
<span class="method-name">metronome_ticks</span><span
|
137
|
+
class="attribute-access-type">[R]</span>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="method-description">
|
141
|
+
<p>The metronome tick for the measure</p>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
<div id="attribute-i-numerator" class="method-detail">
|
145
|
+
<div class="method-heading attribute-method-heading">
|
146
|
+
<span class="method-name">numerator</span><span
|
147
|
+
class="attribute-access-type">[R]</span>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div class="method-description">
|
151
|
+
<p>The numerator (top digit) for the measure’s time signature</p>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
<div id="attribute-i-start" class="method-detail">
|
155
|
+
<div class="method-heading attribute-method-heading">
|
156
|
+
<span class="method-name">start</span><span
|
157
|
+
class="attribute-access-type">[R]</span>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<div class="method-description">
|
161
|
+
<p><a href="Start.html"><code>Start</code></a> clock tick for the measure</p>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</section>
|
165
|
+
|
166
|
+
|
167
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
168
|
+
<header>
|
169
|
+
<h3>Public Class Methods</h3>
|
170
|
+
</header>
|
171
|
+
|
172
|
+
<div id="method-c-new" class="method-detail ">
|
173
|
+
<div class="method-heading">
|
174
|
+
<span class="method-name">new</span><span
|
175
|
+
class="method-args">(meas_no, start_time, duration, numer, denom, met_ticks)</span>
|
176
|
+
<span class="method-click-advice">click to toggle source</span>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div class="method-description">
|
180
|
+
<p>Constructor</p>
|
181
|
+
|
182
|
+
<div class="method-source-code" id="new-source">
|
183
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 22</span>
|
184
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">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>)
|
185
|
+
<span class="ruby-ivar">@measure_number</span> = <span class="ruby-identifier">meas_no</span>
|
186
|
+
<span class="ruby-ivar">@start</span> = <span class="ruby-identifier">start_time</span>
|
187
|
+
<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>
|
188
|
+
<span class="ruby-ivar">@numerator</span> = <span class="ruby-identifier">numer</span>
|
189
|
+
<span class="ruby-ivar">@denominator</span> = <span class="ruby-identifier">denom</span>
|
190
|
+
<span class="ruby-ivar">@metronome_ticks</span> = <span class="ruby-identifier">met_ticks</span>
|
191
|
+
<span class="ruby-keyword">end</span></pre>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
</section>
|
199
|
+
|
200
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
201
|
+
<header>
|
202
|
+
<h3>Public Instance Methods</h3>
|
203
|
+
</header>
|
204
|
+
|
205
|
+
<div id="method-i-contains_event-3F" class="method-detail ">
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">contains_event?</span><span
|
208
|
+
class="method-args">(e)</span>
|
209
|
+
<span class="method-click-advice">click to toggle source</span>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
<p>Returns <code>true</code> if the event is in the measure</p>
|
214
|
+
|
215
|
+
<div class="method-source-code" id="contains_event-3F-source">
|
216
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 39</span>
|
217
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains_event?</span>(<span class="ruby-identifier">e</span>)
|
218
|
+
(<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>)
|
219
|
+
<span class="ruby-keyword">end</span></pre>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="method-i-to_s" class="method-detail ">
|
227
|
+
<div class="method-heading">
|
228
|
+
<span class="method-name">to_s</span><span
|
229
|
+
class="method-args">()</span>
|
230
|
+
<span class="method-click-advice">click to toggle source</span>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div class="method-description">
|
234
|
+
<p>Returns a detailed string with information about the measure</p>
|
235
|
+
|
236
|
+
<div class="method-source-code" id="to_s-source">
|
237
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 32</span>
|
238
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
239
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-node">"#{@numerator}/#{2**@denominator}"</span>
|
240
|
+
<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>
|
241
|
+
<span class="ruby-node">"measure #{@measure_number} #{@start}-#{@end} #{t} #{m} qs metronome"</span>
|
242
|
+
<span class="ruby-keyword">end</span></pre>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</section>
|
250
|
+
|
251
|
+
</section>
|
252
|
+
</main>
|
253
|
+
|
254
|
+
|
255
|
+
<footer id="validator-badges" role="contentinfo">
|
256
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
257
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
258
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
259
|
+
</footer>
|
260
|
+
|
@@ -0,0 +1,222 @@
|
|
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
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link">Array
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li class="calls-super" ><a href="#method-c-new">::new</a>
|
76
|
+
<li ><a href="#method-i-measure_for_event">#measure_for_event</a>
|
77
|
+
<li ><a href="#method-i-to_mbt">#to_mbt</a>
|
78
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<main role="main" aria-labelledby="class-MIDI::Measures">
|
85
|
+
<h1 id="class-MIDI::Measures" class="class">
|
86
|
+
class MIDI::Measures
|
87
|
+
</h1>
|
88
|
+
|
89
|
+
<section class="description">
|
90
|
+
|
91
|
+
<p>A specialized container for <a href="Measure.html"><code>MIDI::Measure</code></a> objects, which can be use to map event times to measure numbers. Please note that this object has to be remade when events are deleted/added in the sequence.</p>
|
92
|
+
|
93
|
+
</section>
|
94
|
+
|
95
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<section class="attribute-method-details" class="method-section">
|
100
|
+
<header>
|
101
|
+
<h3>Attributes</h3>
|
102
|
+
</header>
|
103
|
+
|
104
|
+
<div id="attribute-i-max_time" class="method-detail">
|
105
|
+
<div class="method-heading attribute-method-heading">
|
106
|
+
<span class="method-name">max_time</span><span
|
107
|
+
class="attribute-access-type">[R]</span>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div class="method-description">
|
111
|
+
<p>The highest event time in the sequence (at the time when the object was created)</p>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div id="attribute-i-ppqd" class="method-detail">
|
115
|
+
<div class="method-heading attribute-method-heading">
|
116
|
+
<span class="method-name">ppqd</span><span
|
117
|
+
class="attribute-access-type">[R]</span>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p>The ppqd from the sequence</p>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</section>
|
125
|
+
|
126
|
+
|
127
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
128
|
+
<header>
|
129
|
+
<h3>Public Class Methods</h3>
|
130
|
+
</header>
|
131
|
+
|
132
|
+
<div id="method-c-new" class="method-detail ">
|
133
|
+
<div class="method-heading">
|
134
|
+
<span class="method-name">new</span><span
|
135
|
+
class="method-args">(max_time, ppqd)</span>
|
136
|
+
<span class="method-click-advice">click to toggle source</span>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div class="method-description">
|
140
|
+
<p>Constructor</p>
|
141
|
+
<div class="method-calls-super">
|
142
|
+
Calls superclass method
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-source-code" id="new-source">
|
147
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 56</span>
|
148
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">max_time</span>, <span class="ruby-identifier">ppqd</span>)
|
149
|
+
<span class="ruby-keyword">super</span>(<span class="ruby-value">0</span>)
|
150
|
+
<span class="ruby-ivar">@max_time</span> = <span class="ruby-identifier">max_time</span>
|
151
|
+
<span class="ruby-ivar">@ppqd</span> = <span class="ruby-identifier">ppqd</span>
|
152
|
+
<span class="ruby-keyword">end</span></pre>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</section>
|
160
|
+
|
161
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
162
|
+
<header>
|
163
|
+
<h3>Public Instance Methods</h3>
|
164
|
+
</header>
|
165
|
+
|
166
|
+
<div id="method-i-measure_for_event" class="method-detail ">
|
167
|
+
<div class="method-heading">
|
168
|
+
<span class="method-name">measure_for_event</span><span
|
169
|
+
class="method-args">(e)</span>
|
170
|
+
<span class="method-click-advice">click to toggle source</span>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
<p>Returns the <a href="Measure.html"><code>MIDI::Measure</code></a> object where the event is located. Returns <code>nil</code> if the event isn’t found in the container (should never happen if the <a href="Measures.html"><code>MIDI::Measures</code></a> object is up to date).</p>
|
175
|
+
|
176
|
+
<div class="method-source-code" id="measure_for_event-source">
|
177
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 65</span>
|
178
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">measure_for_event</span>(<span class="ruby-identifier">e</span>)
|
179
|
+
<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>) }
|
180
|
+
<span class="ruby-keyword">end</span></pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div id="method-i-to_mbt" class="method-detail ">
|
188
|
+
<div class="method-heading">
|
189
|
+
<span class="method-name">to_mbt</span><span
|
190
|
+
class="method-args">(e)</span>
|
191
|
+
<span class="method-click-advice">click to toggle source</span>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
<p>Returns the event’s time as a formatted MBT string (Measure:Beat:Ticks) as found in <a href="../MIDI.html"><code>MIDI</code></a> sequencers.</p>
|
196
|
+
|
197
|
+
<div class="method-source-code" id="to_mbt-source">
|
198
|
+
<pre><span class="ruby-comment"># File lib/midilib/measure.rb, line 71</span>
|
199
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_mbt</span>(<span class="ruby-identifier">e</span>)
|
200
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">measure_for_event</span>(<span class="ruby-identifier">e</span>)
|
201
|
+
<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>
|
202
|
+
<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>
|
203
|
+
<span class="ruby-identifier">format</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>)
|
204
|
+
<span class="ruby-keyword">end</span></pre>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</section>
|
212
|
+
|
213
|
+
</section>
|
214
|
+
</main>
|
215
|
+
|
216
|
+
|
217
|
+
<footer id="validator-badges" role="contentinfo">
|
218
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
219
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
220
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
221
|
+
</footer>
|
222
|
+
|