midilib 2.0.4 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +2 -1
  3. data/Credits +44 -2
  4. data/README.rdoc +13 -9
  5. data/Rakefile +36 -53
  6. data/TODO.rdoc +13 -2
  7. data/examples/from_scratch.rb +4 -6
  8. data/examples/measures_mbt.rb +11 -11
  9. data/examples/print_program_changes.rb +11 -11
  10. data/examples/reader2text.rb +191 -191
  11. data/examples/seq2text.rb +18 -18
  12. data/examples/split.rb +21 -20
  13. data/examples/strings.rb +15 -15
  14. data/examples/transpose.rb +41 -42
  15. data/html/MIDI/ActiveSense.html +89 -213
  16. data/html/MIDI/ChannelEvent.html +95 -224
  17. data/html/MIDI/ChannelPressure.html +103 -241
  18. data/html/MIDI/Clock.html +89 -213
  19. data/html/MIDI/Continue.html +89 -213
  20. data/html/MIDI/Controller.html +105 -246
  21. data/html/MIDI/Event.html +134 -358
  22. data/html/MIDI/IO/MIDIFile.html +544 -1148
  23. data/html/MIDI/IO/SeqReader.html +273 -577
  24. data/html/MIDI/IO/SeqWriter.html +233 -439
  25. data/html/MIDI/IO.html +48 -164
  26. data/html/MIDI/KeySig.html +148 -291
  27. data/html/MIDI/Marker.html +73 -192
  28. data/html/MIDI/Measure.html +104 -267
  29. data/html/MIDI/Measures.html +106 -259
  30. data/html/MIDI/MetaEvent.html +171 -352
  31. data/html/MIDI/NoteEvent.html +114 -276
  32. data/html/MIDI/NoteOff.html +95 -223
  33. data/html/MIDI/NoteOn.html +95 -223
  34. data/html/MIDI/PitchBend.html +104 -242
  35. data/html/MIDI/PolyPressure.html +102 -246
  36. data/html/MIDI/ProgramChange.html +103 -241
  37. data/html/MIDI/Realtime.html +96 -230
  38. data/html/MIDI/Sequence.html +256 -576
  39. data/html/MIDI/SongPointer.html +104 -242
  40. data/html/MIDI/SongSelect.html +103 -241
  41. data/html/MIDI/Start.html +89 -213
  42. data/html/MIDI/Stop.html +89 -213
  43. data/html/MIDI/SystemCommon.html +73 -192
  44. data/html/MIDI/SystemExclusive.html +106 -244
  45. data/html/MIDI/SystemReset.html +89 -213
  46. data/html/MIDI/Tempo.html +127 -309
  47. data/html/MIDI/TimeSig.html +119 -300
  48. data/html/MIDI/Track.html +214 -494
  49. data/html/MIDI/TuneRequest.html +96 -230
  50. data/html/MIDI/Utils.html +91 -233
  51. data/html/MIDI.html +142 -526
  52. data/html/Object.html +197 -0
  53. data/html/README_rdoc.html +280 -486
  54. data/html/TODO_rdoc.html +68 -145
  55. data/html/created.rid +15 -14
  56. data/html/css/fonts.css +167 -0
  57. data/html/css/rdoc.css +639 -0
  58. data/html/fonts/Lato-Light.ttf +0 -0
  59. data/html/fonts/Lato-LightItalic.ttf +0 -0
  60. data/html/fonts/Lato-Regular.ttf +0 -0
  61. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  62. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  63. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  64. data/html/images/add.png +0 -0
  65. data/html/images/arrow_up.png +0 -0
  66. data/html/images/delete.png +0 -0
  67. data/html/images/tag_blue.png +0 -0
  68. data/html/index.html +230 -446
  69. data/html/js/darkfish.js +22 -91
  70. data/html/js/navigation.js +4 -41
  71. data/html/js/navigation.js.gz +0 -0
  72. data/html/js/search.js +41 -25
  73. data/html/js/search_index.js +1 -1
  74. data/html/js/search_index.js.gz +0 -0
  75. data/html/js/searcher.js +9 -8
  76. data/html/js/searcher.js.gz +0 -0
  77. data/html/table_of_contents.html +1111 -505
  78. data/install.rb +53 -34
  79. data/lib/midilib/consts.rb +406 -408
  80. data/lib/midilib/event.rb +335 -306
  81. data/lib/midilib/info.rb +5 -7
  82. data/lib/midilib/io/midifile.rb +424 -452
  83. data/lib/midilib/io/seqreader.rb +200 -192
  84. data/lib/midilib/io/seqwriter.rb +151 -147
  85. data/lib/midilib/measure.rb +78 -80
  86. data/lib/midilib/mergesort.rb +39 -0
  87. data/lib/midilib/sequence.rb +93 -87
  88. data/lib/midilib/track.rb +71 -118
  89. data/lib/midilib/utils.rb +17 -20
  90. data/lib/midilib.rb +5 -5
  91. data/test/event_equality.rb +50 -52
  92. data/test/test_event.rb +120 -124
  93. data/test/test_io.rb +118 -38
  94. data/test/test_mergesort.rb +37 -0
  95. data/test/test_midifile.rb +6 -19
  96. data/test/test_sequence.rb +62 -61
  97. data/test/test_track.rb +126 -155
  98. data/test/test_varlen.rb +23 -27
  99. metadata +67 -62
  100. data/html/IO.html +0 -259
  101. data/html/MIDI/MIDI/MIDI/Array.html +0 -353
  102. data/html/MIDI/MIDI/MIDI.html +0 -204
  103. data/html/MIDI/MIDI.html +0 -204
  104. data/html/js/jquery.js +0 -18
  105. data/html/rdoc.css +0 -543
data/install.rb CHANGED
@@ -5,53 +5,72 @@
5
5
  # This script installs midilib into the Ruby site-local library directory.
6
6
  #
7
7
  # Author:: Jim Menard (mailto:jim@jimmenard.com)
8
- # Copyright:: Copyright (c) 2003-2012 by Jim Menard
8
+ # Copyright:: Copyright (c) 2003-2013 by Jim Menard
9
9
  # License:: Distributed under the same license as Ruby.
10
10
  #
11
11
 
12
12
  require 'getoptlong'
13
- require 'ftools'
14
13
  require 'find'
14
+ begin
15
+ require 'ftools'
16
+ def mkdirs(dir)
17
+ File.makedirs(dir)
18
+ end
19
+
20
+ def install(*args)
21
+ File.install(*args)
22
+ end
23
+ rescue LoadError
24
+ require 'fileutils'
25
+ def mkdirs(dir)
26
+ FileUtils.mkdir_p(dir)
27
+ end
28
+
29
+ def install(*args)
30
+ args[2] = { mode: args[2], verbose: args[3] }
31
+ args.pop
32
+ FileUtils.install(*args)
33
+ end
34
+ end
15
35
 
16
36
  SOURCE_DIR = 'lib'
17
37
  LIB_DIR = 'midilib'
18
38
  IO_DIR = File.join(LIB_DIR, 'io')
19
39
 
20
40
  def instdir
21
- g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
22
- g.each { | name, arg |
23
- if name == '--install-dir'
24
- return arg
25
- else
26
- $stderr.puts "usage: $0 [--install-dir dir]"
27
- end
28
- }
29
-
30
- begin
31
- require 'rbconfig'
32
- libdir = Config::CONFIG['sitedir'] + "/" +
33
- Config::CONFIG['MAJOR'] + "." +
34
- Config::CONFIG['MINOR']
35
- rescue ScriptError
36
- $LOAD_PATH.each do |l|
37
- if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
38
- libdir = l
39
- break
40
- end
41
- end
42
- STDERR.puts "Can't find required file `rbconfig.rb'."
43
- STDERR.puts "The `midilib' files need to be installed manually in" +
44
- " #{libdir}"
41
+ g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
42
+ g.each do |name, arg|
43
+ if name == '--install-dir'
44
+ return arg
45
+ else
46
+ warn 'usage: $0 [--install-dir dir]'
45
47
  end
46
- return libdir
48
+ end
49
+
50
+ begin
51
+ require 'rbconfig'
52
+ libdir = Config::CONFIG['sitedir'] + '/' +
53
+ Config::CONFIG['MAJOR'] + '.' +
54
+ Config::CONFIG['MINOR']
55
+ rescue ScriptError
56
+ $LOAD_PATH.each do |l|
57
+ if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
58
+ libdir = l
59
+ break
60
+ end
61
+ end
62
+ warn "Can't find required file `rbconfig.rb'."
63
+ warn "The `midilib' files need to be installed manually in #{libdir}"
64
+ end
65
+ libdir
47
66
  end
48
67
 
49
- INSTALL_DIR = instdir()
68
+ INSTALL_DIR = instdir
50
69
  files = Dir.chdir('lib') { Dir['**/*.rb'] }
51
70
 
52
- files.each { | f |
53
- dir = File.dirname(f)
54
- target_dir = File.join(INSTALL_DIR, dir)
55
- File.makedirs(target_dir) unless File.exist?(target_dir)
56
- File.install(File.join('lib', f), File.join(INSTALL_DIR, f), 0644, true)
57
- }
71
+ files.each do |f|
72
+ dir = File.dirname(f)
73
+ target_dir = File.join(INSTALL_DIR, dir)
74
+ mkdirs(target_dir) unless File.exist?(target_dir)
75
+ install(File.join('lib', f), File.join(INSTALL_DIR, f), 0o644, true)
76
+ end