midilib 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Credits +5 -0
- data/README.rdoc +35 -30
- data/examples/reader2text.rb +1 -0
- data/html/IO.html +259 -0
- data/html/MIDI.html +665 -0
- data/html/MIDI/ActiveSense.html +295 -0
- data/html/MIDI/ChannelEvent.html +319 -0
- data/html/MIDI/ChannelPressure.html +350 -0
- data/html/MIDI/Clock.html +295 -0
- data/html/MIDI/Continue.html +295 -0
- data/html/MIDI/Controller.html +365 -0
- data/html/MIDI/Event.html +573 -0
- data/html/MIDI/IO.html +207 -0
- data/html/MIDI/IO/MIDIFile.html +1996 -0
- data/html/MIDI/IO/SeqReader.html +946 -0
- data/html/MIDI/IO/SeqWriter.html +648 -0
- data/html/MIDI/KeySig.html +435 -0
- data/html/MIDI/MIDI.html +204 -0
- data/html/MIDI/MIDI/MIDI.html +204 -0
- data/html/MIDI/MIDI/MIDI/Array.html +353 -0
- data/html/MIDI/Marker.html +257 -0
- data/html/MIDI/Measure.html +423 -0
- data/html/MIDI/Measures.html +375 -0
- data/html/MIDI/MetaEvent.html +534 -0
- data/html/MIDI/NoteEvent.html +417 -0
- data/html/MIDI/NoteOff.html +316 -0
- data/html/MIDI/NoteOn.html +316 -0
- data/html/MIDI/PitchBend.html +351 -0
- data/html/MIDI/PolyPressure.html +360 -0
- data/html/MIDI/ProgramChange.html +350 -0
- data/html/MIDI/Realtime.html +328 -0
- data/html/MIDI/Sequence.html +961 -0
- data/html/MIDI/SongPointer.html +351 -0
- data/html/MIDI/SongSelect.html +350 -0
- data/html/MIDI/Start.html +295 -0
- data/html/MIDI/Stop.html +295 -0
- data/html/MIDI/SystemCommon.html +257 -0
- data/html/MIDI/SystemExclusive.html +353 -0
- data/html/MIDI/SystemReset.html +295 -0
- data/html/MIDI/Tempo.html +474 -0
- data/html/MIDI/TimeSig.html +467 -0
- data/html/MIDI/Track.html +769 -0
- data/html/MIDI/TuneRequest.html +328 -0
- data/html/MIDI/Utils.html +320 -0
- data/html/README_rdoc.html +751 -0
- data/html/TODO_rdoc.html +200 -0
- data/html/created.rid +14 -0
- data/html/images/add.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 +750 -0
- data/html/js/darkfish.js +153 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +94 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +543 -0
- data/html/table_of_contents.html +652 -0
- data/lib/midilib/info.rb +1 -1
- data/lib/midilib/io/seqreader.rb +1 -1
- data/lib/midilib/sequence.rb +7 -0
- data/test/test_sequence.rb +11 -0
- metadata +80 -3
@@ -0,0 +1,946 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class MIDI::IO::SeqReader - midilib</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/midilib/io/seqreader.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link"><a href="MIDIFile.html">MIDI::IO::MIDIFile</a>
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-chan_pressure">#chan_pressure</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-controller">#controller</a>
|
78
|
+
|
79
|
+
<li><a href="#method-i-end_track">#end_track</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-header">#header</a>
|
82
|
+
|
83
|
+
<li><a href="#method-i-key_signature">#key_signature</a>
|
84
|
+
|
85
|
+
<li><a href="#method-i-make_note_off">#make_note_off</a>
|
86
|
+
|
87
|
+
<li><a href="#method-i-meta_misc">#meta_misc</a>
|
88
|
+
|
89
|
+
<li><a href="#method-i-note_off">#note_off</a>
|
90
|
+
|
91
|
+
<li><a href="#method-i-note_on">#note_on</a>
|
92
|
+
|
93
|
+
<li><a href="#method-i-pitch_bend">#pitch_bend</a>
|
94
|
+
|
95
|
+
<li><a href="#method-i-pressure">#pressure</a>
|
96
|
+
|
97
|
+
<li><a href="#method-i-program">#program</a>
|
98
|
+
|
99
|
+
<li><a href="#method-i-start_track">#start_track</a>
|
100
|
+
|
101
|
+
<li><a href="#method-i-sysex">#sysex</a>
|
102
|
+
|
103
|
+
<li><a href="#method-i-tempo">#tempo</a>
|
104
|
+
|
105
|
+
<li><a href="#method-i-text">#text</a>
|
106
|
+
|
107
|
+
<li><a href="#method-i-time_signature">#time_signature</a>
|
108
|
+
|
109
|
+
<li><a href="#method-i-track_uses_channel">#track_uses_channel</a>
|
110
|
+
|
111
|
+
</ul>
|
112
|
+
</nav>
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="project-metadata">
|
117
|
+
<nav id="fileindex-section" class="section project-section">
|
118
|
+
<h3 class="section-header">Pages</h3>
|
119
|
+
|
120
|
+
<ul>
|
121
|
+
|
122
|
+
<li class="file"><a href="../../README_rdoc.html">README</a>
|
123
|
+
|
124
|
+
<li class="file"><a href="../../TODO_rdoc.html">TODO</a>
|
125
|
+
|
126
|
+
</ul>
|
127
|
+
</nav>
|
128
|
+
|
129
|
+
<nav id="classindex-section" class="section project-section">
|
130
|
+
<h3 class="section-header">Class and Module Index</h3>
|
131
|
+
|
132
|
+
<ul class="link-list">
|
133
|
+
|
134
|
+
<li><a href="../../MIDI.html">MIDI</a>
|
135
|
+
|
136
|
+
<li><a href="../../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
|
137
|
+
|
138
|
+
<li><a href="../../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
|
139
|
+
|
140
|
+
<li><a href="../../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
|
141
|
+
|
142
|
+
<li><a href="../../MIDI/Clock.html">MIDI::Clock</a>
|
143
|
+
|
144
|
+
<li><a href="../../MIDI/Continue.html">MIDI::Continue</a>
|
145
|
+
|
146
|
+
<li><a href="../../MIDI/Controller.html">MIDI::Controller</a>
|
147
|
+
|
148
|
+
<li><a href="../../MIDI/Event.html">MIDI::Event</a>
|
149
|
+
|
150
|
+
<li><a href="../../MIDI/IO.html">MIDI::IO</a>
|
151
|
+
|
152
|
+
<li><a href="../../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
|
153
|
+
|
154
|
+
<li><a href="../../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
|
155
|
+
|
156
|
+
<li><a href="../../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
|
157
|
+
|
158
|
+
<li><a href="../../MIDI/KeySig.html">MIDI::KeySig</a>
|
159
|
+
|
160
|
+
<li><a href="../../MIDI/MIDI.html">MIDI::MIDI</a>
|
161
|
+
|
162
|
+
<li><a href="../../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
|
163
|
+
|
164
|
+
<li><a href="../../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
|
165
|
+
|
166
|
+
<li><a href="../../MIDI/Marker.html">MIDI::Marker</a>
|
167
|
+
|
168
|
+
<li><a href="../../MIDI/Measure.html">MIDI::Measure</a>
|
169
|
+
|
170
|
+
<li><a href="../../MIDI/Measures.html">MIDI::Measures</a>
|
171
|
+
|
172
|
+
<li><a href="../../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
|
173
|
+
|
174
|
+
<li><a href="../../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
|
175
|
+
|
176
|
+
<li><a href="../../MIDI/NoteOff.html">MIDI::NoteOff</a>
|
177
|
+
|
178
|
+
<li><a href="../../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
|
179
|
+
|
180
|
+
<li><a href="../../MIDI/NoteOn.html">MIDI::NoteOn</a>
|
181
|
+
|
182
|
+
<li><a href="../../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
|
183
|
+
|
184
|
+
<li><a href="../../MIDI/PitchBend.html">MIDI::PitchBend</a>
|
185
|
+
|
186
|
+
<li><a href="../../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
|
187
|
+
|
188
|
+
<li><a href="../../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
|
189
|
+
|
190
|
+
<li><a href="../../MIDI/Realtime.html">MIDI::Realtime</a>
|
191
|
+
|
192
|
+
<li><a href="../../MIDI/Sequence.html">MIDI::Sequence</a>
|
193
|
+
|
194
|
+
<li><a href="../../MIDI/SongPointer.html">MIDI::SongPointer</a>
|
195
|
+
|
196
|
+
<li><a href="../../MIDI/SongSelect.html">MIDI::SongSelect</a>
|
197
|
+
|
198
|
+
<li><a href="../../MIDI/Start.html">MIDI::Start</a>
|
199
|
+
|
200
|
+
<li><a href="../../MIDI/Stop.html">MIDI::Stop</a>
|
201
|
+
|
202
|
+
<li><a href="../../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
|
203
|
+
|
204
|
+
<li><a href="../../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
|
205
|
+
|
206
|
+
<li><a href="../../MIDI/SystemReset.html">MIDI::SystemReset</a>
|
207
|
+
|
208
|
+
<li><a href="../../MIDI/Tempo.html">MIDI::Tempo</a>
|
209
|
+
|
210
|
+
<li><a href="../../MIDI/TimeSig.html">MIDI::TimeSig</a>
|
211
|
+
|
212
|
+
<li><a href="../../MIDI/Track.html">MIDI::Track</a>
|
213
|
+
|
214
|
+
<li><a href="../../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
|
215
|
+
|
216
|
+
<li><a href="../../MIDI/Utils.html">MIDI::Utils</a>
|
217
|
+
|
218
|
+
<li><a href="../../IO.html">IO</a>
|
219
|
+
|
220
|
+
</ul>
|
221
|
+
</nav>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
</nav>
|
225
|
+
|
226
|
+
<div id="documentation">
|
227
|
+
<h1 class="class">class MIDI::IO::SeqReader</h1>
|
228
|
+
|
229
|
+
<div id="description" class="description">
|
230
|
+
|
231
|
+
<p>Reads <a href="../MIDI.html">MIDI</a> files. As a subclass of <a
|
232
|
+
href="MIDIFile.html">MIDIFile</a>, this class implements the callback
|
233
|
+
methods for each <a href="../MIDI.html">MIDI</a> event and use them to
|
234
|
+
build <a href="../Track.html">Track</a> and <a
|
235
|
+
href="../Event.html">Event</a> objects and give the tracks to a <a
|
236
|
+
href="../Sequence.html">Sequence</a>.</p>
|
237
|
+
|
238
|
+
<p>We append new events to the end of a track's event list, bypassing a call
|
239
|
+
to <a href="../Track.html">Track</a>.add. This means that we must call <a
|
240
|
+
href="../Track.html#method-i-recalc_times">MIDI::Track#recalc_times</a> at
|
241
|
+
the end of the track so it can update each event with its time from the
|
242
|
+
track's start (see <a
|
243
|
+
href="SeqReader.html#method-i-end_track">#end_track</a> below).</p>
|
244
|
+
|
245
|
+
<p>META_TRACK_END events are not added to tracks. This way, we don't have to
|
246
|
+
worry about making sure the last event is always a track end event. We rely
|
247
|
+
on the <a href="SeqWriter.html">SeqWriter</a> to append a META_TRACK_END
|
248
|
+
event to each track when it is output.</p>
|
249
|
+
|
250
|
+
</div><!-- description -->
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
<!-- Methods -->
|
265
|
+
|
266
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
267
|
+
<h3 class="section-header">Public Class Methods</h3>
|
268
|
+
|
269
|
+
|
270
|
+
<div id="method-c-new" class="method-detail ">
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<span class="method-name">new</span><span
|
274
|
+
class="method-args">(seq, proc = nil) { |track, num_tracks, index| ... }</span>
|
275
|
+
<span class="method-click-advice">click to toggle source</span>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
<div class="method-description">
|
280
|
+
|
281
|
+
<p>The optional proc block is called once at the start of the file and again
|
282
|
+
at the end of each track. There are three arguments to the block: the
|
283
|
+
track, the track number (1 through <em>n</em>), and the total number of
|
284
|
+
tracks.</p>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code" id="new-source">
|
289
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 29</span>
|
290
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">seq</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-comment"># :yields: track, num_tracks, index</span>
|
291
|
+
<span class="ruby-keyword">super</span>()
|
292
|
+
<span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span>
|
293
|
+
<span class="ruby-ivar">@track</span> = <span class="ruby-keyword">nil</span>
|
294
|
+
<span class="ruby-ivar">@chan_mask</span> = <span class="ruby-value">0</span>
|
295
|
+
<span class="ruby-ivar">@update_block</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>
|
296
|
+
<span class="ruby-keyword">end</span></pre>
|
297
|
+
</div><!-- new-source -->
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
</div><!-- new-method -->
|
305
|
+
|
306
|
+
|
307
|
+
</section><!-- public-class-method-details -->
|
308
|
+
|
309
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
310
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
311
|
+
|
312
|
+
|
313
|
+
<div id="method-i-chan_pressure" class="method-detail ">
|
314
|
+
|
315
|
+
<div class="method-heading">
|
316
|
+
<span class="method-name">chan_pressure</span><span
|
317
|
+
class="method-args">(chan, press)</span>
|
318
|
+
<span class="method-click-advice">click to toggle source</span>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method-description">
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<div class="method-source-code" id="chan_pressure-source">
|
329
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 125</span>
|
330
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">chan_pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">press</span>)
|
331
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">ChannelPressure</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">press</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
332
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
333
|
+
<span class="ruby-keyword">end</span></pre>
|
334
|
+
</div><!-- chan_pressure-source -->
|
335
|
+
|
336
|
+
</div>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</div><!-- chan_pressure-method -->
|
342
|
+
|
343
|
+
|
344
|
+
<div id="method-i-controller" class="method-detail ">
|
345
|
+
|
346
|
+
<div class="method-heading">
|
347
|
+
<span class="method-name">controller</span><span
|
348
|
+
class="method-args">(chan, control, value)</span>
|
349
|
+
<span class="method-click-advice">click to toggle source</span>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
|
353
|
+
<div class="method-description">
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
<div class="method-source-code" id="controller-source">
|
360
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 110</span>
|
361
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">controller</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">control</span>, <span class="ruby-identifier">value</span>)
|
362
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Controller</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">control</span>, <span class="ruby-identifier">value</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
363
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
364
|
+
<span class="ruby-keyword">end</span></pre>
|
365
|
+
</div><!-- controller-source -->
|
366
|
+
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
</div><!-- controller-method -->
|
373
|
+
|
374
|
+
|
375
|
+
<div id="method-i-end_track" class="method-detail ">
|
376
|
+
|
377
|
+
<div class="method-heading">
|
378
|
+
<span class="method-name">end_track</span><span
|
379
|
+
class="method-args">()</span>
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
<div class="method-description">
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-source-code" id="end_track-source">
|
391
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 52</span>
|
392
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">end_track</span>()
|
393
|
+
<span class="ruby-comment"># Turn off any pending note on messages</span>
|
394
|
+
<span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">on</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-value">64</span>) }
|
395
|
+
<span class="ruby-ivar">@pending</span> = <span class="ruby-keyword">nil</span>
|
396
|
+
|
397
|
+
<span class="ruby-comment"># Don't bother adding the META_TRACK_END event to the track.</span>
|
398
|
+
<span class="ruby-comment"># This way, we don't have to worry about making sure the</span>
|
399
|
+
<span class="ruby-comment"># last event is always a track end event.</span>
|
400
|
+
|
401
|
+
<span class="ruby-comment"># Let the track calculate event times from start of track. This is</span>
|
402
|
+
<span class="ruby-comment"># in lieu of calling Track.add for each event.</span>
|
403
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">recalc_times</span>()
|
404
|
+
|
405
|
+
<span class="ruby-comment"># Store bitmask of all channels used into track</span>
|
406
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">channels_used</span> = <span class="ruby-ivar">@chan_mask</span>
|
407
|
+
|
408
|
+
<span class="ruby-comment"># call update block</span>
|
409
|
+
<span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-ivar">@track</span>, <span class="ruby-ivar">@ntrks</span>, <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">length</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
|
410
|
+
<span class="ruby-keyword">end</span></pre>
|
411
|
+
</div><!-- end_track-source -->
|
412
|
+
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
</div><!-- end_track-method -->
|
419
|
+
|
420
|
+
|
421
|
+
<div id="method-i-header" class="method-detail ">
|
422
|
+
|
423
|
+
<div class="method-heading">
|
424
|
+
<span class="method-name">header</span><span
|
425
|
+
class="method-args">(format, ntrks, division)</span>
|
426
|
+
<span class="method-click-advice">click to toggle source</span>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
|
430
|
+
<div class="method-description">
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
<div class="method-source-code" id="header-source">
|
437
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 37</span>
|
438
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">format</span>, <span class="ruby-identifier">ntrks</span>, <span class="ruby-identifier">division</span>)
|
439
|
+
<span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span>
|
440
|
+
<span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">ppqn</span> = <span class="ruby-identifier">division</span>
|
441
|
+
|
442
|
+
<span class="ruby-ivar">@ntrks</span> = <span class="ruby-identifier">ntrks</span>
|
443
|
+
<span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@ntrks</span>, <span class="ruby-value">0</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
|
444
|
+
<span class="ruby-keyword">end</span></pre>
|
445
|
+
</div><!-- header-source -->
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
</div><!-- header-method -->
|
453
|
+
|
454
|
+
|
455
|
+
<div id="method-i-key_signature" class="method-detail ">
|
456
|
+
|
457
|
+
<div class="method-heading">
|
458
|
+
<span class="method-name">key_signature</span><span
|
459
|
+
class="method-args">(sharpflat, is_minor)</span>
|
460
|
+
<span class="method-click-advice">click to toggle source</span>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
|
464
|
+
<div class="method-description">
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
<div class="method-source-code" id="key_signature-source">
|
471
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 185</span>
|
472
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">key_signature</span>(<span class="ruby-identifier">sharpflat</span>, <span class="ruby-identifier">is_minor</span>)
|
473
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">KeySig</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sharpflat</span>, <span class="ruby-identifier">is_minor</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
474
|
+
<span class="ruby-keyword">end</span></pre>
|
475
|
+
</div><!-- key_signature-source -->
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
</div><!-- key_signature-method -->
|
483
|
+
|
484
|
+
|
485
|
+
<div id="method-i-make_note_off" class="method-detail ">
|
486
|
+
|
487
|
+
<div class="method-heading">
|
488
|
+
<span class="method-name">make_note_off</span><span
|
489
|
+
class="method-args">(on, vel)</span>
|
490
|
+
<span class="method-click-advice">click to toggle source</span>
|
491
|
+
</div>
|
492
|
+
|
493
|
+
|
494
|
+
<div class="method-description">
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
<div class="method-source-code" id="make_note_off-source">
|
501
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 98</span>
|
502
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-identifier">vel</span>)
|
503
|
+
<span class="ruby-identifier">off</span> = <span class="ruby-constant">NoteOff</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">on</span>.<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">on</span>.<span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
504
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">off</span>
|
505
|
+
<span class="ruby-identifier">on</span>.<span class="ruby-identifier">off</span> = <span class="ruby-identifier">off</span>
|
506
|
+
<span class="ruby-identifier">off</span>.<span class="ruby-identifier">on</span> = <span class="ruby-identifier">on</span>
|
507
|
+
<span class="ruby-keyword">end</span></pre>
|
508
|
+
</div><!-- make_note_off-source -->
|
509
|
+
|
510
|
+
</div>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
</div><!-- make_note_off-method -->
|
516
|
+
|
517
|
+
|
518
|
+
<div id="method-i-meta_misc" class="method-detail ">
|
519
|
+
|
520
|
+
<div class="method-heading">
|
521
|
+
<span class="method-name">meta_misc</span><span
|
522
|
+
class="method-args">(type, msg)</span>
|
523
|
+
<span class="method-click-advice">click to toggle source</span>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
|
527
|
+
<div class="method-description">
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
<div class="method-source-code" id="meta_misc-source">
|
534
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 134</span>
|
535
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">meta_misc</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
|
536
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
537
|
+
<span class="ruby-keyword">end</span></pre>
|
538
|
+
</div><!-- meta_misc-source -->
|
539
|
+
|
540
|
+
</div>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
</div><!-- meta_misc-method -->
|
546
|
+
|
547
|
+
|
548
|
+
<div id="method-i-note_off" class="method-detail ">
|
549
|
+
|
550
|
+
<div class="method-heading">
|
551
|
+
<span class="method-name">note_off</span><span
|
552
|
+
class="method-args">(chan, note, vel)</span>
|
553
|
+
<span class="method-click-advice">click to toggle source</span>
|
554
|
+
</div>
|
555
|
+
|
556
|
+
|
557
|
+
<div class="method-description">
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
<div class="method-source-code" id="note_off-source">
|
564
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 84</span>
|
565
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">note_off</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
|
566
|
+
<span class="ruby-comment"># Find note on, create note off, connect the two, and remove</span>
|
567
|
+
<span class="ruby-comment"># note on from pending list.</span>
|
568
|
+
<span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">each_with_index</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">on</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
|
569
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">on</span>.<span class="ruby-identifier">note</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">note</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">on</span>.<span class="ruby-identifier">channel</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">chan</span>
|
570
|
+
<span class="ruby-identifier">make_note_off</span>(<span class="ruby-identifier">on</span>, <span class="ruby-identifier">vel</span>)
|
571
|
+
<span class="ruby-ivar">@pending</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">i</span>)
|
572
|
+
<span class="ruby-keyword">return</span>
|
573
|
+
<span class="ruby-keyword">end</span>
|
574
|
+
}
|
575
|
+
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"note off with no earlier note on (ch #{chan}, note"</span> <span class="ruby-operator">+</span>
|
576
|
+
<span class="ruby-node">" #{note}, vel #{vel})"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
577
|
+
<span class="ruby-keyword">end</span></pre>
|
578
|
+
</div><!-- note_off-source -->
|
579
|
+
|
580
|
+
</div>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
</div><!-- note_off-method -->
|
586
|
+
|
587
|
+
|
588
|
+
<div id="method-i-note_on" class="method-detail ">
|
589
|
+
|
590
|
+
<div class="method-heading">
|
591
|
+
<span class="method-name">note_on</span><span
|
592
|
+
class="method-args">(chan, note, vel)</span>
|
593
|
+
<span class="method-click-advice">click to toggle source</span>
|
594
|
+
</div>
|
595
|
+
|
596
|
+
|
597
|
+
<div class="method-description">
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
<div class="method-source-code" id="note_on-source">
|
604
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 72</span>
|
605
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">note_on</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>)
|
606
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">vel</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
607
|
+
<span class="ruby-identifier">note_off</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-value">64</span>)
|
608
|
+
<span class="ruby-keyword">return</span>
|
609
|
+
<span class="ruby-keyword">end</span>
|
610
|
+
|
611
|
+
<span class="ruby-identifier">on</span> = <span class="ruby-constant">NoteOn</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">vel</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
612
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">on</span>
|
613
|
+
<span class="ruby-ivar">@pending</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">on</span>
|
614
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
615
|
+
<span class="ruby-keyword">end</span></pre>
|
616
|
+
</div><!-- note_on-source -->
|
617
|
+
|
618
|
+
</div>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</div><!-- note_on-method -->
|
624
|
+
|
625
|
+
|
626
|
+
<div id="method-i-pitch_bend" class="method-detail ">
|
627
|
+
|
628
|
+
<div class="method-heading">
|
629
|
+
<span class="method-name">pitch_bend</span><span
|
630
|
+
class="method-args">(chan, lsb, msb)</span>
|
631
|
+
<span class="method-click-advice">click to toggle source</span>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
|
635
|
+
<div class="method-description">
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
<div class="method-source-code" id="pitch_bend-source">
|
642
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 115</span>
|
643
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pitch_bend</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">lsb</span>, <span class="ruby-identifier">msb</span>)
|
644
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PitchBend</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, (<span class="ruby-identifier">msb</span> <span class="ruby-operator"><<</span> <span class="ruby-value">7</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">lsb</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
645
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
646
|
+
<span class="ruby-keyword">end</span></pre>
|
647
|
+
</div><!-- pitch_bend-source -->
|
648
|
+
|
649
|
+
</div>
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
</div><!-- pitch_bend-method -->
|
655
|
+
|
656
|
+
|
657
|
+
<div id="method-i-pressure" class="method-detail ">
|
658
|
+
|
659
|
+
<div class="method-heading">
|
660
|
+
<span class="method-name">pressure</span><span
|
661
|
+
class="method-args">(chan, note, press)</span>
|
662
|
+
<span class="method-click-advice">click to toggle source</span>
|
663
|
+
</div>
|
664
|
+
|
665
|
+
|
666
|
+
<div class="method-description">
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
<div class="method-source-code" id="pressure-source">
|
673
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 105</span>
|
674
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pressure</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">press</span>)
|
675
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PolyPressure</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">note</span>, <span class="ruby-identifier">press</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
676
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
677
|
+
<span class="ruby-keyword">end</span></pre>
|
678
|
+
</div><!-- pressure-source -->
|
679
|
+
|
680
|
+
</div>
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
</div><!-- pressure-method -->
|
686
|
+
|
687
|
+
|
688
|
+
<div id="method-i-program" class="method-detail ">
|
689
|
+
|
690
|
+
<div class="method-heading">
|
691
|
+
<span class="method-name">program</span><span
|
692
|
+
class="method-args">(chan, program)</span>
|
693
|
+
<span class="method-click-advice">click to toggle source</span>
|
694
|
+
</div>
|
695
|
+
|
696
|
+
|
697
|
+
<div class="method-description">
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
<div class="method-source-code" id="program-source">
|
704
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 120</span>
|
705
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">program</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">program</span>)
|
706
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">ProgramChange</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">chan</span>, <span class="ruby-identifier">program</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
707
|
+
<span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
708
|
+
<span class="ruby-keyword">end</span></pre>
|
709
|
+
</div><!-- program-source -->
|
710
|
+
|
711
|
+
</div>
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
</div><!-- program-method -->
|
717
|
+
|
718
|
+
|
719
|
+
<div id="method-i-start_track" class="method-detail ">
|
720
|
+
|
721
|
+
<div class="method-heading">
|
722
|
+
<span class="method-name">start_track</span><span
|
723
|
+
class="method-args">()</span>
|
724
|
+
<span class="method-click-advice">click to toggle source</span>
|
725
|
+
</div>
|
726
|
+
|
727
|
+
|
728
|
+
<div class="method-description">
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
<div class="method-source-code" id="start_track-source">
|
735
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 45</span>
|
736
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start_track</span>()
|
737
|
+
<span class="ruby-ivar">@track</span> = <span class="ruby-constant">Track</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@seq</span>)
|
738
|
+
<span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@track</span>
|
739
|
+
|
740
|
+
<span class="ruby-ivar">@pending</span> = []
|
741
|
+
<span class="ruby-keyword">end</span></pre>
|
742
|
+
</div><!-- start_track-source -->
|
743
|
+
|
744
|
+
</div>
|
745
|
+
|
746
|
+
|
747
|
+
|
748
|
+
|
749
|
+
</div><!-- start_track-method -->
|
750
|
+
|
751
|
+
|
752
|
+
<div id="method-i-sysex" class="method-detail ">
|
753
|
+
|
754
|
+
<div class="method-heading">
|
755
|
+
<span class="method-name">sysex</span><span
|
756
|
+
class="method-args">(msg)</span>
|
757
|
+
<span class="method-click-advice">click to toggle source</span>
|
758
|
+
</div>
|
759
|
+
|
760
|
+
|
761
|
+
<div class="method-description">
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
<div class="method-source-code" id="sysex-source">
|
768
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 130</span>
|
769
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">sysex</span>(<span class="ruby-identifier">msg</span>)
|
770
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">SystemExclusive</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
771
|
+
<span class="ruby-keyword">end</span></pre>
|
772
|
+
</div><!-- sysex-source -->
|
773
|
+
|
774
|
+
</div>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
</div><!-- sysex-method -->
|
780
|
+
|
781
|
+
|
782
|
+
<div id="method-i-tempo" class="method-detail ">
|
783
|
+
|
784
|
+
<div class="method-heading">
|
785
|
+
<span class="method-name">tempo</span><span
|
786
|
+
class="method-args">(microsecs)</span>
|
787
|
+
<span class="method-click-advice">click to toggle source</span>
|
788
|
+
</div>
|
789
|
+
|
790
|
+
|
791
|
+
<div class="method-description">
|
792
|
+
|
793
|
+
<p>--</p>
|
794
|
+
|
795
|
+
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">smpte</span>(<span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">frame</span>, <span class="ruby-identifier">fract</span>)
|
796
|
+
<span class="ruby-keyword">end</span>
|
797
|
+
</pre>
|
798
|
+
|
799
|
+
<p>++</p>
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
<div class="method-source-code" id="tempo-source">
|
804
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 181</span>
|
805
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tempo</span>(<span class="ruby-identifier">microsecs</span>)
|
806
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Tempo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">microsecs</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
807
|
+
<span class="ruby-keyword">end</span></pre>
|
808
|
+
</div><!-- tempo-source -->
|
809
|
+
|
810
|
+
</div>
|
811
|
+
|
812
|
+
|
813
|
+
|
814
|
+
|
815
|
+
</div><!-- tempo-method -->
|
816
|
+
|
817
|
+
|
818
|
+
<div id="method-i-text" class="method-detail ">
|
819
|
+
|
820
|
+
<div class="method-heading">
|
821
|
+
<span class="method-name">text</span><span
|
822
|
+
class="method-args">(type, msg)</span>
|
823
|
+
<span class="method-click-advice">click to toggle source</span>
|
824
|
+
</div>
|
825
|
+
|
826
|
+
|
827
|
+
<div class="method-description">
|
828
|
+
|
829
|
+
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">sequence_number</span>(<span class="ruby-identifier">num</span>)
|
830
|
+
<span class="ruby-keyword">end</span>
|
831
|
+
</pre>
|
832
|
+
|
833
|
+
<p>++</p>
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
<div class="method-source-code" id="text-source">
|
838
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 146</span>
|
839
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">text</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>)
|
840
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
|
841
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">META_TEXT</span>, <span class="ruby-constant">META_LYRIC</span>, <span class="ruby-constant">META_CUE</span>
|
842
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
843
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">META_SEQ_NAME</span>, <span class="ruby-constant">META_COPYRIGHT</span>
|
844
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-value">0</span>)
|
845
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">META_INSTRUMENT</span>
|
846
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">instrument</span> = <span class="ruby-identifier">msg</span>
|
847
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">META_MARKER</span>
|
848
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Marker</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
849
|
+
<span class="ruby-keyword">else</span>
|
850
|
+
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"text = #{msg}, type = #{type}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
851
|
+
<span class="ruby-keyword">end</span>
|
852
|
+
<span class="ruby-keyword">end</span></pre>
|
853
|
+
</div><!-- text-source -->
|
854
|
+
|
855
|
+
</div>
|
856
|
+
|
857
|
+
|
858
|
+
|
859
|
+
|
860
|
+
</div><!-- text-method -->
|
861
|
+
|
862
|
+
|
863
|
+
<div id="method-i-time_signature" class="method-detail ">
|
864
|
+
|
865
|
+
<div class="method-heading">
|
866
|
+
<span class="method-name">time_signature</span><span
|
867
|
+
class="method-args">(numer, denom, clocks, qnotes)</span>
|
868
|
+
<span class="method-click-advice">click to toggle source</span>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
|
872
|
+
<div class="method-description">
|
873
|
+
|
874
|
+
<p>-- Don't bother adding the META_TRACK_END event to the track. This way, we
|
875
|
+
don't have to worry about always making sure the last event is always a
|
876
|
+
track end event. We just have to make sure to write one when the track is
|
877
|
+
output back to a file.</p>
|
878
|
+
|
879
|
+
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">eot</span>()
|
880
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_TRACK_END</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@curr_ticks</span>)
|
881
|
+
<span class="ruby-keyword">end</span>
|
882
|
+
</pre>
|
883
|
+
|
884
|
+
<p>++</p>
|
885
|
+
|
886
|
+
|
887
|
+
|
888
|
+
<div class="method-source-code" id="time_signature-source">
|
889
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 171</span>
|
890
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">time_signature</span>(<span class="ruby-identifier">numer</span>, <span class="ruby-identifier">denom</span>, <span class="ruby-identifier">clocks</span>, <span class="ruby-identifier">qnotes</span>)
|
891
|
+
<span class="ruby-ivar">@seq</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>)
|
892
|
+
<span class="ruby-ivar">@track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">TimeSig</span>.<span class="ruby-identifier">new</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>, <span class="ruby-ivar">@curr_ticks</span>)
|
893
|
+
<span class="ruby-keyword">end</span></pre>
|
894
|
+
</div><!-- time_signature-source -->
|
895
|
+
|
896
|
+
</div>
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
|
901
|
+
</div><!-- time_signature-method -->
|
902
|
+
|
903
|
+
|
904
|
+
<div id="method-i-track_uses_channel" class="method-detail ">
|
905
|
+
|
906
|
+
<div class="method-heading">
|
907
|
+
<span class="method-name">track_uses_channel</span><span
|
908
|
+
class="method-args">(chan)</span>
|
909
|
+
<span class="method-click-advice">click to toggle source</span>
|
910
|
+
</div>
|
911
|
+
|
912
|
+
|
913
|
+
<div class="method-description">
|
914
|
+
|
915
|
+
<p>Return true if the current track uses the specified channel.</p>
|
916
|
+
|
917
|
+
|
918
|
+
|
919
|
+
<div class="method-source-code" id="track_uses_channel-source">
|
920
|
+
<pre><span class="ruby-comment"># File lib/midilib/io/seqreader.rb, line 195</span>
|
921
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">track_uses_channel</span>(<span class="ruby-identifier">chan</span>)
|
922
|
+
<span class="ruby-ivar">@chan_mask</span> = <span class="ruby-ivar">@chan_mask</span> <span class="ruby-operator">|</span> (<span class="ruby-value">1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">chan</span>)
|
923
|
+
<span class="ruby-keyword">end</span></pre>
|
924
|
+
</div><!-- track_uses_channel-source -->
|
925
|
+
|
926
|
+
</div>
|
927
|
+
|
928
|
+
|
929
|
+
|
930
|
+
|
931
|
+
</div><!-- track_uses_channel-method -->
|
932
|
+
|
933
|
+
|
934
|
+
</section><!-- public-instance-method-details -->
|
935
|
+
|
936
|
+
</section><!-- 5Buntitled-5D -->
|
937
|
+
|
938
|
+
</div><!-- documentation -->
|
939
|
+
|
940
|
+
|
941
|
+
<footer id="validator-badges">
|
942
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
943
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
944
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
945
|
+
</footer>
|
946
|
+
|