midilib 3.1.0 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +12 -12
- data/Credits +7 -0
- data/README.rdoc +12 -148
- data/Rakefile +5 -15
- data/TODO.rdoc +8 -7
- data/examples/from_scratch.rb +2 -7
- data/examples/measures_mbt.rb +1 -6
- data/examples/print_program_changes.rb +1 -3
- data/examples/reader2text.rb +2 -7
- data/examples/seq2text.rb +1 -6
- data/examples/split.rb +1 -6
- data/examples/strings.rb +2 -7
- data/examples/transpose.rb +3 -8
- data/lib/midilib/consts.rb +2 -0
- data/lib/midilib/event.rb +2 -2
- data/lib/midilib/info.rb +4 -4
- data/lib/midilib/io/seqreader.rb +11 -27
- data/lib/midilib/io/seqwriter.rb +6 -4
- data/lib/midilib/track.rb +38 -6
- data/test/test_event.rb +13 -6
- data/test/test_io.rb +144 -13
- data/test/test_mergesort.rb +1 -6
- data/test/test_midifile.rb +1 -6
- data/test/test_sequence.rb +1 -6
- data/test/test_track.rb +66 -7
- data/test/test_varlen.rb +1 -6
- metadata +3 -87
- data/html/MIDI/ActiveSense.html +0 -171
- data/html/MIDI/ChannelEvent.html +0 -190
- data/html/MIDI/ChannelPressure.html +0 -212
- data/html/MIDI/Clock.html +0 -171
- data/html/MIDI/Continue.html +0 -171
- data/html/MIDI/Controller.html +0 -224
- data/html/MIDI/Event.html +0 -349
- data/html/MIDI/IO/MIDIFile.html +0 -1392
- data/html/MIDI/IO/SeqReader.html +0 -642
- data/html/MIDI/IO/SeqWriter.html +0 -442
- data/html/MIDI/IO.html +0 -91
- data/html/MIDI/KeySig.html +0 -292
- data/html/MIDI/Marker.html +0 -138
- data/html/MIDI/Measure.html +0 -260
- data/html/MIDI/Measures.html +0 -222
- data/html/MIDI/MetaEvent.html +0 -353
- data/html/MIDI/NoteEvent.html +0 -255
- data/html/MIDI/NoteOff.html +0 -188
- data/html/MIDI/NoteOn.html +0 -188
- data/html/MIDI/PitchBend.html +0 -213
- data/html/MIDI/PolyPressure.html +0 -216
- data/html/MIDI/ProgramChange.html +0 -212
- data/html/MIDI/Realtime.html +0 -194
- data/html/MIDI/Sequence.html +0 -641
- data/html/MIDI/SongPointer.html +0 -213
- data/html/MIDI/SongSelect.html +0 -212
- data/html/MIDI/Start.html +0 -171
- data/html/MIDI/Stop.html +0 -171
- data/html/MIDI/SystemCommon.html +0 -138
- data/html/MIDI/SystemExclusive.html +0 -215
- data/html/MIDI/SystemReset.html +0 -171
- data/html/MIDI/Tempo.html +0 -292
- data/html/MIDI/TimeSig.html +0 -286
- data/html/MIDI/Track.html +0 -489
- data/html/MIDI/TuneRequest.html +0 -194
- data/html/MIDI/Utils.html +0 -178
- data/html/MIDI.html +0 -281
- data/html/Object.html +0 -197
- data/html/README_rdoc.html +0 -545
- data/html/TODO_rdoc.html +0 -123
- data/html/created.rid +0 -15
- data/html/css/fonts.css +0 -167
- data/html/css/rdoc.css +0 -639
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +0 -534
- data/html/js/darkfish.js +0 -84
- data/html/js/navigation.js +0 -105
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +0 -110
- data/html/js/search_index.js +0 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +0 -229
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +0 -1258
data/html/Object.html
DELETED
@@ -1,197 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class Object - midilib</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "./";
|
11
|
-
var index_rel_prefix = "./";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="./js/navigation.js" defer></script>
|
15
|
-
<script src="./js/search.js" defer></script>
|
16
|
-
<script src="./js/search_index.js" defer></script>
|
17
|
-
<script src="./js/searcher.js" defer></script>
|
18
|
-
<script src="./js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
<body id="top" role="document" class="class">
|
25
|
-
<nav role="navigation">
|
26
|
-
<div id="project-navigation">
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
-
<h2>
|
29
|
-
<a href="./index.html" rel="home">Home</a>
|
30
|
-
</h2>
|
31
|
-
|
32
|
-
<div id="table-of-contents-navigation">
|
33
|
-
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
-
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
-
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
41
|
-
<div id="search-field-wrapper">
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
-
</div>
|
47
|
-
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
49
|
-
aria-busy="false" aria-expanded="false"
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
-
</form>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
</div>
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
<div id="class-metadata">
|
59
|
-
|
60
|
-
|
61
|
-
<div id="parent-class-section" class="nav-section">
|
62
|
-
<h3>Parent</h3>
|
63
|
-
|
64
|
-
<p class="link">BasicObject
|
65
|
-
</div>
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
<!-- Method Quickref -->
|
71
|
-
<div id="method-list-section" class="nav-section">
|
72
|
-
<h3>Methods</h3>
|
73
|
-
|
74
|
-
<ul class="link-list" role="directory">
|
75
|
-
<li ><a href="#method-i-mergesort">#mergesort</a>
|
76
|
-
<li ><a href="#method-i-mergesort_merge">#mergesort_merge</a>
|
77
|
-
<li ><a href="#method-i-mergesort_split">#mergesort_split</a>
|
78
|
-
</ul>
|
79
|
-
</div>
|
80
|
-
|
81
|
-
</div>
|
82
|
-
</nav>
|
83
|
-
|
84
|
-
<main role="main" aria-labelledby="class-Object">
|
85
|
-
<h1 id="class-Object" class="class">
|
86
|
-
class Object
|
87
|
-
</h1>
|
88
|
-
|
89
|
-
<section class="description">
|
90
|
-
|
91
|
-
</section>
|
92
|
-
|
93
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
100
|
-
<header>
|
101
|
-
<h3>Public Instance Methods</h3>
|
102
|
-
</header>
|
103
|
-
|
104
|
-
<div id="method-i-mergesort" class="method-detail ">
|
105
|
-
<div class="method-heading">
|
106
|
-
<span class="method-name">mergesort</span><span
|
107
|
-
class="method-args">(arr, &cmp)</span>
|
108
|
-
<span class="method-click-advice">click to toggle source</span>
|
109
|
-
</div>
|
110
|
-
|
111
|
-
<div class="method-description">
|
112
|
-
<p>A stable sorting algorithm that maintains the relative order of equal elements.</p>
|
113
|
-
|
114
|
-
<p>This code used to be in a new subclass of Array, but that started causing problems in Ruby 3.0, apparently due to the return type of the ‘[]` operator which was the parent Array class.</p>
|
115
|
-
|
116
|
-
<p>This code borrowed from ‘Moser’ <a href="http://codesnippets.joyent.com/posts/show/1699">codesnippets.joyent.com/posts/show/1699</a></p>
|
117
|
-
|
118
|
-
<div class="method-source-code" id="mergesort-source">
|
119
|
-
<pre><span class="ruby-comment"># File lib/midilib/mergesort.rb, line 14</span>
|
120
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mergesort</span>(<span class="ruby-identifier">arr</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">cmp</span>)
|
121
|
-
<span class="ruby-identifier">cmp</span> = <span class="ruby-operator">-></span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>) { <span class="ruby-identifier">a</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">cmp</span>.<span class="ruby-identifier">nil?</span>
|
122
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
123
|
-
<span class="ruby-identifier">arr</span>.<span class="ruby-identifier">dup</span>
|
124
|
-
<span class="ruby-keyword">else</span>
|
125
|
-
<span class="ruby-identifier">halves</span> = <span class="ruby-identifier">mergesort_split</span>(<span class="ruby-identifier">arr</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">half</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mergesort</span>(<span class="ruby-identifier">half</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">cmp</span>) }
|
126
|
-
<span class="ruby-identifier">mergesort_merge</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">halves</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">cmp</span>)
|
127
|
-
<span class="ruby-keyword">end</span>
|
128
|
-
<span class="ruby-keyword">end</span></pre>
|
129
|
-
</div>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<div id="method-i-mergesort_merge" class="method-detail ">
|
136
|
-
<div class="method-heading">
|
137
|
-
<span class="method-name">mergesort_merge</span><span
|
138
|
-
class="method-args">(first, second, &predicate)</span>
|
139
|
-
<span class="method-click-advice">click to toggle source</span>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
<div class="method-description">
|
143
|
-
|
144
|
-
|
145
|
-
<div class="method-source-code" id="mergesort_merge-source">
|
146
|
-
<pre><span class="ruby-comment"># File lib/midilib/mergesort.rb, line 29</span>
|
147
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mergesort_merge</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">predicate</span>)
|
148
|
-
<span class="ruby-identifier">result</span> = []
|
149
|
-
<span class="ruby-keyword">until</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">second</span>.<span class="ruby-identifier">empty?</span>
|
150
|
-
<span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">predicate</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">first</span>.<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>.<span class="ruby-identifier">first</span>) <span class="ruby-operator"><=</span> <span class="ruby-value">0</span>
|
151
|
-
<span class="ruby-identifier">first</span>.<span class="ruby-identifier">shift</span>
|
152
|
-
<span class="ruby-keyword">else</span>
|
153
|
-
<span class="ruby-identifier">second</span>.<span class="ruby-identifier">shift</span>
|
154
|
-
<span class="ruby-keyword">end</span>
|
155
|
-
<span class="ruby-keyword">end</span>
|
156
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">first</span>).<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">second</span>)
|
157
|
-
<span class="ruby-keyword">end</span></pre>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
|
161
|
-
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div id="method-i-mergesort_split" class="method-detail ">
|
165
|
-
<div class="method-heading">
|
166
|
-
<span class="method-name">mergesort_split</span><span
|
167
|
-
class="method-args">(arr)</span>
|
168
|
-
<span class="method-click-advice">click to toggle source</span>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
|
173
|
-
|
174
|
-
<div class="method-source-code" id="mergesort_split-source">
|
175
|
-
<pre><span class="ruby-comment"># File lib/midilib/mergesort.rb, line 24</span>
|
176
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mergesort_split</span>(<span class="ruby-identifier">arr</span>)
|
177
|
-
<span class="ruby-identifier">n</span> = (<span class="ruby-identifier">arr</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>).<span class="ruby-identifier">floor</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
178
|
-
[<span class="ruby-identifier">arr</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">n</span>], <span class="ruby-identifier">arr</span>[<span class="ruby-identifier">n</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]]
|
179
|
-
<span class="ruby-keyword">end</span></pre>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
|
184
|
-
</div>
|
185
|
-
|
186
|
-
</section>
|
187
|
-
|
188
|
-
</section>
|
189
|
-
</main>
|
190
|
-
|
191
|
-
|
192
|
-
<footer id="validator-badges" role="contentinfo">
|
193
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
194
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
195
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
196
|
-
</footer>
|
197
|
-
|