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