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