midilib 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Credits +5 -0
  3. data/html/MIDI/ActiveSense.html +171 -0
  4. data/html/MIDI/ChannelEvent.html +190 -0
  5. data/html/MIDI/ChannelPressure.html +212 -0
  6. data/html/MIDI/Clock.html +171 -0
  7. data/html/MIDI/Continue.html +171 -0
  8. data/html/MIDI/Controller.html +224 -0
  9. data/html/MIDI/Event.html +349 -0
  10. data/html/MIDI/IO/MIDIFile.html +1392 -0
  11. data/html/MIDI/IO/SeqReader.html +642 -0
  12. data/html/MIDI/IO/SeqWriter.html +442 -0
  13. data/html/MIDI/IO.html +91 -0
  14. data/html/MIDI/KeySig.html +292 -0
  15. data/html/MIDI/Marker.html +138 -0
  16. data/html/MIDI/Measure.html +260 -0
  17. data/html/MIDI/Measures.html +222 -0
  18. data/html/MIDI/MetaEvent.html +353 -0
  19. data/html/MIDI/NoteEvent.html +255 -0
  20. data/html/MIDI/NoteOff.html +188 -0
  21. data/html/MIDI/NoteOn.html +188 -0
  22. data/html/MIDI/PitchBend.html +213 -0
  23. data/html/MIDI/PolyPressure.html +216 -0
  24. data/html/MIDI/ProgramChange.html +212 -0
  25. data/html/MIDI/Realtime.html +194 -0
  26. data/html/MIDI/Sequence.html +641 -0
  27. data/html/MIDI/SongPointer.html +213 -0
  28. data/html/MIDI/SongSelect.html +212 -0
  29. data/html/MIDI/Start.html +171 -0
  30. data/html/MIDI/Stop.html +171 -0
  31. data/html/MIDI/SystemCommon.html +138 -0
  32. data/html/MIDI/SystemExclusive.html +215 -0
  33. data/html/MIDI/SystemReset.html +171 -0
  34. data/html/MIDI/Tempo.html +292 -0
  35. data/html/MIDI/TimeSig.html +286 -0
  36. data/html/MIDI/Track.html +489 -0
  37. data/html/MIDI/TuneRequest.html +194 -0
  38. data/html/MIDI/Utils.html +178 -0
  39. data/html/MIDI.html +281 -0
  40. data/html/Object.html +197 -0
  41. data/html/README_rdoc.html +545 -0
  42. data/html/TODO_rdoc.html +123 -0
  43. data/html/created.rid +15 -0
  44. data/html/css/fonts.css +167 -0
  45. data/html/css/rdoc.css +639 -0
  46. data/html/fonts/Lato-Light.ttf +0 -0
  47. data/html/fonts/Lato-LightItalic.ttf +0 -0
  48. data/html/fonts/Lato-Regular.ttf +0 -0
  49. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/html/images/add.png +0 -0
  53. data/html/images/arrow_up.png +0 -0
  54. data/html/images/brick.png +0 -0
  55. data/html/images/brick_link.png +0 -0
  56. data/html/images/bug.png +0 -0
  57. data/html/images/bullet_black.png +0 -0
  58. data/html/images/bullet_toggle_minus.png +0 -0
  59. data/html/images/bullet_toggle_plus.png +0 -0
  60. data/html/images/date.png +0 -0
  61. data/html/images/delete.png +0 -0
  62. data/html/images/find.png +0 -0
  63. data/html/images/loadingAnimation.gif +0 -0
  64. data/html/images/macFFBgHack.png +0 -0
  65. data/html/images/package.png +0 -0
  66. data/html/images/page_green.png +0 -0
  67. data/html/images/page_white_text.png +0 -0
  68. data/html/images/page_white_width.png +0 -0
  69. data/html/images/plugin.png +0 -0
  70. data/html/images/ruby.png +0 -0
  71. data/html/images/tag_blue.png +0 -0
  72. data/html/images/tag_green.png +0 -0
  73. data/html/images/transparent.png +0 -0
  74. data/html/images/wrench.png +0 -0
  75. data/html/images/wrench_orange.png +0 -0
  76. data/html/images/zoom.png +0 -0
  77. data/html/index.html +534 -0
  78. data/html/js/darkfish.js +84 -0
  79. data/html/js/navigation.js +105 -0
  80. data/html/js/navigation.js.gz +0 -0
  81. data/html/js/search.js +110 -0
  82. data/html/js/search_index.js +1 -0
  83. data/html/js/search_index.js.gz +0 -0
  84. data/html/js/searcher.js +229 -0
  85. data/html/js/searcher.js.gz +0 -0
  86. data/html/table_of_contents.html +1258 -0
  87. data/lib/midilib/info.rb +2 -2
  88. data/lib/midilib/io/seqreader.rb +18 -5
  89. data/test/test_io.rb +18 -5
  90. metadata +85 -1
@@ -0,0 +1,84 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ /*
12
+ if (!("console" in window) || !("firebug" in console)) {
13
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
15
+
16
+ window.console = {};
17
+ for (var i = 0; i < names.length; ++i)
18
+ window.console[names[i]] = function() {};
19
+ };
20
+ */
21
+
22
+
23
+ function showSource( e ) {
24
+ var target = e.target;
25
+ while (!target.classList.contains('method-detail')) {
26
+ target = target.parentNode;
27
+ }
28
+ if (typeof target !== "undefined" && target !== null) {
29
+ target = target.querySelector('.method-source-code');
30
+ }
31
+ if (typeof target !== "undefined" && target !== null) {
32
+ target.classList.toggle('active-menu')
33
+ }
34
+ };
35
+
36
+ function hookSourceViews() {
37
+ document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
+ codeObject.addEventListener('click', showSource);
39
+ });
40
+ };
41
+
42
+ function hookSearch() {
43
+ var input = document.querySelector('#search-field');
44
+ var result = document.querySelector('#search-results');
45
+ result.classList.remove("initially-hidden");
46
+
47
+ var search_section = document.querySelector('#search-section');
48
+ search_section.classList.remove("initially-hidden");
49
+
50
+ var search = new Search(search_data, input, result);
51
+
52
+ search.renderItem = function(result) {
53
+ var li = document.createElement('li');
54
+ var html = '';
55
+
56
+ // TODO add relative path to <script> per-page
57
+ html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
58
+ if (result.params)
59
+ html += '<span class="params">' + result.params + '</span>';
60
+ html += '</a>';
61
+
62
+
63
+ if (result.namespace)
64
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
65
+
66
+ if (result.snippet)
67
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
68
+
69
+ li.innerHTML = html;
70
+
71
+ return li;
72
+ }
73
+
74
+ search.select = function(result) {
75
+ window.location.href = result.firstChild.firstChild.href;
76
+ }
77
+
78
+ search.scrollIntoView = search.scrollInWindow;
79
+ };
80
+
81
+ document.addEventListener('DOMContentLoaded', function() {
82
+ hookSourceViews();
83
+ hookSearch();
84
+ });
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Navigation allows movement using the arrow keys through the search results.
3
+ *
4
+ * When using this library you will need to set scrollIntoView to the
5
+ * appropriate function for your layout. Use scrollInWindow if the container
6
+ * is not scrollable and scrollInElement if the container is a separate
7
+ * scrolling region.
8
+ */
9
+ Navigation = new function() {
10
+ this.initNavigation = function() {
11
+ var _this = this;
12
+
13
+ document.addEventListener('keydown', function(e) {
14
+ _this.onkeydown(e);
15
+ });
16
+
17
+ this.navigationActive = true;
18
+ }
19
+
20
+ this.setNavigationActive = function(state) {
21
+ this.navigationActive = state;
22
+ }
23
+
24
+ this.onkeydown = function(e) {
25
+ if (!this.navigationActive) return;
26
+ switch(e.keyCode) {
27
+ case 37: //Event.KEY_LEFT:
28
+ if (this.moveLeft()) e.preventDefault();
29
+ break;
30
+ case 38: //Event.KEY_UP:
31
+ if (e.keyCode == 38 || e.ctrlKey) {
32
+ if (this.moveUp()) e.preventDefault();
33
+ }
34
+ break;
35
+ case 39: //Event.KEY_RIGHT:
36
+ if (this.moveRight()) e.preventDefault();
37
+ break;
38
+ case 40: //Event.KEY_DOWN:
39
+ if (e.keyCode == 40 || e.ctrlKey) {
40
+ if (this.moveDown()) e.preventDefault();
41
+ }
42
+ break;
43
+ case 13: //Event.KEY_RETURN:
44
+ if (this.current) e.preventDefault();
45
+ this.select(this.current);
46
+ break;
47
+ }
48
+ if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
+ }
50
+
51
+ this.moveRight = function() {
52
+ }
53
+
54
+ this.moveLeft = function() {
55
+ }
56
+
57
+ this.move = function(isDown) {
58
+ }
59
+
60
+ this.moveUp = function() {
61
+ return this.move(false);
62
+ }
63
+
64
+ this.moveDown = function() {
65
+ return this.move(true);
66
+ }
67
+
68
+ /*
69
+ * Scrolls to the given element in the scrollable element view.
70
+ */
71
+ this.scrollInElement = function(element, view) {
72
+ var offset, viewHeight, viewScroll, height;
73
+ offset = element.offsetTop;
74
+ height = element.offsetHeight;
75
+ viewHeight = view.offsetHeight;
76
+ viewScroll = view.scrollTop;
77
+
78
+ if (offset - viewScroll + height > viewHeight) {
79
+ view.scrollTop = offset - viewHeight + height;
80
+ }
81
+ if (offset < viewScroll) {
82
+ view.scrollTop = offset;
83
+ }
84
+ }
85
+
86
+ /*
87
+ * Scrolls to the given element in the window. The second argument is
88
+ * ignored
89
+ */
90
+ this.scrollInWindow = function(element, ignored) {
91
+ var offset, viewHeight, viewScroll, height;
92
+ offset = element.offsetTop;
93
+ height = element.offsetHeight;
94
+ viewHeight = window.innerHeight;
95
+ viewScroll = window.scrollY;
96
+
97
+ if (offset - viewScroll + height > viewHeight) {
98
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
99
+ }
100
+ if (offset < viewScroll) {
101
+ window.scrollTo(window.scrollX, offset);
102
+ }
103
+ }
104
+ }
105
+
Binary file
data/html/js/search.js ADDED
@@ -0,0 +1,110 @@
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = Object.assign({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.keyCode) {
19
+ case 38: // Event.KEY_UP
20
+ case 40: // Event.KEY_DOWN
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = value.trim().toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.result.innerHTML = '';
47
+ this.result.setAttribute('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.result.setAttribute('aria-busy', 'true');
52
+ this.result.setAttribute('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.result;
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.current = null;
62
+ this.result.innerHTML = '';
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.current = target.firstChild;
74
+ this.current.classList.add('search-selected');
75
+ }
76
+ //TODO: ECMAScript
77
+ //if (jQuery.browser.msie) this.$element[0].className += '';
78
+
79
+ if (isLast) this.result.setAttribute('aria-busy', 'false');
80
+ }
81
+
82
+ this.move = function(isDown) {
83
+ if (!this.current) return;
84
+ var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
+ if (next) {
86
+ this.current.classList.remove('search-selected');
87
+ next.classList.add('search-selected');
88
+ this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
+ this.scrollIntoView(next, this.view);
90
+ this.current = next;
91
+ this.input.value = next.firstChild.firstChild.text;
92
+ this.input.select();
93
+ }
94
+ return true;
95
+ }
96
+
97
+ this.hlt = function(html) {
98
+ return this.escapeHTML(html).
99
+ replace(/\u0001/g, '<em>').
100
+ replace(/\u0002/g, '</em>');
101
+ }
102
+
103
+ this.escapeHTML = function(html) {
104
+ return html.replace(/[&<>]/g, function(c) {
105
+ return '&#' + c.charCodeAt(0) + ';';
106
+ });
107
+ }
108
+
109
+ });
110
+
@@ -0,0 +1 @@
1
+ var search_data = {"index":{"searchIndex":["midi","activesense","channelevent","channelpressure","clock","continue","controller","event","io","midifile","seqreader","seqwriter","keysig","marker","measure","measures","metaevent","noteevent","noteoff","noteoffevent","noteon","noteonevent","pitchbend","polypressure","programchange","realtime","sequence","songpointer","songselect","start","stop","systemcommon","systemexclusive","systemreset","tempo","timesig","track","tunerequest","utils","object","<=>()","arbitrary()","as_var_len()","bad_byte()","beats_per_minute()","bpm()","bpm_to_mpq()","bytes_as_str()","chan_message()","chan_pressure()","chan_pressure()","channel_to_s()","contains_event?()","controller()","controller()","data=()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_bytes()","data_as_str()","denominator()","each()","each()","end_track()","end_track()","eot()","error()","get_bytes()","get_measures()","getc()","handle_arbitrary()","handle_sysex()","header()","header()","instrument()","instrument=()","key_signature()","key_signature()","length_to_delta()","major_key?()","make_note_off()","measure_duration()","measure_for_event()","merge()","merge_event_lists()","mergesort()","mergesort_merge()","mergesort_split()","meta_event()","meta_misc()","meta_misc()","metronome_ticks()","minor_key?()","mpq_to_bpm()","msg()","msg_add()","msg_init()","msg_read()","name()","name()","name=()","name=()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","note_off()","note_off()","note_on()","note_on()","note_to_delta()","note_to_length()","note_to_s()","note_to_s()","number_to_s()","numerator()","pch_oct()","pitch_bend()","pitch_bend()","possibly_munge_due_to_running_status_byte()","pressure()","pressure()","pressure()","pressure=()","program()","program()","pulses_to_seconds()","quantize()","quantize_to()","read()","read16()","read32()","read_from()","read_header()","read_mt_header_string()","read_track()","read_var_len()","recalc_delta_from_times()","recalc_times()","sequence_number()","sequencer_specific()","sharpflat()","smpte()","sort()","start_track()","start_track()","str_as_bytes()","sysex()","sysex()","tempo()","tempo()","tempo()","tempo()","tempo=()","text()","text()","time_signature()","time_signature()","time_signature()","to_code()","to_mbt()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","to_s()","track_uses_channel()","write()","write16()","write16()","write32()","write32()","write_bytes()","write_header()","write_instrument()","write_to()","write_track()","write_var_len()","write_var_len()","readme","todo"],"longSearchIndex":["midi","midi::activesense","midi::channelevent","midi::channelpressure","midi::clock","midi::continue","midi::controller","midi::event","midi::io","midi::io::midifile","midi::io::seqreader","midi::io::seqwriter","midi::keysig","midi::marker","midi::measure","midi::measures","midi::metaevent","midi::noteevent","midi::noteoff","midi::noteoffevent","midi::noteon","midi::noteonevent","midi::pitchbend","midi::polypressure","midi::programchange","midi::realtime","midi::sequence","midi::songpointer","midi::songselect","midi::start","midi::stop","midi::systemcommon","midi::systemexclusive","midi::systemreset","midi::tempo","midi::timesig","midi::track","midi::tunerequest","midi::utils","object","midi::event#<=>()","midi::io::midifile#arbitrary()","midi::utils::as_var_len()","midi::io::midifile#bad_byte()","midi::sequence#beats_per_minute()","midi::sequence#bpm()","midi::tempo::bpm_to_mpq()","midi::metaevent::bytes_as_str()","midi::io::midifile#chan_message()","midi::io::midifile#chan_pressure()","midi::io::seqreader#chan_pressure()","midi::event#channel_to_s()","midi::measure#contains_event?()","midi::io::midifile#controller()","midi::io::seqreader#controller()","midi::metaevent#data=()","midi::channelpressure#data_as_bytes()","midi::controller#data_as_bytes()","midi::event#data_as_bytes()","midi::keysig#data_as_bytes()","midi::metaevent#data_as_bytes()","midi::noteevent#data_as_bytes()","midi::pitchbend#data_as_bytes()","midi::programchange#data_as_bytes()","midi::realtime#data_as_bytes()","midi::songpointer#data_as_bytes()","midi::songselect#data_as_bytes()","midi::systemexclusive#data_as_bytes()","midi::tempo#data_as_bytes()","midi::timesig#data_as_bytes()","midi::tunerequest#data_as_bytes()","midi::metaevent#data_as_str()","midi::timesig#denominator()","midi::sequence#each()","midi::track#each()","midi::io::midifile#end_track()","midi::io::seqreader#end_track()","midi::io::midifile#eot()","midi::io::midifile#error()","midi::io::midifile#get_bytes()","midi::sequence#get_measures()","midi::io::midifile#getc()","midi::io::midifile#handle_arbitrary()","midi::io::midifile#handle_sysex()","midi::io::midifile#header()","midi::io::seqreader#header()","midi::track#instrument()","midi::track#instrument=()","midi::io::midifile#key_signature()","midi::io::seqreader#key_signature()","midi::sequence#length_to_delta()","midi::keysig#major_key?()","midi::io::seqreader#make_note_off()","midi::timesig#measure_duration()","midi::measures#measure_for_event()","midi::track#merge()","midi::track#merge_event_lists()","object#mergesort()","object#mergesort_merge()","object#mergesort_split()","midi::io::midifile#meta_event()","midi::io::midifile#meta_misc()","midi::io::seqreader#meta_misc()","midi::timesig#metronome_ticks()","midi::keysig#minor_key?()","midi::tempo::mpq_to_bpm()","midi::io::midifile#msg()","midi::io::midifile#msg_add()","midi::io::midifile#msg_init()","midi::io::midifile#msg_read()","midi::sequence#name()","midi::track#name()","midi::sequence#name=()","midi::track#name=()","midi::activesense::new()","midi::channelevent::new()","midi::channelpressure::new()","midi::clock::new()","midi::continue::new()","midi::controller::new()","midi::event::new()","midi::io::midifile::new()","midi::io::seqreader::new()","midi::io::seqwriter::new()","midi::keysig::new()","midi::marker::new()","midi::measure::new()","midi::measures::new()","midi::metaevent::new()","midi::noteevent::new()","midi::noteoff::new()","midi::noteoff::new()","midi::noteon::new()","midi::noteon::new()","midi::pitchbend::new()","midi::polypressure::new()","midi::programchange::new()","midi::realtime::new()","midi::sequence::new()","midi::songpointer::new()","midi::songselect::new()","midi::start::new()","midi::stop::new()","midi::systemcommon::new()","midi::systemexclusive::new()","midi::systemreset::new()","midi::tempo::new()","midi::timesig::new()","midi::track::new()","midi::tunerequest::new()","midi::io::midifile#note_off()","midi::io::seqreader#note_off()","midi::io::midifile#note_on()","midi::io::seqreader#note_on()","midi::sequence#note_to_delta()","midi::sequence#note_to_length()","midi::noteevent#note_to_s()","midi::utils::note_to_s()","midi::event#number_to_s()","midi::timesig#numerator()","midi::noteevent#pch_oct()","midi::io::midifile#pitch_bend()","midi::io::seqreader#pitch_bend()","midi::io::seqwriter#possibly_munge_due_to_running_status_byte()","midi::io::midifile#pressure()","midi::io::seqreader#pressure()","midi::polypressure#pressure()","midi::polypressure#pressure=()","midi::io::midifile#program()","midi::io::seqreader#program()","midi::sequence#pulses_to_seconds()","midi::track#quantize()","midi::event#quantize_to()","midi::sequence#read()","midi::io::midifile#read16()","midi::io::midifile#read32()","midi::io::midifile#read_from()","midi::io::midifile#read_header()","midi::io::midifile#read_mt_header_string()","midi::io::midifile#read_track()","midi::io::midifile#read_var_len()","midi::track#recalc_delta_from_times()","midi::track#recalc_times()","midi::io::midifile#sequence_number()","midi::io::midifile#sequencer_specific()","midi::keysig#sharpflat()","midi::io::midifile#smpte()","midi::track#sort()","midi::io::midifile#start_track()","midi::io::seqreader#start_track()","midi::metaevent::str_as_bytes()","midi::io::midifile#sysex()","midi::io::seqreader#sysex()","midi::io::midifile#tempo()","midi::io::seqreader#tempo()","midi::sequence#tempo()","midi::tempo#tempo()","midi::tempo#tempo=()","midi::io::midifile#text()","midi::io::seqreader#text()","midi::io::midifile#time_signature()","midi::io::seqreader#time_signature()","midi::sequence#time_signature()","midi::keysig#to_code()","midi::measures#to_mbt()","midi::activesense#to_s()","midi::channelevent#to_s()","midi::channelpressure#to_s()","midi::clock#to_s()","midi::continue#to_s()","midi::controller#to_s()","midi::event#to_s()","midi::keysig#to_s()","midi::measure#to_s()","midi::metaevent#to_s()","midi::noteoff#to_s()","midi::noteoff#to_s()","midi::noteon#to_s()","midi::noteon#to_s()","midi::pitchbend#to_s()","midi::polypressure#to_s()","midi::programchange#to_s()","midi::realtime#to_s()","midi::songpointer#to_s()","midi::songselect#to_s()","midi::start#to_s()","midi::stop#to_s()","midi::systemexclusive#to_s()","midi::systemreset#to_s()","midi::tempo#to_s()","midi::timesig#to_s()","midi::tunerequest#to_s()","midi::io::seqreader#track_uses_channel()","midi::sequence#write()","midi::io::midifile#write16()","midi::io::seqwriter#write16()","midi::io::midifile#write32()","midi::io::seqwriter#write32()","midi::io::seqwriter#write_bytes()","midi::io::seqwriter#write_header()","midi::io::seqwriter#write_instrument()","midi::io::seqwriter#write_to()","midi::io::seqwriter#write_track()","midi::io::midifile#write_var_len()","midi::io::seqwriter#write_var_len()","",""],"info":[["MIDI","","MIDI.html","","<p>MIDI constants.\n"],["MIDI::ActiveSense","","MIDI/ActiveSense.html","",""],["MIDI::ChannelEvent","","MIDI/ChannelEvent.html","","<p>The abstract superclass of all channel events (events that have a MIDI channel, like notes and program …\n"],["MIDI::ChannelPressure","","MIDI/ChannelPressure.html","",""],["MIDI::Clock","","MIDI/Clock.html","",""],["MIDI::Continue","","MIDI/Continue.html","",""],["MIDI::Controller","","MIDI/Controller.html","",""],["MIDI::Event","","MIDI/Event.html","","<p>The abstract superclass of all MIDI events.\n"],["MIDI::IO","","MIDI/IO.html","",""],["MIDI::IO::MIDIFile","","MIDI/IO/MIDIFile.html","","<p>A MIDIFile parses a MIDI file and calls methods when it sees MIDI events. Most of the methods are stubs. …\n"],["MIDI::IO::SeqReader","","MIDI/IO/SeqReader.html","","<p>Reads MIDI files. As a subclass of MIDIFile, this class implements the callback methods for each MIDI …\n"],["MIDI::IO::SeqWriter","","MIDI/IO/SeqWriter.html","",""],["MIDI::KeySig","","MIDI/KeySig.html","","<p>Container for key signature events\n"],["MIDI::Marker","","MIDI/Marker.html","",""],["MIDI::Measure","","MIDI/Measure.html","","<p>The Measure class contains information about a measure from the sequence. The measure data is based on …\n"],["MIDI::Measures","","MIDI/Measures.html","","<p>A specialized container for MIDI::Measure objects, which can be use to map event times to measure numbers. …\n"],["MIDI::MetaEvent","","MIDI/MetaEvent.html","",""],["MIDI::NoteEvent","","MIDI/NoteEvent.html","","<p>The abstract superclass of all note on, and note off, and polyphonic pressure events.\n"],["MIDI::NoteOff","","MIDI/NoteOff.html","",""],["MIDI::NoteOffEvent","","MIDI/NoteOff.html","",""],["MIDI::NoteOn","","MIDI/NoteOn.html","",""],["MIDI::NoteOnEvent","","MIDI/NoteOn.html","",""],["MIDI::PitchBend","","MIDI/PitchBend.html","",""],["MIDI::PolyPressure","","MIDI/PolyPressure.html","",""],["MIDI::ProgramChange","","MIDI/ProgramChange.html","",""],["MIDI::Realtime","","MIDI/Realtime.html","",""],["MIDI::Sequence","","MIDI/Sequence.html","","<p>A MIDI::Sequence contains MIDI::Track objects.\n"],["MIDI::SongPointer","","MIDI/SongPointer.html","",""],["MIDI::SongSelect","","MIDI/SongSelect.html","",""],["MIDI::Start","","MIDI/Start.html","",""],["MIDI::Stop","","MIDI/Stop.html","",""],["MIDI::SystemCommon","","MIDI/SystemCommon.html","",""],["MIDI::SystemExclusive","","MIDI/SystemExclusive.html","",""],["MIDI::SystemReset","","MIDI/SystemReset.html","",""],["MIDI::Tempo","","MIDI/Tempo.html","",""],["MIDI::TimeSig","","MIDI/TimeSig.html","","<p>Container for time signature events\n"],["MIDI::Track","","MIDI/Track.html","","<p>A Track is a list of events.\n<p>When you modify the <code>events</code> array, make sure to call recalc_times so each …\n"],["MIDI::TuneRequest","","MIDI/TuneRequest.html","",""],["MIDI::Utils","","MIDI/Utils.html","","<p>Utility methods.\n"],["Object","","Object.html","",""],["<=>","MIDI::Event","MIDI/Event.html#method-i-3C-3D-3E","(other)","<p>For sorting. Uses @time_from_start, which is maintained by this event’s track. I’m not sure this …\n"],["arbitrary","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-arbitrary","(msg)",""],["as_var_len","MIDI::Utils","MIDI/Utils.html#method-c-as_var_len","(val)","<p>Given an integer, returns it as a variable length array of bytes (the format used by MIDI files).\n<p>The …\n"],["bad_byte","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-bad_byte","(c)","<p>Handle an unexpected byte.\n"],["beats_per_minute","MIDI::Sequence","MIDI/Sequence.html#method-i-beats_per_minute","()","<p>Returns the song tempo in beats per minute.\n"],["bpm","MIDI::Sequence","MIDI/Sequence.html#method-i-bpm","()",""],["bpm_to_mpq","MIDI::Tempo","MIDI/Tempo.html#method-c-bpm_to_mpq","(bpm)","<p>Translates beats per minute to microseconds per quarter note (beat).\n"],["bytes_as_str","MIDI::MetaEvent","MIDI/MetaEvent.html#method-c-bytes_as_str","(bytes)",""],["chan_message","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-chan_message","(running, status, c1, c2)","<p>Handle a channel message (note on, note off, etc.)\n"],["chan_pressure","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-chan_pressure","(chan, press)",""],["chan_pressure","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-chan_pressure","(chan, press)",""],["channel_to_s","MIDI::Event","MIDI/Event.html#method-i-channel_to_s","(val)","<p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.\n"],["contains_event?","MIDI::Measure","MIDI/Measure.html#method-i-contains_event-3F","(e)","<p>Returns <code>true</code> if the event is in the measure\n"],["controller","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-controller","(chan, control, value)",""],["controller","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-controller","(chan, control, value)",""],["data=","MIDI::MetaEvent","MIDI/MetaEvent.html#method-i-data-3D","(data)","<p>Stores bytes. If data is a string, splits it into an array of bytes.\n"],["data_as_bytes","MIDI::ChannelPressure","MIDI/ChannelPressure.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::Controller","MIDI/Controller.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::Event","MIDI/Event.html#method-i-data_as_bytes","()","<p>Returns the raw bytes that are written to a MIDI file or output to a MIDI stream. In MIDI::EVENT this …\n"],["data_as_bytes","MIDI::KeySig","MIDI/KeySig.html#method-i-data_as_bytes","()","<p>Returns the complete event as stored in the sequence\n"],["data_as_bytes","MIDI::MetaEvent","MIDI/MetaEvent.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::NoteEvent","MIDI/NoteEvent.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::PitchBend","MIDI/PitchBend.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::ProgramChange","MIDI/ProgramChange.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::Realtime","MIDI/Realtime.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::SongPointer","MIDI/SongPointer.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::SongSelect","MIDI/SongSelect.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::SystemExclusive","MIDI/SystemExclusive.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::Tempo","MIDI/Tempo.html#method-i-data_as_bytes","()",""],["data_as_bytes","MIDI::TimeSig","MIDI/TimeSig.html#method-i-data_as_bytes","()","<p>Returns the complete event as stored in the sequence\n"],["data_as_bytes","MIDI::TuneRequest","MIDI/TuneRequest.html#method-i-data_as_bytes","()",""],["data_as_str","MIDI::MetaEvent","MIDI/MetaEvent.html#method-i-data_as_str","()",""],["denominator","MIDI::TimeSig","MIDI/TimeSig.html#method-i-denominator","()","<p>Returns the denominator of the time signature. Use it as a power of 2 to get the displayed (lower-part) …\n"],["each","MIDI::Sequence","MIDI/Sequence.html#method-i-each","()","<p>Iterates over the tracks.\n"],["each","MIDI::Track","MIDI/Track.html#method-i-each","()","<p>Iterate over events.\n"],["end_track","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-end_track","()",""],["end_track","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-end_track","()",""],["eot","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-eot","()",""],["error","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-error","(str)","<p>The default error handler.\n"],["get_bytes","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-get_bytes","(n)","<p>Return the next <code>n</code> bytes from @io as an array.\n"],["get_measures","MIDI::Sequence","MIDI/Sequence.html#method-i-get_measures","()","<p>Returns a Measures object, which is an array container for all measures in the sequence\n"],["getc","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-getc","()","<p>This default getc implementation tries to read a single byte from io and returns it as an integer.\n"],["handle_arbitrary","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-handle_arbitrary","(msg)","<p>Copy message into raw data array, then call arbitrary().\n"],["handle_sysex","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-handle_sysex","(msg)","<p>Copy message into raw data array, then call sysex().\n"],["header","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-header","(format, ntrks, division)","<p>MIDI header.\n"],["header","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-header","(format, ntrks, division)",""],["instrument","MIDI::Track","MIDI/Track.html#method-i-instrument","()",""],["instrument=","MIDI::Track","MIDI/Track.html#method-i-instrument-3D","(str_or_bytes)",""],["key_signature","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-key_signature","(sharpflat, is_minor)",""],["key_signature","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-key_signature","(sharpflat, is_minor)",""],["length_to_delta","MIDI::Sequence","MIDI/Sequence.html#method-i-length_to_delta","(length)","<p>Translates <code>length</code> (a multiple of a quarter note) into a delta time. For example, 1 is a quarter note, …\n"],["major_key?","MIDI::KeySig","MIDI/KeySig.html#method-i-major_key-3F","()","<p>Returns true if it’s a major key, false if minor key\n"],["make_note_off","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-make_note_off","(on, vel)",""],["measure_duration","MIDI::TimeSig","MIDI/TimeSig.html#method-i-measure_duration","(ppqn)","<p>Calculates the duration (in ticks) for a full measure\n"],["measure_for_event","MIDI::Measures","MIDI/Measures.html#method-i-measure_for_event","(e)","<p>Returns the MIDI::Measure object where the event is located. Returns <code>nil</code> if the event isn’t found …\n"],["merge","MIDI::Track","MIDI/Track.html#method-i-merge","(event_list)","<p>Merges an array of events into our event list. After merging, the events’ time_from_start values …\n"],["merge_event_lists","MIDI::Track","MIDI/Track.html#method-i-merge_event_lists","(list1, list2)","<p>Merges two event arrays together. Does not modify this track.\n"],["mergesort","Object","Object.html#method-i-mergesort","(arr, &cmp)","<p>A stable sorting algorithm that maintains the relative order of equal elements.\n<p>This code used to be in …\n"],["mergesort_merge","Object","Object.html#method-i-mergesort_merge","(first, second, &predicate)",""],["mergesort_split","Object","Object.html#method-i-mergesort_split","(arr)",""],["meta_event","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-meta_event","(type)","<p>Handle a meta event.\n"],["meta_misc","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-meta_misc","(type, msg)",""],["meta_misc","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-meta_misc","(type, msg)",""],["metronome_ticks","MIDI::TimeSig","MIDI/TimeSig.html#method-i-metronome_ticks","()","<p>Returns the metronome tick duration for the time signature. On each quarter note, there’s 24 ticks. …\n"],["minor_key?","MIDI::KeySig","MIDI/KeySig.html#method-i-minor_key-3F","()","<p>Returns true if it’s a minor key, false if major key\n"],["mpq_to_bpm","MIDI::Tempo","MIDI/Tempo.html#method-c-mpq_to_bpm","(mpq)","<p>Translates microseconds per quarter note (beat) to beats per minute.\n"],["msg","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-msg","()","<p>Return a copy of the internal message buffer.\n"],["msg_add","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-msg_add","(c)","<p>Add a byte to the current message buffer.\n"],["msg_init","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-msg_init","()","<p>Initialize the internal message buffer.\n"],["msg_read","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-msg_read","(n_bytes)","<p>Read and add a number of bytes to the message buffer. Return the last byte (so we can see if it’s …\n"],["name","MIDI::Sequence","MIDI/Sequence.html#method-i-name","()","<p>Returns the name of the first track (track zero). If there are no tracks, returns UNNAMED.\n"],["name","MIDI::Track","MIDI/Track.html#method-i-name","()","<p>Return track name. If there is no name, return UNNAMED.\n"],["name=","MIDI::Sequence","MIDI/Sequence.html#method-i-name-3D","(name)","<p>Hands the name to the first track. Does nothing if there are no tracks.\n"],["name=","MIDI::Track","MIDI/Track.html#method-i-name-3D","(name)","<p>Set track name. Replaces or creates a name meta-event.\n"],["new","MIDI::ActiveSense","MIDI/ActiveSense.html#method-c-new","(delta_time = 0)",""],["new","MIDI::ChannelEvent","MIDI/ChannelEvent.html#method-c-new","(status, channel, delta_time)",""],["new","MIDI::ChannelPressure","MIDI/ChannelPressure.html#method-c-new","(channel = 0, pressure = 0, delta_time = 0)",""],["new","MIDI::Clock","MIDI/Clock.html#method-c-new","(delta_time = 0)",""],["new","MIDI::Continue","MIDI/Continue.html#method-c-new","(delta_time = 0)",""],["new","MIDI::Controller","MIDI/Controller.html#method-c-new","(channel = 0, controller = 0, value = 0, delta_time = 0)",""],["new","MIDI::Event","MIDI/Event.html#method-c-new","(status = 0, delta_time = 0)",""],["new","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-c-new","()",""],["new","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-c-new","(seq)","<p>The optional &amp;block is called once at the start of the file and again at the end of each track. …\n"],["new","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-c-new","(seq, midi_format = 1)",""],["new","MIDI::KeySig","MIDI/KeySig.html#method-c-new","(sharpflat, is_minor, delta_time = 0)","<p>Constructor\n"],["new","MIDI::Marker","MIDI/Marker.html#method-c-new","(msg, delta_time = 0)",""],["new","MIDI::Measure","MIDI/Measure.html#method-c-new","(meas_no, start_time, duration, numer, denom, met_ticks)","<p>Constructor\n"],["new","MIDI::Measures","MIDI/Measures.html#method-c-new","(max_time, ppqd)","<p>Constructor\n"],["new","MIDI::MetaEvent","MIDI/MetaEvent.html#method-c-new","(meta_type, data = nil, delta_time = 0)",""],["new","MIDI::NoteEvent","MIDI/NoteEvent.html#method-c-new","(status, channel, note, velocity, delta_time)",""],["new","MIDI::NoteOff","MIDI/NoteOff.html#method-c-new","(channel = 0, note = 64, velocity = 64, delta_time = 0)",""],["new","MIDI::NoteOff","MIDI/NoteOff.html#method-c-new","(channel = 0, note = 64, velocity = 64, delta_time = 0)",""],["new","MIDI::NoteOn","MIDI/NoteOn.html#method-c-new","(channel = 0, note = 64, velocity = 64, delta_time = 0)",""],["new","MIDI::NoteOn","MIDI/NoteOn.html#method-c-new","(channel = 0, note = 64, velocity = 64, delta_time = 0)",""],["new","MIDI::PitchBend","MIDI/PitchBend.html#method-c-new","(channel = 0, value = 0, delta_time = 0)",""],["new","MIDI::PolyPressure","MIDI/PolyPressure.html#method-c-new","(channel = 0, note = 64, value = 0, delta_time = 0)",""],["new","MIDI::ProgramChange","MIDI/ProgramChange.html#method-c-new","(channel = 0, program = 0, delta_time = 0)",""],["new","MIDI::Realtime","MIDI/Realtime.html#method-c-new","(status, delta_time)",""],["new","MIDI::Sequence","MIDI/Sequence.html#method-c-new","()",""],["new","MIDI::SongPointer","MIDI/SongPointer.html#method-c-new","(pointer = 0, delta_time = 0)",""],["new","MIDI::SongSelect","MIDI/SongSelect.html#method-c-new","(song = 0, delta_time = 0)",""],["new","MIDI::Start","MIDI/Start.html#method-c-new","(delta_time = 0)",""],["new","MIDI::Stop","MIDI/Stop.html#method-c-new","(delta_time = 0)",""],["new","MIDI::SystemCommon","MIDI/SystemCommon.html#method-c-new","(status, delta_time)",""],["new","MIDI::SystemExclusive","MIDI/SystemExclusive.html#method-c-new","(data, delta_time = 0)",""],["new","MIDI::SystemReset","MIDI/SystemReset.html#method-c-new","(delta_time = 0)",""],["new","MIDI::Tempo","MIDI/Tempo.html#method-c-new","(msecs_per_qnote, delta_time = 0)",""],["new","MIDI::TimeSig","MIDI/TimeSig.html#method-c-new","(numer, denom, clocks, qnotes, delta_time = 0)","<p>Constructor\n"],["new","MIDI::Track","MIDI/Track.html#method-c-new","(sequence)",""],["new","MIDI::TuneRequest","MIDI/TuneRequest.html#method-c-new","(delta_time = 0)",""],["note_off","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-note_off","(chan, note, vel)",""],["note_off","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-note_off","(chan, note, vel)",""],["note_on","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-note_on","(chan, note, vel)",""],["note_on","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-note_on","(chan, note, vel)",""],["note_to_delta","MIDI::Sequence","MIDI/Sequence.html#method-i-note_to_delta","(name)","<p>Given a note length name like “whole”, “dotted quarter”, or “8th triplet”, …\n"],["note_to_length","MIDI::Sequence","MIDI/Sequence.html#method-i-note_to_length","(name)","<p>Given a note length name like “whole”, “dotted quarter”, or “8th triplet”, …\n"],["note_to_s","MIDI::NoteEvent","MIDI/NoteEvent.html#method-i-note_to_s","()","<p>If @print_note_names is true, returns pch_oct(val) else returns value as a number using number_to_s. …\n"],["note_to_s","MIDI::Utils","MIDI/Utils.html#method-c-note_to_s","(num)","<p>Given a MIDI note number, return the name and octave as a string.\n"],["number_to_s","MIDI::Event","MIDI/Event.html#method-i-number_to_s","(val)","<p>Returns <code>val</code> as a decimal or hex string, depending upon the value of @print_decimal_numbers.\n"],["numerator","MIDI::TimeSig","MIDI/TimeSig.html#method-i-numerator","()","<p>Returns the numerator (the top digit) for the time signature\n"],["pch_oct","MIDI::NoteEvent","MIDI/NoteEvent.html#method-i-pch_oct","(val = @note)","<p>Returns note name as a pitch/octave string like “C4” or “F#6”.\n"],["pitch_bend","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-pitch_bend","(chan, msb, lsb)",""],["pitch_bend","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-pitch_bend","(chan, lsb, msb)",""],["possibly_munge_due_to_running_status_byte","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-possibly_munge_due_to_running_status_byte","(data, prev_status)","<p>If we can use a running status byte, delete the status byte from the given data. Return the status to …\n"],["pressure","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-pressure","(chan, note, press)",""],["pressure","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-pressure","(chan, note, press)",""],["pressure","MIDI::PolyPressure","MIDI/PolyPressure.html#method-i-pressure","()",""],["pressure=","MIDI::PolyPressure","MIDI/PolyPressure.html#method-i-pressure-3D","(val)",""],["program","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-program","(chan, program)",""],["program","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-program","(chan, program)",""],["pulses_to_seconds","MIDI::Sequence","MIDI/Sequence.html#method-i-pulses_to_seconds","(pulses)","<p>Pulses (also called ticks) are the units of delta times and event time_from_start values. This method …\n"],["quantize","MIDI::Track","MIDI/Track.html#method-i-quantize","(length_or_note)","<p>Quantize every event. length_or_note is either a length (1 = quarter, 0.25 = sixteenth, 4 = whole note) …\n"],["quantize_to","MIDI::Event","MIDI/Event.html#method-i-quantize_to","(boundary)","<p>Quantize this event’s time_from_start by moving it to the nearest multiple of <code>boundary</code>. See MIDI::Track#quantize …\n"],["read","MIDI::Sequence","MIDI/Sequence.html#method-i-read","(io)","<p>Reads a MIDI stream.\n"],["read16","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read16","()","<p>Read and return a sixteen bit value.\n"],["read32","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read32","()","<p>Read and return a 32-bit value.\n"],["read_from","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read_from","(io)","<p>The only public method. Each MIDI event in the file causes a method to be called.\n"],["read_header","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read_header","()","<p>Read a header chunk.\n"],["read_mt_header_string","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read_mt_header_string","(bytes, skip)","<p>Read through ‘MThd’ or ‘MTrk’ header string. If skip is true, attempt to skip initial …\n"],["read_track","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read_track","()","<p>Read a track chunk.\n"],["read_var_len","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-read_var_len","()","<p>Read a varlen value.\n"],["recalc_delta_from_times","MIDI::Track","MIDI/Track.html#method-i-recalc_delta_from_times","(starting_at = 0, list = @events)","<p>The opposite of recalc_times: recalculates delta_time for each event from each event’s time_from_start. …\n"],["recalc_times","MIDI::Track","MIDI/Track.html#method-i-recalc_times","(starting_at = 0, list = @events)","<p>Recalculate start times for all events in <code>list</code> from starting_at to end.\n"],["sequence_number","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-sequence_number","(num)",""],["sequencer_specific","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-sequencer_specific","(type, msg)",""],["sharpflat","MIDI::KeySig","MIDI/KeySig.html#method-i-sharpflat","()","<p>Returns the number of sharps/flats in the key sig. Negative for flats.\n"],["smpte","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-smpte","(hour, min, sec, frame, fract)",""],["sort","MIDI::Track","MIDI/Track.html#method-i-sort","(starting_at = 0, list = @events)","<p>Sort events by their time_from_start. After sorting, recalc_delta_from_times is called to make sure that …\n"],["start_track","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-start_track","(bytes_to_be_read)",""],["start_track","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-start_track","()",""],["str_as_bytes","MIDI::MetaEvent","MIDI/MetaEvent.html#method-c-str_as_bytes","(str)",""],["sysex","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-sysex","(msg)",""],["sysex","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-sysex","(msg)",""],["tempo","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-tempo","(microsecs)",""],["tempo","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-tempo","(microsecs)","<p>–\n\n<pre class=\"ruby\"><span class=\"ruby-keyword\">def</span> <span class=\"ruby-identifier ruby-title\">smpte</span>(<span class=\"ruby-identifier\">hour</span>, <span class=\"ruby-identifier\">min</span>, <span class=\"ruby-identifier\">sec</span>, <span class=\"ruby-identifier\">frame</span>, <span class=\"ruby-identifier\">fract</span>)\n<span class=\"ruby-keyword\">end</span>\n</pre>\n<p>++\n"],["tempo","MIDI::Sequence","MIDI/Sequence.html#method-i-tempo","()",""],["tempo","MIDI::Tempo","MIDI/Tempo.html#method-i-tempo","()",""],["tempo=","MIDI::Tempo","MIDI/Tempo.html#method-i-tempo-3D","(val)",""],["text","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-text","(type, msg)",""],["text","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-text","(type, msg)","\n<pre class=\"ruby\"><span class=\"ruby-keyword\">def</span> <span class=\"ruby-identifier ruby-title\">sequence_number</span>(<span class=\"ruby-identifier\">num</span>)\n<span class=\"ruby-keyword\">end</span>\n</pre>\n<p>++\n"],["time_signature","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-time_signature","(numer, denom, clocks, qnotes)",""],["time_signature","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-time_signature","(numer, denom, clocks, qnotes)","<p>– Don’t bother adding the META_TRACK_END event to the track. This way, we don’t have to worry …\n"],["time_signature","MIDI::Sequence","MIDI/Sequence.html#method-i-time_signature","(numer, denom, clocks, qnotes)","<p>Sets the time signature.\n"],["to_code","MIDI::KeySig","MIDI/KeySig.html#method-i-to_code","()","<p>Returns the key signature as a code. Example: “Ab” for “key sig A flat major”\n"],["to_mbt","MIDI::Measures","MIDI/Measures.html#method-i-to_mbt","(e)","<p>Returns the event’s time as a formatted MBT string (Measure:Beat:Ticks) as found in MIDI sequencers. …\n"],["to_s","MIDI::ActiveSense","MIDI/ActiveSense.html#method-i-to_s","()",""],["to_s","MIDI::ChannelEvent","MIDI/ChannelEvent.html#method-i-to_s","()",""],["to_s","MIDI::ChannelPressure","MIDI/ChannelPressure.html#method-i-to_s","()",""],["to_s","MIDI::Clock","MIDI/Clock.html#method-i-to_s","()",""],["to_s","MIDI::Continue","MIDI/Continue.html#method-i-to_s","()",""],["to_s","MIDI::Controller","MIDI/Controller.html#method-i-to_s","()",""],["to_s","MIDI::Event","MIDI/Event.html#method-i-to_s","()",""],["to_s","MIDI::KeySig","MIDI/KeySig.html#method-i-to_s","()","<p>Returns the key signature as a text string. Example: “key sig A flat major”\n"],["to_s","MIDI::Measure","MIDI/Measure.html#method-i-to_s","()","<p>Returns a detailed string with information about the measure\n"],["to_s","MIDI::MetaEvent","MIDI/MetaEvent.html#method-i-to_s","()",""],["to_s","MIDI::NoteOff","MIDI/NoteOff.html#method-i-to_s","()",""],["to_s","MIDI::NoteOff","MIDI/NoteOff.html#method-i-to_s","()",""],["to_s","MIDI::NoteOn","MIDI/NoteOn.html#method-i-to_s","()",""],["to_s","MIDI::NoteOn","MIDI/NoteOn.html#method-i-to_s","()",""],["to_s","MIDI::PitchBend","MIDI/PitchBend.html#method-i-to_s","()",""],["to_s","MIDI::PolyPressure","MIDI/PolyPressure.html#method-i-to_s","()",""],["to_s","MIDI::ProgramChange","MIDI/ProgramChange.html#method-i-to_s","()",""],["to_s","MIDI::Realtime","MIDI/Realtime.html#method-i-to_s","()",""],["to_s","MIDI::SongPointer","MIDI/SongPointer.html#method-i-to_s","()",""],["to_s","MIDI::SongSelect","MIDI/SongSelect.html#method-i-to_s","()",""],["to_s","MIDI::Start","MIDI/Start.html#method-i-to_s","()",""],["to_s","MIDI::Stop","MIDI/Stop.html#method-i-to_s","()",""],["to_s","MIDI::SystemExclusive","MIDI/SystemExclusive.html#method-i-to_s","()",""],["to_s","MIDI::SystemReset","MIDI/SystemReset.html#method-i-to_s","()",""],["to_s","MIDI::Tempo","MIDI/Tempo.html#method-i-to_s","()",""],["to_s","MIDI::TimeSig","MIDI/TimeSig.html#method-i-to_s","()","<p>Returns the time signature for the event as a string. Example: “time sig 3/4”\n"],["to_s","MIDI::TuneRequest","MIDI/TuneRequest.html#method-i-to_s","()",""],["track_uses_channel","MIDI::IO::SeqReader","MIDI/IO/SeqReader.html#method-i-track_uses_channel","(chan)","<p>Return true if the current track uses the specified channel.\n"],["write","MIDI::Sequence","MIDI/Sequence.html#method-i-write","(io, midi_format = 1)","<p>Writes to a MIDI stream. <code>midi_format</code> defaults to 1.\n"],["write16","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-write16","(val)","<p>Write a sixteen-bit value.\n"],["write16","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write16","(val)",""],["write32","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-write32","(val)","<p>Write a 32-bit value.\n"],["write32","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write32","(val)",""],["write_bytes","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_bytes","(bytes)",""],["write_header","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_header","()",""],["write_instrument","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_instrument","(instrument)",""],["write_to","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_to","(io)","<p>Writes a MIDI format 1 file.\n"],["write_track","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_track","(track)",""],["write_var_len","MIDI::IO::MIDIFile","MIDI/IO/MIDIFile.html#method-i-write_var_len","(val)","<p>Write a variable length value.\n"],["write_var_len","MIDI::IO::SeqWriter","MIDI/IO/SeqWriter.html#method-i-write_var_len","(val)",""],["README","","README_rdoc.html","","<p>midilib\n<p>midilib is a pure Ruby MIDI library useful for reading and writing standard MIDI files and manipulating …\n"],["TODO","","TODO_rdoc.html","","<p>Bugs\n<p>midilib does not handle tempo changes when calculating <code>beats_per_minute</code>. The tempo events are correctly …\n"]]}}
Binary file
@@ -0,0 +1,229 @@
1
+ Searcher = function(data) {
2
+ this.data = data;
3
+ this.handlers = [];
4
+ }
5
+
6
+ Searcher.prototype = new function() {
7
+ // search is performed in chunks of 1000 for non-blocking user input
8
+ var CHUNK_SIZE = 1000;
9
+ // do not try to find more than 100 results
10
+ var MAX_RESULTS = 100;
11
+ var huid = 1;
12
+ var suid = 1;
13
+ var runs = 0;
14
+
15
+ this.find = function(query) {
16
+ var queries = splitQuery(query);
17
+ var regexps = buildRegexps(queries);
18
+ var highlighters = buildHilighters(queries);
19
+ var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
20
+ var _this = this;
21
+
22
+ this.currentSuid = state.n;
23
+
24
+ if (!query) return;
25
+
26
+ var run = function() {
27
+ // stop current search thread if new search started
28
+ if (state.n != _this.currentSuid) return;
29
+
30
+ var results =
31
+ performSearch(_this.data, regexps, queries, highlighters, state);
32
+ var hasMore = (state.limit > 0 && state.pass < 4);
33
+
34
+ triggerResults.call(_this, results, !hasMore);
35
+ if (hasMore) {
36
+ setTimeout(run, 2);
37
+ }
38
+ runs++;
39
+ };
40
+ runs = 0;
41
+
42
+ // start search thread
43
+ run();
44
+ }
45
+
46
+ /* ----- Events ------ */
47
+ this.ready = function(fn) {
48
+ fn.huid = huid;
49
+ this.handlers.push(fn);
50
+ }
51
+
52
+ /* ----- Utilities ------ */
53
+ function splitQuery(query) {
54
+ return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
+ return string.match(/\S/);
56
+ });
57
+ }
58
+
59
+ function buildRegexps(queries) {
60
+ return queries.map(function(query) {
61
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
+ });
63
+ }
64
+
65
+ function buildHilighters(queries) {
66
+ return queries.map(function(query) {
67
+ return query.split('').map(function(l, i) {
68
+ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
+ }).join('');
70
+ });
71
+ }
72
+
73
+ // function longMatchRegexp(index, longIndex, regexps) {
74
+ // for (var i = regexps.length - 1; i >= 0; i--){
75
+ // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
76
+ // };
77
+ // return true;
78
+ // }
79
+
80
+
81
+ /* ----- Mathchers ------ */
82
+
83
+ /*
84
+ * This record matches if the index starts with queries[0] and the record
85
+ * matches all of the regexps
86
+ */
87
+ function matchPassBeginning(index, longIndex, queries, regexps) {
88
+ if (index.indexOf(queries[0]) != 0) return false;
89
+ for (var i=1, l = regexps.length; i < l; i++) {
90
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
91
+ return false;
92
+ };
93
+ return true;
94
+ }
95
+
96
+ /*
97
+ * This record matches if the longIndex starts with queries[0] and the
98
+ * longIndex matches all of the regexps
99
+ */
100
+ function matchPassLongIndex(index, longIndex, queries, regexps) {
101
+ if (longIndex.indexOf(queries[0]) != 0) return false;
102
+ for (var i=1, l = regexps.length; i < l; i++) {
103
+ if (!longIndex.match(regexps[i]))
104
+ return false;
105
+ };
106
+ return true;
107
+ }
108
+
109
+ /*
110
+ * This record matches if the index contains queries[0] and the record
111
+ * matches all of the regexps
112
+ */
113
+ function matchPassContains(index, longIndex, queries, regexps) {
114
+ if (index.indexOf(queries[0]) == -1) return false;
115
+ for (var i=1, l = regexps.length; i < l; i++) {
116
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
117
+ return false;
118
+ };
119
+ return true;
120
+ }
121
+
122
+ /*
123
+ * This record matches if regexps[0] matches the index and the record
124
+ * matches all of the regexps
125
+ */
126
+ function matchPassRegexp(index, longIndex, queries, regexps) {
127
+ if (!index.match(regexps[0])) return false;
128
+ for (var i=1, l = regexps.length; i < l; i++) {
129
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
130
+ return false;
131
+ };
132
+ return true;
133
+ }
134
+
135
+
136
+ /* ----- Highlighters ------ */
137
+ function highlightRegexp(info, queries, regexps, highlighters) {
138
+ var result = createResult(info);
139
+ for (var i=0, l = regexps.length; i < l; i++) {
140
+ result.title = result.title.replace(regexps[i], highlighters[i]);
141
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
142
+ };
143
+ return result;
144
+ }
145
+
146
+ function hltSubstring(string, pos, length) {
147
+ return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
148
+ }
149
+
150
+ function highlightQuery(info, queries, regexps, highlighters) {
151
+ var result = createResult(info);
152
+ var pos = 0;
153
+ var lcTitle = result.title.toLowerCase();
154
+
155
+ pos = lcTitle.indexOf(queries[0]);
156
+ if (pos != -1) {
157
+ result.title = hltSubstring(result.title, pos, queries[0].length);
158
+ }
159
+
160
+ result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
161
+ for (var i=1, l = regexps.length; i < l; i++) {
162
+ result.title = result.title.replace(regexps[i], highlighters[i]);
163
+ result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
164
+ };
165
+ return result;
166
+ }
167
+
168
+ function createResult(info) {
169
+ var result = {};
170
+ result.title = info[0];
171
+ result.namespace = info[1];
172
+ result.path = info[2];
173
+ result.params = info[3];
174
+ result.snippet = info[4];
175
+ result.badge = info[6];
176
+ return result;
177
+ }
178
+
179
+ /* ----- Searching ------ */
180
+ function performSearch(data, regexps, queries, highlighters, state) {
181
+ var searchIndex = data.searchIndex;
182
+ var longSearchIndex = data.longSearchIndex;
183
+ var info = data.info;
184
+ var result = [];
185
+ var i = state.from;
186
+ var l = searchIndex.length;
187
+ var togo = CHUNK_SIZE;
188
+ var matchFunc, hltFunc;
189
+
190
+ while (state.pass < 4 && state.limit > 0 && togo > 0) {
191
+ if (state.pass == 0) {
192
+ matchFunc = matchPassBeginning;
193
+ hltFunc = highlightQuery;
194
+ } else if (state.pass == 1) {
195
+ matchFunc = matchPassLongIndex;
196
+ hltFunc = highlightQuery;
197
+ } else if (state.pass == 2) {
198
+ matchFunc = matchPassContains;
199
+ hltFunc = highlightQuery;
200
+ } else if (state.pass == 3) {
201
+ matchFunc = matchPassRegexp;
202
+ hltFunc = highlightRegexp;
203
+ }
204
+
205
+ for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
206
+ if (info[i].n == state.n) continue;
207
+ if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
208
+ info[i].n = state.n;
209
+ result.push(hltFunc(info[i], queries, regexps, highlighters));
210
+ state.limit--;
211
+ }
212
+ };
213
+ if (searchIndex.length <= i) {
214
+ state.pass++;
215
+ i = state.from = 0;
216
+ } else {
217
+ state.from = i;
218
+ }
219
+ }
220
+ return result;
221
+ }
222
+
223
+ function triggerResults(results, isLast) {
224
+ this.handlers.forEach(function(fn) {
225
+ fn.call(this, results, isLast)
226
+ });
227
+ }
228
+ }
229
+
Binary file