midilib 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/TODO.rdoc +1 -1
- data/lib/midilib/info.rb +1 -1
- data/lib/midilib/track.rb +4 -4
- metadata +2 -2
data/Rakefile
CHANGED
data/TODO.rdoc
CHANGED
@@ -4,7 +4,7 @@ No known bugs. (If that's not a challenge, I don't know what is.)
|
|
4
4
|
|
5
5
|
== Features
|
6
6
|
|
7
|
-
*
|
7
|
+
* +print_decimal_numbers+ and +print_channel_numbers_from_one+ should be
|
8
8
|
associated with sequence, or perhaps track, not event.
|
9
9
|
|
10
10
|
* Method to translate event's time_from_start to number of milliseconds from
|
data/lib/midilib/info.rb
CHANGED
data/lib/midilib/track.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'midilib/event'
|
2
2
|
|
3
|
+
module MIDI
|
4
|
+
|
3
5
|
# This is taken from
|
4
6
|
# http://github.com/adamjmurray/cosy/blob/master/lib/cosy/helper/midi_file_renderer_helper.rb
|
5
7
|
# with permission from Adam Murray, who originally suggested this fix.
|
6
8
|
# See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.
|
7
9
|
# First we need to add some API infrastructure:
|
8
|
-
class Array
|
10
|
+
class MIDI::Array < ::Array
|
9
11
|
# This code borrowed from 'Moser' http://codesnippets.joyent.com/posts/show/1699
|
10
12
|
|
11
13
|
# A stable sorting algorithm that maintains the relative order of equal elements
|
@@ -42,8 +44,6 @@ class Array
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
module MIDI
|
46
|
-
|
47
47
|
# A Track is a list of events.
|
48
48
|
#
|
49
49
|
# When you modify the +events+ array, make sure to call recalc_times so
|
@@ -158,7 +158,7 @@ class Track
|
|
158
158
|
# We call mergesort instead of Array.sort because sort is not stable
|
159
159
|
# (it can mix up the order of events that have the same start time).
|
160
160
|
# See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.
|
161
|
-
list[starting_at .. -1] = list[starting_at .. -1].mergesort { | e1, e2 |
|
161
|
+
list[starting_at .. -1] = MIDI::Array.new(list[starting_at .. -1]).mergesort { | e1, e2 |
|
162
162
|
e1.time_from_start <=> e2.time_from_start
|
163
163
|
}
|
164
164
|
list[starting_at .. -1].each { | e |
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midilib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'midilib is a pure Ruby MIDI library useful for reading and
|
15
15
|
|