midilib 0.8.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2007-03-17 Jim Menard <jimm@io.com>
2
+
3
+ * Version 1.0.0 released. I will no longer be maintaining this
4
+ change log; the Subversion comments should be sufficient.
5
+
1
6
  2006-08-20 Jim Menard <jimm@io.com>
2
7
 
3
8
  * lib/midilib/event.rb (PolyPressure::initialize): Fixed the
data/Credits CHANGED
@@ -15,3 +15,7 @@ Mike Hall <m3ha11@rcn.com>
15
15
  Emanuel Borsboom <emanuel.borsboom@gmail.com>
16
16
 
17
17
  Found and fixed an error in PitchBend data encoding.
18
+
19
+ Christopher Rose <cmr@synopsys.com>
20
+
21
+ Found bug in Track#recalc_delta_from_times.
data/README CHANGED
@@ -10,72 +10,6 @@ project page is http://rubyforge.org/projects/midilib, where the latest
10
10
  version of midilib may be downloaded. midilib is also available as a RubyGem.
11
11
 
12
12
 
13
- === Recent Changes
14
-
15
- ==== Changes for 0.8.7:
16
-
17
- * Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.
18
-
19
- ==== Changes for 0.8.6:
20
-
21
- * Added missing test/test.mid.
22
-
23
- ==== Changes for 0.8.5:
24
-
25
- * Fixed bugs in MIDI::PitchBend reading and writing, thanks to Emanuel
26
- Borsboom.
27
-
28
- * Fixed a bug in MIDI::Track#quantize.
29
-
30
- * The argument to MIDI::Track#quantize has changed: it is now either a note
31
- name ("sixteenth", "32nd", "8th triplet") or a length (1 = quarter, 0.25 =
32
- sixteenth). This is a drastic change that will break all previous calls to
33
- quantize. However, since that method was broken already, I don't feel it's
34
- a burden to anybody to change the arguments.
35
-
36
- ==== Changes for 0.8.4:
37
-
38
- * Realtime status bytes now set @is_realtime to true and return true when
39
- realtime? is called.
40
-
41
- * All system common events now set @is_system to true and return true when
42
- system? is called, not just system exclusive events.
43
-
44
- * Added examples/from_scratch.rb, which shows how to create a sequence
45
- manually.
46
-
47
- * New MIDI::Sequence methods that turn note length names like "32nd", "dotted
48
- quarter", and "16th triplet" into delta times. See the docs below and
49
- MIDI::Sequence::length_to_delta, MIDI::Sequence::note_to_length, and
50
- MIDI::Sequence::note_to_delta.
51
-
52
-
53
- ==== Changes for 0.8.3:
54
-
55
- * Added MIDI::NoteEvent.note_to_s, which returns note name as a string like
56
- "C4" or "F#6".
57
-
58
- * Added new boolean attributes to MIDI::Event: @print_decimal_numbers and
59
- @print_note_names. These are used by all Event to_s methods. See
60
- examples/seq2text.rb for an example.
61
-
62
- ==== Changes for 0.8.2:
63
-
64
- * Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid
65
- runtime complaints about Object#type calls.
66
- * Added 'b' binary flag to file open modes for Windows.
67
- * Fixed $LOAD_PATH in example files.
68
- * Fixed read and write block arguments.
69
- * Fixed other example script bugs.
70
-
71
- ==== Changes for 0.8.1:
72
-
73
- * Fixed track sorting.
74
- * Fixed track's recalc_delta_from_times method.
75
- * Fixed event quantization.
76
- * More tests and documentation.
77
-
78
-
79
13
  == Dependencies
80
14
 
81
15
  midilib does not require any other packages. The test suite in the tests
@@ -379,6 +313,76 @@ Copyright (c) 1992 by Jim Menard (jimm@io.com). It may be freely used for
379
313
  non-commercial purposes as long as the author is given credit.
380
314
 
381
315
 
316
+ === Recent Changes
317
+
318
+ ==== Changes for 1.0.0:
319
+
320
+ * Fixed the bug in Track#recalc_delta_from_times found by Christopher Rose.
321
+
322
+ ==== Changes for 0.8.7:
323
+
324
+ * Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.
325
+
326
+ ==== Changes for 0.8.6:
327
+
328
+ * Added missing test/test.mid.
329
+
330
+ ==== Changes for 0.8.5:
331
+
332
+ * Fixed bugs in MIDI::PitchBend reading and writing, thanks to Emanuel
333
+ Borsboom.
334
+
335
+ * Fixed a bug in MIDI::Track#quantize.
336
+
337
+ * The argument to MIDI::Track#quantize has changed: it is now either a note
338
+ name ("sixteenth", "32nd", "8th triplet") or a length (1 = quarter, 0.25 =
339
+ sixteenth). This is a drastic change that will break all previous calls to
340
+ quantize. However, since that method was broken already, I don't feel it's
341
+ a burden to anybody to change the arguments.
342
+
343
+ ==== Changes for 0.8.4:
344
+
345
+ * Realtime status bytes now set @is_realtime to true and return true when
346
+ realtime? is called.
347
+
348
+ * All system common events now set @is_system to true and return true when
349
+ system? is called, not just system exclusive events.
350
+
351
+ * Added examples/from_scratch.rb, which shows how to create a sequence
352
+ manually.
353
+
354
+ * New MIDI::Sequence methods that turn note length names like "32nd", "dotted
355
+ quarter", and "16th triplet" into delta times. See the docs below and
356
+ MIDI::Sequence::length_to_delta, MIDI::Sequence::note_to_length, and
357
+ MIDI::Sequence::note_to_delta.
358
+
359
+
360
+ ==== Changes for 0.8.3:
361
+
362
+ * Added MIDI::NoteEvent.note_to_s, which returns note name as a string like
363
+ "C4" or "F#6".
364
+
365
+ * Added new boolean attributes to MIDI::Event: @print_decimal_numbers and
366
+ @print_note_names. These are used by all Event to_s methods. See
367
+ examples/seq2text.rb for an example.
368
+
369
+ ==== Changes for 0.8.2:
370
+
371
+ * Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid
372
+ runtime complaints about Object#type calls.
373
+ * Added 'b' binary flag to file open modes for Windows.
374
+ * Fixed $LOAD_PATH in example files.
375
+ * Fixed read and write block arguments.
376
+ * Fixed other example script bugs.
377
+
378
+ ==== Changes for 0.8.1:
379
+
380
+ * Fixed track sorting.
381
+ * Fixed track's recalc_delta_from_times method.
382
+ * Fixed event quantization.
383
+ * More tests and documentation.
384
+
385
+
382
386
  == Warranty
383
387
 
384
388
  This software is provided "as is" and without any express or implied
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require_gem 'rake'
2
+ require 'rake'
3
3
  require 'rake/rdoctask'
4
4
  require 'rake/gempackagetask'
5
5
  require 'rake/contrib/rubyforgepublisher'
@@ -1,9 +1,9 @@
1
1
  module MIDI
2
2
 
3
- VERSION_MAJOR = 0
4
- VERSION_MINOR = 8
5
- VERSION_TWEAK = 7
3
+ VERSION_MAJOR = 1
4
+ VERSION_MINOR = 0
5
+ VERSION_TWEAK = 0
6
6
  Version = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_TWEAK}"
7
- Copyright = 'Copyright (c) 2003-2006 by Jim Menard <jimm@io.com>'
7
+ Copyright = 'Copyright (c) 2003-2007 by Jim Menard <jimm@io.com>'
8
8
 
9
9
  end
@@ -95,9 +95,14 @@ class Track
95
95
 
96
96
  # The opposite of recalc_times: recalculates delta_time for each event
97
97
  # from each event's time_from_start. This is useful, for example, when
98
- # merging two event lists.
98
+ # merging two event lists. As a side-effect, elements from starting_at
99
+ # are sorted by time_from_start.
99
100
  def recalc_delta_from_times(starting_at=0, list=@events)
100
101
  prev_time_from_start = 0
102
+ # We need to sort the sublist. sublist.sort! does not do what we want.
103
+ list[starting_at .. -1] = list[starting_at .. -1].sort { | e1, e2 |
104
+ e1.time_from_start <=> e2.time_from_start
105
+ }
101
106
  list[starting_at .. -1].each { | e |
102
107
  e.delta_time = e.time_from_start - prev_time_from_start
103
108
  prev_time_from_start = e.time_from_start
@@ -88,6 +88,19 @@ class TrackTester < Test::Unit::TestCase
88
88
  @track.each { | event | assert_equal(100, event.delta_time) }
89
89
  end
90
90
 
91
+ def test_recalc_delta_from_times_unsorted
92
+ @track.events[0].time_from_start = 100
93
+ @track.events[1].time_from_start = 50
94
+ @track.events[2].time_from_start = 150
95
+ @track.recalc_delta_from_times
96
+ prev_start_time = 0
97
+ @track.each { | event |
98
+ assert(prev_start_time <= event.time_from_start)
99
+ assert(event.delta_time > 0)
100
+ prev_start_time = event.time_from_start
101
+ }
102
+ end
103
+
91
104
  def test_sort
92
105
  e = @track.events[0]
93
106
  e.time_from_start = 300
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.1
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: midilib
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.7
7
- date: 2007-02-18 00:00:00 -05:00
6
+ version: 1.0.0
7
+ date: 2007-03-17 00:00:00 -04:00
8
8
  summary: MIDI file and event manipulation library
9
9
  require_paths:
10
10
  - lib