midilib 2.0.0 → 2.0.1
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/Credits +11 -2
- data/README.rdoc +17 -26
- data/Rakefile +34 -7
- data/install.rb +2 -2
- data/lib/midilib/info.rb +2 -2
- metadata +25 -119
- data/html/Array.html +0 -382
- data/html/IO.html +0 -277
- data/html/MIDI.html +0 -829
- data/html/MIDI/ActiveSense.html +0 -317
- data/html/MIDI/ChannelEvent.html +0 -347
- data/html/MIDI/ChannelPressure.html +0 -379
- data/html/MIDI/Clock.html +0 -317
- data/html/MIDI/Continue.html +0 -317
- data/html/MIDI/Controller.html +0 -398
- data/html/MIDI/Event.html +0 -659
- data/html/MIDI/IO.html +0 -238
- data/html/MIDI/IO/MIDIFile.html +0 -2269
- data/html/MIDI/IO/SeqReader.html +0 -1051
- data/html/MIDI/IO/SeqWriter.html +0 -706
- data/html/MIDI/KeySig.html +0 -487
- data/html/MIDI/Marker.html +0 -275
- data/html/MIDI/Measure.html +0 -479
- data/html/MIDI/Measures.html +0 -416
- data/html/MIDI/MetaEvent.html +0 -617
- data/html/MIDI/NoteEvent.html +0 -459
- data/html/MIDI/NoteOff.html +0 -341
- data/html/MIDI/NoteOn.html +0 -341
- data/html/MIDI/PitchBend.html +0 -380
- data/html/MIDI/PolyPressure.html +0 -390
- data/html/MIDI/ProgramChange.html +0 -379
- data/html/MIDI/Realtime.html +0 -354
- data/html/MIDI/Sequence.html +0 -1063
- data/html/MIDI/SongPointer.html +0 -380
- data/html/MIDI/SongSelect.html +0 -379
- data/html/MIDI/Start.html +0 -317
- data/html/MIDI/Stop.html +0 -317
- data/html/MIDI/SystemCommon.html +0 -275
- data/html/MIDI/SystemExclusive.html +0 -382
- data/html/MIDI/SystemReset.html +0 -317
- data/html/MIDI/Tempo.html +0 -519
- data/html/MIDI/TimeSig.html +0 -524
- data/html/MIDI/Track.html +0 -859
- data/html/MIDI/TuneRequest.html +0 -354
- data/html/MIDI/Utils.html +0 -350
- data/html/README_rdoc.html +0 -882
- data/html/TODO_rdoc.html +0 -215
- data/html/created.rid +0 -14
- 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 +0 -1266
- data/html/js/darkfish.js +0 -116
- data/html/js/jquery.js +0 -32
- data/html/js/quicksearch.js +0 -114
- data/html/js/thickbox-compressed.js +0 -10
- data/html/lib/midilib/consts_rb.html +0 -55
- data/html/lib/midilib/event_rb.html +0 -56
- data/html/lib/midilib/info_rb.html +0 -52
- data/html/lib/midilib/io/midifile_rb.html +0 -54
- data/html/lib/midilib/io/seqreader_rb.html +0 -58
- data/html/lib/midilib/io/seqwriter_rb.html +0 -59
- data/html/lib/midilib/measure_rb.html +0 -54
- data/html/lib/midilib/sequence_rb.html +0 -58
- data/html/lib/midilib/track_rb.html +0 -54
- data/html/lib/midilib/utils_rb.html +0 -52
- data/html/lib/midilib_rb.html +0 -71
- data/html/rdoc.css +0 -706
data/Credits
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
midilib is developed by Jim Menard,
|
2
|
-
suggestions have come from:
|
1
|
+
midilib is developed by Jim Menard, jim@jimmenard.com. Additional bug fixes
|
2
|
+
and suggestions have come from:
|
3
3
|
|
4
4
|
Mario Pehle <rubyforge.org@errorinitus.de>
|
5
5
|
|
@@ -40,3 +40,12 @@ Adam Murray (adamjmurray on Github)
|
|
40
40
|
|
41
41
|
Found problem with Track#recalc_delta_from_times sorting, and wrote the
|
42
42
|
fix that is incorporated there.
|
43
|
+
|
44
|
+
Shai Rosenfeld (shaiguitar on Github)
|
45
|
+
|
46
|
+
Corrected missing block arg in README.
|
47
|
+
|
48
|
+
J (dark-panda on Github)
|
49
|
+
|
50
|
+
Instead of monkeypatching ::Array, put sorting methods into new
|
51
|
+
MIDI::Array subclass to avoid clashes with Rails app.
|
data/README.rdoc
CHANGED
@@ -119,14 +119,6 @@ Each event holds not only its delta time but also its time from the start of
|
|
119
119
|
the track. The track is responsible for recalculating its events' start times.
|
120
120
|
You can call MIDI::Track#recalc_times to do so.
|
121
121
|
|
122
|
-
Events have a number of boolean methods that identify their types, like
|
123
|
-
channel?, note?, note_on?, note_off?, meta?, system?, realtime?, and
|
124
|
-
program_change?. Events know how to print themselves. By default, all numbers
|
125
|
-
are printed as hexidecimal and channel numbers are printed from 0-15. Setting
|
126
|
-
print_decimal_numbers to true will output decimal numbers and setting
|
127
|
-
print_channel_numbers_from_one will output channel numbers from 1-16.
|
128
|
-
|
129
|
-
|
130
122
|
Subclasses of MIDI::Event implement the various MIDI messages such as note on
|
131
123
|
and off, controller values, system exclusive data, and realtime bytes.
|
132
124
|
|
@@ -157,11 +149,11 @@ examples directory, which are described below.
|
|
157
149
|
To read a MIDI file, create a MIDI::Sequence object and call its #read method,
|
158
150
|
passing in an IO object.
|
159
151
|
|
160
|
-
The #read method takes an optional block. If present, the block is called
|
161
|
-
after each track has finished being read. Each time, it is passed the
|
162
|
-
number of tracks and the number of the current track
|
163
|
-
This is useful for notifying the user of progress,
|
164
|
-
GUI progress bar.
|
152
|
+
The #read method takes an optional block. If present, the block is called
|
153
|
+
once after each track has finished being read. Each time, it is passed the
|
154
|
+
track object, the total number of tracks and the number of the current track
|
155
|
+
that has just been read. This is useful for notifying the user of progress,
|
156
|
+
for example by updating a GUI progress bar.
|
165
157
|
|
166
158
|
require 'midilib/io/seqreader'
|
167
159
|
|
@@ -170,7 +162,7 @@ GUI progress bar.
|
|
170
162
|
|
171
163
|
# Read the contents of a MIDI file into the sequence.
|
172
164
|
File.open('my_midi_file.mid', 'rb') { | file |
|
173
|
-
seq.read(file) { | num_tracks, i |
|
165
|
+
seq.read(file) { | track, num_tracks, i |
|
174
166
|
# Print something when each track is read.
|
175
167
|
puts "read track #{i} of #{num_tracks}"
|
176
168
|
}
|
@@ -199,8 +191,7 @@ is a useful template for programatically manipulating MIDI data.
|
|
199
191
|
|
200
192
|
|
201
193
|
This code transposes all of the note events (note on, note off, and poly
|
202
|
-
pressure) on channel 5 down one octave.
|
203
|
-
be transposed: the method #note? returns true.
|
194
|
+
pressure) on channel 5 down one octave.
|
204
195
|
|
205
196
|
==== Transposing One Channel
|
206
197
|
|
@@ -212,7 +203,7 @@ be transposed: the method #note? returns true.
|
|
212
203
|
|
213
204
|
# Read the contents of a MIDI file into the sequence.
|
214
205
|
File.open('my_input_file.mid', 'rb') { | file |
|
215
|
-
seq.read(file) { | num_tracks, i |
|
206
|
+
seq.read(file) { | track, num_tracks, i |
|
216
207
|
# Print something when each track is read.
|
217
208
|
puts "read track #{i} of #{num_tracks}"
|
218
209
|
}
|
@@ -224,7 +215,7 @@ be transposed: the method #note? returns true.
|
|
224
215
|
# If the event is a note event (note on, note off, or poly
|
225
216
|
# pressure) and it is on MIDI channel 5 (channels start at
|
226
217
|
# 0, so we use 4), then transpose the event down one octave.
|
227
|
-
if event
|
218
|
+
if MIDI::NoteEvent === event && event.channel == 4
|
228
219
|
event.note -= 12
|
229
220
|
end
|
230
221
|
}
|
@@ -318,15 +309,15 @@ the format of MIDI commands.
|
|
318
309
|
* Visit the forums, bug list, and mailing list pages at
|
319
310
|
http://rubyforge.org/projects/midilib
|
320
311
|
|
321
|
-
* Send email to Jim Menard at mailto:
|
312
|
+
* Send email to Jim Menard at mailto:jim@jimmenard.com
|
322
313
|
|
323
314
|
* Ask on the ruby-talk mailing list
|
324
315
|
|
325
316
|
|
326
317
|
= Administrivia
|
327
318
|
|
328
|
-
Author:: Jim Menard (mailto:
|
329
|
-
Copyright:: Copyright (c) 2003-
|
319
|
+
Author:: Jim Menard (mailto:jim@jimmenard.com)
|
320
|
+
Copyright:: Copyright (c) 2003-2012 Jim Menard
|
330
321
|
License:: Distributed under the same license as Ruby.
|
331
322
|
|
332
323
|
|
@@ -339,11 +330,11 @@ http://www.ruby-lang.org/en/LICENSE.txt.
|
|
339
330
|
midilib may be freely copied in its entirety providing this notice, all
|
340
331
|
source code, all documentation, and all other files are included.
|
341
332
|
|
342
|
-
midilib is Copyright (c) 2003-
|
333
|
+
midilib is Copyright (c) 2003-2012 by Jim Menard.
|
343
334
|
|
344
335
|
The song "No Fences" contained in the MIDI file examples/NoFences.mid is
|
345
|
-
Copyright (c) 1992 by Jim Menard (
|
346
|
-
non-commercial purposes as long as the author is given credit.
|
336
|
+
Copyright (c) 1992 by Jim Menard (jim@jimmenard.com). It may be freely used
|
337
|
+
for non-commercial purposes as long as the author is given credit.
|
347
338
|
|
348
339
|
|
349
340
|
=== Recent Changes
|
@@ -359,9 +350,9 @@ my_event.kind_of?(MIDI::MetaEvent)). Case statements that use classes work,
|
|
359
350
|
too:
|
360
351
|
|
361
352
|
case my_event
|
362
|
-
when MIDI::
|
353
|
+
when MIDI::NoteEvent # superclass of note on, note off, poly press
|
363
354
|
do_this()
|
364
|
-
when MIDI::
|
355
|
+
when MIDI::Controller
|
365
356
|
do_that()
|
366
357
|
end
|
367
358
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
if RUBY_VERSION >= '1.9'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
require 'rake/testtask'
|
7
|
+
else
|
3
8
|
require 'rake/rdoctask'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rake/runtest'
|
9
|
+
require 'rake/gempackagetask'
|
10
|
+
require 'rake/runtest'
|
11
|
+
end
|
6
12
|
|
7
13
|
PROJECT_NAME = 'midilib'
|
8
14
|
RDOC_DIR = 'html'
|
@@ -32,7 +38,7 @@ spec = Gem::Specification.new do |s|
|
|
32
38
|
s.extra_rdoc_files = ['README.rdoc', 'TODO.rdoc']
|
33
39
|
|
34
40
|
s.author = 'Jim Menard'
|
35
|
-
s.email = '
|
41
|
+
s.email = 'jim@jimmenard.com'
|
36
42
|
s.homepage = 'http://github.com/jimm/midilib'
|
37
43
|
s.rubyforge_project = PROJECT_NAME
|
38
44
|
|
@@ -43,11 +49,20 @@ writing standard MIDI files and manipulating MIDI event data.
|
|
43
49
|
EOF
|
44
50
|
end
|
45
51
|
|
46
|
-
|
47
|
-
#
|
48
|
-
|
52
|
+
if RUBY_VERSION >= '1.9'
|
53
|
+
# Creates a :package task (also named :gem). Also useful are
|
54
|
+
# :clobber_package and :repackage.
|
55
|
+
Gem::PackageTask.new(spec) do |pkg|
|
56
|
+
pkg.need_zip = true
|
57
|
+
pkg.need_tar = true
|
58
|
+
end
|
59
|
+
else
|
60
|
+
# Creates a :package task (also named :gem). Also useful are
|
61
|
+
# :clobber_package and :repackage.
|
62
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
49
63
|
pkg.need_zip = true
|
50
64
|
pkg.need_tar = true
|
65
|
+
end
|
51
66
|
end
|
52
67
|
|
53
68
|
# creates an "rdoc" task
|
@@ -57,10 +72,22 @@ Rake::RDocTask.new do | rd |
|
|
57
72
|
rd.rdoc_files.include('README.rdoc', 'TODO.rdoc', 'lib/**/*.rb')
|
58
73
|
end
|
59
74
|
|
75
|
+
desc "Publish gem"
|
60
76
|
task :publish => [:rdoc, :package] do
|
61
77
|
system "gem push"
|
62
78
|
end
|
63
79
|
|
64
|
-
|
80
|
+
if RUBY_VERSION >= '1.9'
|
81
|
+
Rake::TestTask.new do |t|
|
82
|
+
t.libs << File.join(File.dirname(__FILE__), 'test')
|
83
|
+
t.libs << File.join(File.dirname(__FILE__), 'lib')
|
84
|
+
t.ruby_opts << '-rubygems'
|
85
|
+
t.pattern = "test/**/test_*.rb"
|
86
|
+
end
|
87
|
+
else
|
88
|
+
task :test do
|
65
89
|
Rake::run_tests
|
90
|
+
end
|
66
91
|
end
|
92
|
+
|
93
|
+
task :clean => [:clobber_rdoc, :clobber_package]
|
data/install.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
#
|
5
5
|
# This script installs midilib into the Ruby site-local library directory.
|
6
6
|
#
|
7
|
-
# Author:: Jim Menard (mailto:
|
8
|
-
# Copyright:: Copyright (c) 2003-
|
7
|
+
# Author:: Jim Menard (mailto:jim@jimmenard.com)
|
8
|
+
# Copyright:: Copyright (c) 2003-2012 by Jim Menard
|
9
9
|
# License:: Distributed under the same license as Ruby.
|
10
10
|
#
|
11
11
|
|
data/lib/midilib/info.rb
CHANGED
@@ -2,8 +2,8 @@ module MIDI
|
|
2
2
|
|
3
3
|
VERSION_MAJOR = 2
|
4
4
|
VERSION_MINOR = 0
|
5
|
-
VERSION_TWEAK =
|
5
|
+
VERSION_TWEAK = 1
|
6
6
|
Version = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_TWEAK}"
|
7
|
-
Copyright = 'Copyright (c) 2003-
|
7
|
+
Copyright = 'Copyright (c) 2003-2012 by Jim Menard <jim@jimmenard.com>'
|
8
8
|
|
9
9
|
end
|
metadata
CHANGED
@@ -1,36 +1,28 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: midilib
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 2
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 2.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jim Menard
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-10-03 00:00:00 -04:00
|
18
|
-
default_executable:
|
12
|
+
date: 2012-07-29 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
14
|
+
description: ! 'midilib is a pure Ruby MIDI library useful for reading and
|
20
15
|
|
21
|
-
description: |
|
22
|
-
midilib is a pure Ruby MIDI library useful for reading and
|
23
16
|
writing standard MIDI files and manipulating MIDI event data.
|
24
17
|
|
25
|
-
|
18
|
+
'
|
19
|
+
email: jim@jimmenard.com
|
26
20
|
executables: []
|
27
|
-
|
28
21
|
extensions: []
|
29
|
-
|
30
|
-
extra_rdoc_files:
|
22
|
+
extra_rdoc_files:
|
31
23
|
- README.rdoc
|
32
24
|
- TODO.rdoc
|
33
|
-
files:
|
25
|
+
files:
|
34
26
|
- ChangeLog
|
35
27
|
- Credits
|
36
28
|
- Rakefile
|
@@ -46,85 +38,6 @@ files:
|
|
46
38
|
- examples/split.rb
|
47
39
|
- examples/strings.rb
|
48
40
|
- examples/transpose.rb
|
49
|
-
- html/Array.html
|
50
|
-
- html/created.rid
|
51
|
-
- html/images/brick.png
|
52
|
-
- html/images/brick_link.png
|
53
|
-
- html/images/bug.png
|
54
|
-
- html/images/bullet_black.png
|
55
|
-
- html/images/bullet_toggle_minus.png
|
56
|
-
- html/images/bullet_toggle_plus.png
|
57
|
-
- html/images/date.png
|
58
|
-
- html/images/find.png
|
59
|
-
- html/images/loadingAnimation.gif
|
60
|
-
- html/images/macFFBgHack.png
|
61
|
-
- html/images/package.png
|
62
|
-
- html/images/page_green.png
|
63
|
-
- html/images/page_white_text.png
|
64
|
-
- html/images/page_white_width.png
|
65
|
-
- html/images/plugin.png
|
66
|
-
- html/images/ruby.png
|
67
|
-
- html/images/tag_green.png
|
68
|
-
- html/images/wrench.png
|
69
|
-
- html/images/wrench_orange.png
|
70
|
-
- html/images/zoom.png
|
71
|
-
- html/index.html
|
72
|
-
- html/IO.html
|
73
|
-
- html/js/darkfish.js
|
74
|
-
- html/js/jquery.js
|
75
|
-
- html/js/quicksearch.js
|
76
|
-
- html/js/thickbox-compressed.js
|
77
|
-
- html/lib/midilib/consts_rb.html
|
78
|
-
- html/lib/midilib/event_rb.html
|
79
|
-
- html/lib/midilib/info_rb.html
|
80
|
-
- html/lib/midilib/io/midifile_rb.html
|
81
|
-
- html/lib/midilib/io/seqreader_rb.html
|
82
|
-
- html/lib/midilib/io/seqwriter_rb.html
|
83
|
-
- html/lib/midilib/measure_rb.html
|
84
|
-
- html/lib/midilib/sequence_rb.html
|
85
|
-
- html/lib/midilib/track_rb.html
|
86
|
-
- html/lib/midilib/utils_rb.html
|
87
|
-
- html/lib/midilib_rb.html
|
88
|
-
- html/MIDI/ActiveSense.html
|
89
|
-
- html/MIDI/ChannelEvent.html
|
90
|
-
- html/MIDI/ChannelPressure.html
|
91
|
-
- html/MIDI/Clock.html
|
92
|
-
- html/MIDI/Continue.html
|
93
|
-
- html/MIDI/Controller.html
|
94
|
-
- html/MIDI/Event.html
|
95
|
-
- html/MIDI/IO/MIDIFile.html
|
96
|
-
- html/MIDI/IO/SeqReader.html
|
97
|
-
- html/MIDI/IO/SeqWriter.html
|
98
|
-
- html/MIDI/IO.html
|
99
|
-
- html/MIDI/KeySig.html
|
100
|
-
- html/MIDI/Marker.html
|
101
|
-
- html/MIDI/Measure.html
|
102
|
-
- html/MIDI/Measures.html
|
103
|
-
- html/MIDI/MetaEvent.html
|
104
|
-
- html/MIDI/NoteEvent.html
|
105
|
-
- html/MIDI/NoteOff.html
|
106
|
-
- html/MIDI/NoteOn.html
|
107
|
-
- html/MIDI/PitchBend.html
|
108
|
-
- html/MIDI/PolyPressure.html
|
109
|
-
- html/MIDI/ProgramChange.html
|
110
|
-
- html/MIDI/Realtime.html
|
111
|
-
- html/MIDI/Sequence.html
|
112
|
-
- html/MIDI/SongPointer.html
|
113
|
-
- html/MIDI/SongSelect.html
|
114
|
-
- html/MIDI/Start.html
|
115
|
-
- html/MIDI/Stop.html
|
116
|
-
- html/MIDI/SystemCommon.html
|
117
|
-
- html/MIDI/SystemExclusive.html
|
118
|
-
- html/MIDI/SystemReset.html
|
119
|
-
- html/MIDI/Tempo.html
|
120
|
-
- html/MIDI/TimeSig.html
|
121
|
-
- html/MIDI/Track.html
|
122
|
-
- html/MIDI/TuneRequest.html
|
123
|
-
- html/MIDI/Utils.html
|
124
|
-
- html/MIDI.html
|
125
|
-
- html/rdoc.css
|
126
|
-
- html/README_rdoc.html
|
127
|
-
- html/TODO_rdoc.html
|
128
41
|
- install.rb
|
129
42
|
- lib/midilib/consts.rb
|
130
43
|
- lib/midilib/event.rb
|
@@ -145,38 +58,31 @@ files:
|
|
145
58
|
- test/test_sequence.rb
|
146
59
|
- test/test_track.rb
|
147
60
|
- test/test_varlen.rb
|
148
|
-
has_rdoc: true
|
149
61
|
homepage: http://github.com/jimm/midilib
|
150
62
|
licenses: []
|
151
|
-
|
152
63
|
post_install_message:
|
153
|
-
rdoc_options:
|
64
|
+
rdoc_options:
|
154
65
|
- --main
|
155
66
|
- README.rdoc
|
156
|
-
require_paths:
|
67
|
+
require_paths:
|
157
68
|
- lib
|
158
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
70
|
none: false
|
160
|
-
requirements:
|
161
|
-
- -
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
|
164
|
-
|
165
|
-
version: "0"
|
166
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
76
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
172
|
-
|
173
|
-
version: "0"
|
174
|
-
requirements:
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements:
|
175
82
|
- none
|
176
83
|
rubyforge_project: midilib
|
177
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.8.23
|
178
85
|
signing_key:
|
179
86
|
specification_version: 3
|
180
87
|
summary: MIDI file and event manipulation library
|
181
88
|
test_files: []
|
182
|
-
|
data/html/Array.html
DELETED
@@ -1,382 +0,0 @@
|
|
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: Array</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/track_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
-
class="thickbox" title="lib/midilib/track.rb">lib/midilib/track.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">Object</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-i-merge">#merge</a></li>
|
73
|
-
|
74
|
-
<li><a href="#method-i-mergesort">#mergesort</a></li>
|
75
|
-
|
76
|
-
<li><a href="#method-i-split">#split</a></li>
|
77
|
-
|
78
|
-
</ul>
|
79
|
-
</div>
|
80
|
-
|
81
|
-
|
82
|
-
<!-- Included Modules -->
|
83
|
-
|
84
|
-
</div>
|
85
|
-
|
86
|
-
<div id="project-metadata">
|
87
|
-
|
88
|
-
|
89
|
-
<div id="fileindex-section" class="section project-section">
|
90
|
-
<h3 class="section-header">Files</h3>
|
91
|
-
<ul>
|
92
|
-
|
93
|
-
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
94
|
-
|
95
|
-
<li class="file"><a href="./TODO_rdoc.html">TODO.rdoc</a></li>
|
96
|
-
|
97
|
-
</ul>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
|
101
|
-
<div id="classindex-section" class="section project-section">
|
102
|
-
<h3 class="section-header">Class Index
|
103
|
-
<span class="search-toggle"><img src="./images/find.png"
|
104
|
-
height="16" width="16" alt="[+]"
|
105
|
-
title="show/hide quicksearch" /></span></h3>
|
106
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
107
|
-
<fieldset>
|
108
|
-
<legend>Quicksearch</legend>
|
109
|
-
<input type="text" name="quicksearch" value=""
|
110
|
-
class="quicksearch-field" />
|
111
|
-
</fieldset>
|
112
|
-
</form>
|
113
|
-
|
114
|
-
<ul class="link-list">
|
115
|
-
|
116
|
-
<li><a href="./MIDI.html">MIDI</a></li>
|
117
|
-
|
118
|
-
<li><a href="./MIDI/ActiveSense.html">MIDI::ActiveSense</a></li>
|
119
|
-
|
120
|
-
<li><a href="./MIDI/ChannelEvent.html">MIDI::ChannelEvent</a></li>
|
121
|
-
|
122
|
-
<li><a href="./MIDI/ChannelPressure.html">MIDI::ChannelPressure</a></li>
|
123
|
-
|
124
|
-
<li><a href="./MIDI/Clock.html">MIDI::Clock</a></li>
|
125
|
-
|
126
|
-
<li><a href="./MIDI/Continue.html">MIDI::Continue</a></li>
|
127
|
-
|
128
|
-
<li><a href="./MIDI/Controller.html">MIDI::Controller</a></li>
|
129
|
-
|
130
|
-
<li><a href="./MIDI/Event.html">MIDI::Event</a></li>
|
131
|
-
|
132
|
-
<li><a href="./MIDI/IO.html">MIDI::IO</a></li>
|
133
|
-
|
134
|
-
<li><a href="./MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a></li>
|
135
|
-
|
136
|
-
<li><a href="./MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a></li>
|
137
|
-
|
138
|
-
<li><a href="./MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a></li>
|
139
|
-
|
140
|
-
<li><a href="./MIDI/KeySig.html">MIDI::KeySig</a></li>
|
141
|
-
|
142
|
-
<li><a href="./MIDI/Marker.html">MIDI::Marker</a></li>
|
143
|
-
|
144
|
-
<li><a href="./MIDI/Measure.html">MIDI::Measure</a></li>
|
145
|
-
|
146
|
-
<li><a href="./MIDI/Measures.html">MIDI::Measures</a></li>
|
147
|
-
|
148
|
-
<li><a href="./MIDI/MetaEvent.html">MIDI::MetaEvent</a></li>
|
149
|
-
|
150
|
-
<li><a href="./MIDI/NoteEvent.html">MIDI::NoteEvent</a></li>
|
151
|
-
|
152
|
-
<li><a href="./MIDI/NoteOff.html">MIDI::NoteOff</a></li>
|
153
|
-
|
154
|
-
<li><a href="./MIDI/NoteOff.html">MIDI::NoteOff</a></li>
|
155
|
-
|
156
|
-
<li><a href="./MIDI/NoteOn.html">MIDI::NoteOn</a></li>
|
157
|
-
|
158
|
-
<li><a href="./MIDI/NoteOn.html">MIDI::NoteOn</a></li>
|
159
|
-
|
160
|
-
<li><a href="./MIDI/PitchBend.html">MIDI::PitchBend</a></li>
|
161
|
-
|
162
|
-
<li><a href="./MIDI/PolyPressure.html">MIDI::PolyPressure</a></li>
|
163
|
-
|
164
|
-
<li><a href="./MIDI/ProgramChange.html">MIDI::ProgramChange</a></li>
|
165
|
-
|
166
|
-
<li><a href="./MIDI/Realtime.html">MIDI::Realtime</a></li>
|
167
|
-
|
168
|
-
<li><a href="./MIDI/Sequence.html">MIDI::Sequence</a></li>
|
169
|
-
|
170
|
-
<li><a href="./MIDI/SongPointer.html">MIDI::SongPointer</a></li>
|
171
|
-
|
172
|
-
<li><a href="./MIDI/SongSelect.html">MIDI::SongSelect</a></li>
|
173
|
-
|
174
|
-
<li><a href="./MIDI/Start.html">MIDI::Start</a></li>
|
175
|
-
|
176
|
-
<li><a href="./MIDI/Stop.html">MIDI::Stop</a></li>
|
177
|
-
|
178
|
-
<li><a href="./MIDI/SystemCommon.html">MIDI::SystemCommon</a></li>
|
179
|
-
|
180
|
-
<li><a href="./MIDI/SystemExclusive.html">MIDI::SystemExclusive</a></li>
|
181
|
-
|
182
|
-
<li><a href="./MIDI/SystemReset.html">MIDI::SystemReset</a></li>
|
183
|
-
|
184
|
-
<li><a href="./MIDI/Tempo.html">MIDI::Tempo</a></li>
|
185
|
-
|
186
|
-
<li><a href="./MIDI/TimeSig.html">MIDI::TimeSig</a></li>
|
187
|
-
|
188
|
-
<li><a href="./MIDI/Track.html">MIDI::Track</a></li>
|
189
|
-
|
190
|
-
<li><a href="./MIDI/TuneRequest.html">MIDI::TuneRequest</a></li>
|
191
|
-
|
192
|
-
<li><a href="./MIDI/Utils.html">MIDI::Utils</a></li>
|
193
|
-
|
194
|
-
<li><a href="./Array.html">Array</a></li>
|
195
|
-
|
196
|
-
<li><a href="./IO.html">IO</a></li>
|
197
|
-
|
198
|
-
</ul>
|
199
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
200
|
-
</div>
|
201
|
-
|
202
|
-
|
203
|
-
</div>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
<div id="documentation">
|
207
|
-
<h1 class="class">Array</h1>
|
208
|
-
|
209
|
-
<div id="description">
|
210
|
-
<p>
|
211
|
-
This is taken from <a
|
212
|
-
href="http://github.com/adamjmurray/cosy/blob/master/lib/cosy/helper/midi_file_renderer_helper.rb">github.com/adamjmurray/cosy/blob/master/lib/cosy/helper/midi_file_renderer_helper.rb</a>
|
213
|
-
with permission from Adam Murray, who originally suggested this fix. See <a
|
214
|
-
href="http://wiki.github.com/adamjmurray/cosy/midilib-notes">wiki.github.com/adamjmurray/cosy/midilib-notes</a>
|
215
|
-
for details. First we need to add some API infrastructure:
|
216
|
-
</p>
|
217
|
-
|
218
|
-
</div>
|
219
|
-
|
220
|
-
<!-- Constants -->
|
221
|
-
|
222
|
-
|
223
|
-
<!-- Attributes -->
|
224
|
-
|
225
|
-
|
226
|
-
<!-- Methods -->
|
227
|
-
|
228
|
-
<div id="public-instance-method-details" class="method-section section">
|
229
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
230
|
-
|
231
|
-
|
232
|
-
<div id="mergesort-method" class="method-detail ">
|
233
|
-
<a name="method-i-mergesort"></a>
|
234
|
-
|
235
|
-
<div class="method-heading">
|
236
|
-
|
237
|
-
<span class="method-name">mergesort</span><span
|
238
|
-
class="method-args">(&cmp)</span>
|
239
|
-
<span class="method-click-advice">click to toggle source</span>
|
240
|
-
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<div class="method-description">
|
244
|
-
|
245
|
-
<p>
|
246
|
-
A stable sorting algorithm that maintains the relative order of equal
|
247
|
-
elements
|
248
|
-
</p>
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
<div class="method-source-code"
|
253
|
-
id="mergesort-source">
|
254
|
-
<pre>
|
255
|
-
<span class="ruby-comment cmt"># File lib/midilib/track.rb, line 12</span>
|
256
|
-
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mergesort</span>(&<span class="ruby-identifier">cmp</span>)
|
257
|
-
13: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cmp</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
258
|
-
14: <span class="ruby-identifier">cmp</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span> }
|
259
|
-
15: <span class="ruby-keyword kw">end</span>
|
260
|
-
16: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
261
|
-
17: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
262
|
-
18: <span class="ruby-keyword kw">else</span>
|
263
|
-
19: <span class="ruby-identifier">halves</span> = <span class="ruby-identifier">split</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">half</span><span class="ruby-operator">|</span>
|
264
|
-
20: <span class="ruby-identifier">half</span>.<span class="ruby-identifier">mergesort</span>(&<span class="ruby-identifier">cmp</span>)
|
265
|
-
21: }
|
266
|
-
22: <span class="ruby-identifier">merge</span>(*<span class="ruby-identifier">halves</span>, &<span class="ruby-identifier">cmp</span>)
|
267
|
-
23: <span class="ruby-keyword kw">end</span>
|
268
|
-
24: <span class="ruby-keyword kw">end</span></pre>
|
269
|
-
</div>
|
270
|
-
|
271
|
-
</div>
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
</div>
|
277
|
-
|
278
|
-
|
279
|
-
</div>
|
280
|
-
|
281
|
-
<div id="protected-instance-method-details" class="method-section section">
|
282
|
-
<h3 class="section-header">Protected Instance Methods</h3>
|
283
|
-
|
284
|
-
|
285
|
-
<div id="merge-method" class="method-detail ">
|
286
|
-
<a name="method-i-merge"></a>
|
287
|
-
|
288
|
-
<div class="method-heading">
|
289
|
-
|
290
|
-
<span class="method-name">merge</span><span
|
291
|
-
class="method-args">(first, second, &predicate)</span>
|
292
|
-
<span class="method-click-advice">click to toggle source</span>
|
293
|
-
|
294
|
-
</div>
|
295
|
-
|
296
|
-
<div class="method-description">
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
<div class="method-source-code"
|
303
|
-
id="merge-source">
|
304
|
-
<pre>
|
305
|
-
<span class="ruby-comment cmt"># File lib/midilib/track.rb, line 32</span>
|
306
|
-
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>, &<span class="ruby-identifier">predicate</span>)
|
307
|
-
33: <span class="ruby-identifier">result</span> = []
|
308
|
-
34: <span class="ruby-keyword kw">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>
|
309
|
-
35: <span class="ruby-keyword kw">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>
|
310
|
-
36: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">shift</span>
|
311
|
-
37: <span class="ruby-keyword kw">else</span>
|
312
|
-
38: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">second</span>.<span class="ruby-identifier">shift</span>
|
313
|
-
39: <span class="ruby-keyword kw">end</span>
|
314
|
-
40: <span class="ruby-keyword kw">end</span>
|
315
|
-
41: <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>)
|
316
|
-
42: <span class="ruby-keyword kw">end</span></pre>
|
317
|
-
</div>
|
318
|
-
|
319
|
-
</div>
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
</div>
|
325
|
-
|
326
|
-
|
327
|
-
<div id="split-method" class="method-detail ">
|
328
|
-
<a name="method-i-split"></a>
|
329
|
-
|
330
|
-
<div class="method-heading">
|
331
|
-
|
332
|
-
<span class="method-name">split</span><span
|
333
|
-
class="method-args">()</span>
|
334
|
-
<span class="method-click-advice">click to toggle source</span>
|
335
|
-
|
336
|
-
</div>
|
337
|
-
|
338
|
-
<div class="method-description">
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
<div class="method-source-code"
|
345
|
-
id="split-source">
|
346
|
-
<pre>
|
347
|
-
<span class="ruby-comment cmt"># File lib/midilib/track.rb, line 27</span>
|
348
|
-
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split</span>
|
349
|
-
28: <span class="ruby-identifier">n</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>
|
350
|
-
29: [<span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">n</span>], <span class="ruby-keyword kw">self</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>]]
|
351
|
-
30: <span class="ruby-keyword kw">end</span></pre>
|
352
|
-
</div>
|
353
|
-
|
354
|
-
</div>
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
</div>
|
360
|
-
|
361
|
-
|
362
|
-
</div>
|
363
|
-
|
364
|
-
|
365
|
-
</div>
|
366
|
-
|
367
|
-
|
368
|
-
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
369
|
-
|
370
|
-
<p>Disabled; run with --debug to generate this.</p>
|
371
|
-
|
372
|
-
</div>
|
373
|
-
|
374
|
-
<div id="validator-badges">
|
375
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
376
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
377
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
378
|
-
</div>
|
379
|
-
|
380
|
-
</body>
|
381
|
-
</html>
|
382
|
-
|