midilib 2.0.4 → 2.0.5
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.
- checksums.yaml +7 -0
 - data/README.rdoc +9 -4
 - data/Rakefile +2 -6
 - data/examples/from_scratch.rb +3 -5
 - data/examples/measures_mbt.rb +4 -4
 - data/examples/print_program_changes.rb +9 -9
 - data/examples/reader2text.rb +188 -188
 - data/examples/seq2text.rb +17 -17
 - data/examples/split.rb +19 -19
 - data/examples/strings.rb +14 -14
 - data/examples/transpose.rb +31 -31
 - data/html/IO.html +65 -169
 - data/html/MIDI.html +138 -256
 - data/html/MIDI/ActiveSense.html +89 -178
 - data/html/MIDI/ChannelEvent.html +95 -183
 - data/html/MIDI/ChannelPressure.html +105 -190
 - data/html/MIDI/Clock.html +89 -178
 - data/html/MIDI/Continue.html +89 -178
 - data/html/MIDI/Controller.html +107 -192
 - data/html/MIDI/Event.html +138 -222
 - data/html/MIDI/IO.html +45 -157
 - data/html/MIDI/IO/MIDIFile.html +596 -568
 - data/html/MIDI/IO/SeqReader.html +272 -314
 - data/html/MIDI/IO/SeqWriter.html +229 -305
 - data/html/MIDI/KeySig.html +129 -211
 - data/html/MIDI/MIDI.html +45 -154
 - data/html/MIDI/MIDI/MIDI.html +45 -154
 - data/html/MIDI/MIDI/MIDI/Array.html +87 -185
 - data/html/MIDI/Marker.html +71 -170
 - data/html/MIDI/Measure.html +95 -190
 - data/html/MIDI/Measures.html +103 -193
 - data/html/MIDI/MetaEvent.html +180 -253
 - data/html/MIDI/NoteEvent.html +118 -204
 - data/html/MIDI/NoteOff.html +95 -183
 - data/html/MIDI/NoteOn.html +95 -183
 - data/html/MIDI/PitchBend.html +106 -191
 - data/html/MIDI/PolyPressure.html +106 -189
 - data/html/MIDI/ProgramChange.html +105 -190
 - data/html/MIDI/Realtime.html +98 -184
 - data/html/MIDI/Sequence.html +246 -311
 - data/html/MIDI/SongPointer.html +106 -191
 - data/html/MIDI/SongSelect.html +105 -190
 - data/html/MIDI/Start.html +89 -178
 - data/html/MIDI/Stop.html +89 -178
 - data/html/MIDI/SystemCommon.html +71 -170
 - data/html/MIDI/SystemExclusive.html +108 -193
 - data/html/MIDI/SystemReset.html +89 -178
 - data/html/MIDI/Tempo.html +135 -213
 - data/html/MIDI/TimeSig.html +135 -214
 - data/html/MIDI/Track.html +217 -291
 - data/html/MIDI/TuneRequest.html +98 -184
 - data/html/MIDI/Utils.html +89 -189
 - data/html/README_rdoc.html +237 -257
 - data/html/TODO_rdoc.html +64 -139
 - data/html/created.rid +14 -14
 - data/html/css/fonts.css +167 -0
 - data/html/{rdoc.css → css/rdoc.css} +265 -218
 - data/html/fonts/Lato-Light.ttf +0 -0
 - data/html/fonts/Lato-LightItalic.ttf +0 -0
 - data/html/fonts/Lato-Regular.ttf +0 -0
 - data/html/fonts/Lato-RegularItalic.ttf +0 -0
 - data/html/fonts/SourceCodePro-Bold.ttf +0 -0
 - data/html/fonts/SourceCodePro-Regular.ttf +0 -0
 - data/html/images/add.png +0 -0
 - data/html/images/arrow_up.png +0 -0
 - data/html/images/delete.png +0 -0
 - data/html/images/tag_blue.png +0 -0
 - data/html/index.html +187 -169
 - data/html/js/darkfish.js +41 -33
 - data/html/js/jquery.js +4 -18
 - data/html/js/navigation.js.gz +0 -0
 - data/html/js/search.js +20 -5
 - data/html/js/search_index.js +1 -1
 - data/html/js/search_index.js.gz +0 -0
 - data/html/js/searcher.js.gz +0 -0
 - data/html/table_of_contents.html +1111 -498
 - data/install.rb +43 -32
 - data/lib/midilib/consts.rb +407 -407
 - data/lib/midilib/event.rb +295 -294
 - data/lib/midilib/info.rb +5 -5
 - data/lib/midilib/io/midifile.rb +266 -267
 - data/lib/midilib/io/seqreader.rb +106 -106
 - data/lib/midilib/io/seqwriter.rb +59 -60
 - data/lib/midilib/measure.rb +69 -69
 - data/lib/midilib/sequence.rb +68 -70
 - data/lib/midilib/track.rb +96 -102
 - data/lib/midilib/utils.rb +15 -15
 - data/test/event_equality.rb +50 -50
 - data/test/test_event.rb +120 -122
 - data/test/test_io.rb +35 -48
 - data/test/test_sequence.rb +60 -60
 - data/test/test_track.rb +154 -154
 - data/test/test_varlen.rb +23 -25
 - metadata +65 -57
 
    
        data/html/MIDI/IO/SeqWriter.html
    CHANGED
    
    | 
         @@ -2,215 +2,108 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            <html>
         
     | 
| 
       4 
4 
     | 
    
         
             
            <head>
         
     | 
| 
       5 
     | 
    
         
            -
            <meta  
     | 
| 
      
 5 
     | 
    
         
            +
            <meta charset="UTF-8">
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            <title>class MIDI::IO::SeqWriter - midilib</title>
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
            <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
9 
     | 
    
         
             
            <script type="text/javascript">
         
     | 
| 
       12 
10 
     | 
    
         
             
              var rdoc_rel_prefix = "../../";
         
     | 
| 
       13 
11 
     | 
    
         
             
            </script>
         
     | 
| 
       14 
12 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
            <script  
     | 
| 
       16 
     | 
    
         
            -
            <script  
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            < 
     | 
| 
       19 
     | 
    
         
            -
            < 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            <script src="../../js/jquery.js"></script>
         
     | 
| 
      
 14 
     | 
    
         
            +
            <script src="../../js/darkfish.js"></script>
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            <link href="../../css/fonts.css" rel="stylesheet">
         
     | 
| 
      
 17 
     | 
    
         
            +
            <link href="../../css/rdoc.css" rel="stylesheet">
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       21 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
            <body id="top" role="document" class="class">
         
     | 
| 
      
 22 
     | 
    
         
            +
            <nav role="navigation">
         
     | 
| 
      
 23 
     | 
    
         
            +
              <div id="project-navigation">
         
     | 
| 
      
 24 
     | 
    
         
            +
                <div id="home-section" role="region" title="Quick navigation" class="nav-section">
         
     | 
| 
      
 25 
     | 
    
         
            +
              <h2>
         
     | 
| 
      
 26 
     | 
    
         
            +
                <a href="../../index.html" rel="home">Home</a>
         
     | 
| 
      
 27 
     | 
    
         
            +
              </h2>
         
     | 
| 
       22 
28 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            < 
     | 
| 
       24 
     | 
    
         
            -
            < 
     | 
| 
       25 
     | 
    
         
            -
              <nav id="home-section" class="section">
         
     | 
| 
       26 
     | 
    
         
            -
              <h3 class="section-header">
         
     | 
| 
       27 
     | 
    
         
            -
                <a href="../../index.html">Home</a>
         
     | 
| 
      
 29 
     | 
    
         
            +
              <div id="table-of-contents-navigation">
         
     | 
| 
      
 30 
     | 
    
         
            +
                <a href="../../table_of_contents.html#pages">Pages</a>
         
     | 
| 
       28 
31 
     | 
    
         
             
                <a href="../../table_of_contents.html#classes">Classes</a>
         
     | 
| 
       29 
32 
     | 
    
         
             
                <a href="../../table_of_contents.html#methods">Methods</a>
         
     | 
| 
       30 
     | 
    
         
            -
              </ 
     | 
| 
       31 
     | 
    
         
            -
            </ 
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 34 
     | 
    
         
            +
            </div>
         
     | 
| 
       33 
35 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                <div id="search-section" role="search" class="project-section initially-hidden">
         
     | 
| 
       35 
37 
     | 
    
         
             
              <form action="#" method="get" accept-charset="utf-8">
         
     | 
| 
       36 
     | 
    
         
            -
                < 
     | 
| 
       37 
     | 
    
         
            -
                  <input  
     | 
| 
      
 38 
     | 
    
         
            +
                <div id="search-field-wrapper">
         
     | 
| 
      
 39 
     | 
    
         
            +
                  <input id="search-field" role="combobox" aria-label="Search"
         
     | 
| 
      
 40 
     | 
    
         
            +
                         aria-autocomplete="list" aria-controls="search-results"
         
     | 
| 
      
 41 
     | 
    
         
            +
                         type="text" name="search" placeholder="Search" spellcheck="false"
         
     | 
| 
       38 
42 
     | 
    
         
             
                         title="Type to search, Up and Down to navigate, Enter to load">
         
     | 
| 
       39 
     | 
    
         
            -
                </ 
     | 
| 
       40 
     | 
    
         
            -
              </form>
         
     | 
| 
      
 43 
     | 
    
         
            +
                </div>
         
     | 
| 
       41 
44 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                <nav id="file-list-section" class="section">
         
     | 
| 
       48 
     | 
    
         
            -
              <h3 class="section-header">Defined In</h3>
         
     | 
| 
       49 
     | 
    
         
            -
              <ul>
         
     | 
| 
       50 
     | 
    
         
            -
                <li>lib/midilib/io/seqwriter.rb
         
     | 
| 
       51 
     | 
    
         
            -
              </ul>
         
     | 
| 
       52 
     | 
    
         
            -
            </nav>
         
     | 
| 
      
 45 
     | 
    
         
            +
                <ul id="search-results" aria-label="Search Results"
         
     | 
| 
      
 46 
     | 
    
         
            +
                    aria-busy="false" aria-expanded="false"
         
     | 
| 
      
 47 
     | 
    
         
            +
                    aria-atomic="false" class="initially-hidden"></ul>
         
     | 
| 
      
 48 
     | 
    
         
            +
              </form>
         
     | 
| 
      
 49 
     | 
    
         
            +
            </div>
         
     | 
| 
       53 
50 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                
         
     | 
| 
       55 
51 
     | 
    
         
             
              </div>
         
     | 
| 
       56 
52 
     | 
    
         | 
| 
      
 53 
     | 
    
         
            +
              
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       57 
55 
     | 
    
         
             
              <div id="class-metadata">
         
     | 
| 
       58 
56 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                < 
     | 
| 
       60 
     | 
    
         
            -
              <h3 
     | 
| 
      
 57 
     | 
    
         
            +
                <div id="parent-class-section" class="nav-section">
         
     | 
| 
      
 58 
     | 
    
         
            +
              <h3>Parent</h3>
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       61 
60 
     | 
    
         | 
| 
       62 
61 
     | 
    
         
             
              <p class="link">Object
         
     | 
| 
       63 
62 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
            </ 
     | 
| 
      
 63 
     | 
    
         
            +
            </div>
         
     | 
| 
       65 
64 
     | 
    
         | 
| 
       66 
65 
     | 
    
         | 
| 
      
 66 
     | 
    
         
            +
                
         
     | 
| 
       67 
67 
     | 
    
         
             
                <!-- Method Quickref -->
         
     | 
| 
       68 
     | 
    
         
            -
            < 
     | 
| 
       69 
     | 
    
         
            -
              <h3 
     | 
| 
      
 68 
     | 
    
         
            +
            <div id="method-list-section" class="nav-section">
         
     | 
| 
      
 69 
     | 
    
         
            +
              <h3>Methods</h3>
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
              <ul class="link-list">
         
     | 
| 
      
 71 
     | 
    
         
            +
              <ul class="link-list" role="directory">
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                <li><a href="#method-c-new">::new</a>
         
     | 
| 
      
 73 
     | 
    
         
            +
                <li ><a href="#method-c-new">::new</a>
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                <li><a href="#method-i-possibly_munge_due_to_running_status_byte">#possibly_munge_due_to_running_status_byte</a>
         
     | 
| 
      
 75 
     | 
    
         
            +
                <li ><a href="#method-i-possibly_munge_due_to_running_status_byte">#possibly_munge_due_to_running_status_byte</a>
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
                <li><a href="#method-i-write16">#write16</a>
         
     | 
| 
      
 77 
     | 
    
         
            +
                <li ><a href="#method-i-write16">#write16</a>
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                <li><a href="#method-i-write32">#write32</a>
         
     | 
| 
      
 79 
     | 
    
         
            +
                <li ><a href="#method-i-write32">#write32</a>
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                <li><a href="#method-i-write_bytes">#write_bytes</a>
         
     | 
| 
      
 81 
     | 
    
         
            +
                <li ><a href="#method-i-write_bytes">#write_bytes</a>
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                <li><a href="#method-i-write_header">#write_header</a>
         
     | 
| 
      
 83 
     | 
    
         
            +
                <li ><a href="#method-i-write_header">#write_header</a>
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
                <li><a href="#method-i-write_instrument">#write_instrument</a>
         
     | 
| 
      
 85 
     | 
    
         
            +
                <li ><a href="#method-i-write_instrument">#write_instrument</a>
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
                <li><a href="#method-i-write_to">#write_to</a>
         
     | 
| 
      
 87 
     | 
    
         
            +
                <li ><a href="#method-i-write_to">#write_to</a>
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                <li><a href="#method-i-write_track">#write_track</a>
         
     | 
| 
      
 89 
     | 
    
         
            +
                <li ><a href="#method-i-write_track">#write_track</a>
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                <li><a href="#method-i-write_var_len">#write_var_len</a>
         
     | 
| 
      
 91 
     | 
    
         
            +
                <li ><a href="#method-i-write_var_len">#write_var_len</a>
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
93 
     | 
    
         
             
              </ul>
         
     | 
| 
       94 
     | 
    
         
            -
            </ 
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
              </div>
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
              <div id="project-metadata">
         
     | 
| 
       99 
     | 
    
         
            -
                <nav id="fileindex-section" class="section project-section">
         
     | 
| 
       100 
     | 
    
         
            -
              <h3 class="section-header">Pages</h3>
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
              <ul>
         
     | 
| 
       103 
     | 
    
         
            -
              
         
     | 
| 
       104 
     | 
    
         
            -
                <li class="file"><a href="../../README_rdoc.html">README</a>
         
     | 
| 
       105 
     | 
    
         
            -
              
         
     | 
| 
       106 
     | 
    
         
            -
                <li class="file"><a href="../../TODO_rdoc.html">TODO</a>
         
     | 
| 
       107 
     | 
    
         
            -
              
         
     | 
| 
       108 
     | 
    
         
            -
              </ul>
         
     | 
| 
       109 
     | 
    
         
            -
            </nav>
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                <nav id="classindex-section" class="section project-section">
         
     | 
| 
       112 
     | 
    
         
            -
              <h3 class="section-header">Class and Module Index</h3>
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
              <ul class="link-list">
         
     | 
| 
       115 
     | 
    
         
            -
              
         
     | 
| 
       116 
     | 
    
         
            -
                <li><a href="../../MIDI.html">MIDI</a>
         
     | 
| 
       117 
     | 
    
         
            -
              
         
     | 
| 
       118 
     | 
    
         
            -
                <li><a href="../../MIDI/ActiveSense.html">MIDI::ActiveSense</a>
         
     | 
| 
       119 
     | 
    
         
            -
              
         
     | 
| 
       120 
     | 
    
         
            -
                <li><a href="../../MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
         
     | 
| 
       121 
     | 
    
         
            -
              
         
     | 
| 
       122 
     | 
    
         
            -
                <li><a href="../../MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
         
     | 
| 
       123 
     | 
    
         
            -
              
         
     | 
| 
       124 
     | 
    
         
            -
                <li><a href="../../MIDI/Clock.html">MIDI::Clock</a>
         
     | 
| 
       125 
     | 
    
         
            -
              
         
     | 
| 
       126 
     | 
    
         
            -
                <li><a href="../../MIDI/Continue.html">MIDI::Continue</a>
         
     | 
| 
       127 
     | 
    
         
            -
              
         
     | 
| 
       128 
     | 
    
         
            -
                <li><a href="../../MIDI/Controller.html">MIDI::Controller</a>
         
     | 
| 
       129 
     | 
    
         
            -
              
         
     | 
| 
       130 
     | 
    
         
            -
                <li><a href="../../MIDI/Event.html">MIDI::Event</a>
         
     | 
| 
       131 
     | 
    
         
            -
              
         
     | 
| 
       132 
     | 
    
         
            -
                <li><a href="../../MIDI/IO.html">MIDI::IO</a>
         
     | 
| 
       133 
     | 
    
         
            -
              
         
     | 
| 
       134 
     | 
    
         
            -
                <li><a href="../../MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
         
     | 
| 
       135 
     | 
    
         
            -
              
         
     | 
| 
       136 
     | 
    
         
            -
                <li><a href="../../MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
         
     | 
| 
       137 
     | 
    
         
            -
              
         
     | 
| 
       138 
     | 
    
         
            -
                <li><a href="../../MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
         
     | 
| 
       139 
     | 
    
         
            -
              
         
     | 
| 
       140 
     | 
    
         
            -
                <li><a href="../../MIDI/KeySig.html">MIDI::KeySig</a>
         
     | 
| 
       141 
     | 
    
         
            -
              
         
     | 
| 
       142 
     | 
    
         
            -
                <li><a href="../../MIDI/MIDI.html">MIDI::MIDI</a>
         
     | 
| 
       143 
     | 
    
         
            -
              
         
     | 
| 
       144 
     | 
    
         
            -
                <li><a href="../../MIDI/MIDI/MIDI.html">MIDI::MIDI::MIDI</a>
         
     | 
| 
       145 
     | 
    
         
            -
              
         
     | 
| 
       146 
     | 
    
         
            -
                <li><a href="../../MIDI/MIDI/MIDI/Array.html">MIDI::MIDI::MIDI::Array</a>
         
     | 
| 
       147 
     | 
    
         
            -
              
         
     | 
| 
       148 
     | 
    
         
            -
                <li><a href="../../MIDI/Marker.html">MIDI::Marker</a>
         
     | 
| 
       149 
     | 
    
         
            -
              
         
     | 
| 
       150 
     | 
    
         
            -
                <li><a href="../../MIDI/Measure.html">MIDI::Measure</a>
         
     | 
| 
       151 
     | 
    
         
            -
              
         
     | 
| 
       152 
     | 
    
         
            -
                <li><a href="../../MIDI/Measures.html">MIDI::Measures</a>
         
     | 
| 
       153 
     | 
    
         
            -
              
         
     | 
| 
       154 
     | 
    
         
            -
                <li><a href="../../MIDI/MetaEvent.html">MIDI::MetaEvent</a>
         
     | 
| 
       155 
     | 
    
         
            -
              
         
     | 
| 
       156 
     | 
    
         
            -
                <li><a href="../../MIDI/NoteEvent.html">MIDI::NoteEvent</a>
         
     | 
| 
       157 
     | 
    
         
            -
              
         
     | 
| 
       158 
     | 
    
         
            -
                <li><a href="../../MIDI/NoteOff.html">MIDI::NoteOff</a>
         
     | 
| 
       159 
     | 
    
         
            -
              
         
     | 
| 
       160 
     | 
    
         
            -
                <li><a href="../../MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
         
     | 
| 
       161 
     | 
    
         
            -
              
         
     | 
| 
       162 
     | 
    
         
            -
                <li><a href="../../MIDI/NoteOn.html">MIDI::NoteOn</a>
         
     | 
| 
       163 
     | 
    
         
            -
              
         
     | 
| 
       164 
     | 
    
         
            -
                <li><a href="../../MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
         
     | 
| 
       165 
     | 
    
         
            -
              
         
     | 
| 
       166 
     | 
    
         
            -
                <li><a href="../../MIDI/PitchBend.html">MIDI::PitchBend</a>
         
     | 
| 
       167 
     | 
    
         
            -
              
         
     | 
| 
       168 
     | 
    
         
            -
                <li><a href="../../MIDI/PolyPressure.html">MIDI::PolyPressure</a>
         
     | 
| 
       169 
     | 
    
         
            -
              
         
     | 
| 
       170 
     | 
    
         
            -
                <li><a href="../../MIDI/ProgramChange.html">MIDI::ProgramChange</a>
         
     | 
| 
       171 
     | 
    
         
            -
              
         
     | 
| 
       172 
     | 
    
         
            -
                <li><a href="../../MIDI/Realtime.html">MIDI::Realtime</a>
         
     | 
| 
       173 
     | 
    
         
            -
              
         
     | 
| 
       174 
     | 
    
         
            -
                <li><a href="../../MIDI/Sequence.html">MIDI::Sequence</a>
         
     | 
| 
       175 
     | 
    
         
            -
              
         
     | 
| 
       176 
     | 
    
         
            -
                <li><a href="../../MIDI/SongPointer.html">MIDI::SongPointer</a>
         
     | 
| 
       177 
     | 
    
         
            -
              
         
     | 
| 
       178 
     | 
    
         
            -
                <li><a href="../../MIDI/SongSelect.html">MIDI::SongSelect</a>
         
     | 
| 
       179 
     | 
    
         
            -
              
         
     | 
| 
       180 
     | 
    
         
            -
                <li><a href="../../MIDI/Start.html">MIDI::Start</a>
         
     | 
| 
       181 
     | 
    
         
            -
              
         
     | 
| 
       182 
     | 
    
         
            -
                <li><a href="../../MIDI/Stop.html">MIDI::Stop</a>
         
     | 
| 
       183 
     | 
    
         
            -
              
         
     | 
| 
       184 
     | 
    
         
            -
                <li><a href="../../MIDI/SystemCommon.html">MIDI::SystemCommon</a>
         
     | 
| 
       185 
     | 
    
         
            -
              
         
     | 
| 
       186 
     | 
    
         
            -
                <li><a href="../../MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
         
     | 
| 
       187 
     | 
    
         
            -
              
         
     | 
| 
       188 
     | 
    
         
            -
                <li><a href="../../MIDI/SystemReset.html">MIDI::SystemReset</a>
         
     | 
| 
       189 
     | 
    
         
            -
              
         
     | 
| 
       190 
     | 
    
         
            -
                <li><a href="../../MIDI/Tempo.html">MIDI::Tempo</a>
         
     | 
| 
       191 
     | 
    
         
            -
              
         
     | 
| 
       192 
     | 
    
         
            -
                <li><a href="../../MIDI/TimeSig.html">MIDI::TimeSig</a>
         
     | 
| 
       193 
     | 
    
         
            -
              
         
     | 
| 
       194 
     | 
    
         
            -
                <li><a href="../../MIDI/Track.html">MIDI::Track</a>
         
     | 
| 
       195 
     | 
    
         
            -
              
         
     | 
| 
       196 
     | 
    
         
            -
                <li><a href="../../MIDI/TuneRequest.html">MIDI::TuneRequest</a>
         
     | 
| 
       197 
     | 
    
         
            -
              
         
     | 
| 
       198 
     | 
    
         
            -
                <li><a href="../../MIDI/Utils.html">MIDI::Utils</a>
         
     | 
| 
       199 
     | 
    
         
            -
              
         
     | 
| 
       200 
     | 
    
         
            -
                <li><a href="../../IO.html">IO</a>
         
     | 
| 
       201 
     | 
    
         
            -
              
         
     | 
| 
       202 
     | 
    
         
            -
              </ul>
         
     | 
| 
       203 
     | 
    
         
            -
            </nav>
         
     | 
| 
      
 94 
     | 
    
         
            +
            </div>
         
     | 
| 
       204 
95 
     | 
    
         | 
| 
       205 
96 
     | 
    
         
             
              </div>
         
     | 
| 
       206 
97 
     | 
    
         
             
            </nav>
         
     | 
| 
       207 
98 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
            < 
     | 
| 
       209 
     | 
    
         
            -
              <h1  
     | 
| 
      
 99 
     | 
    
         
            +
            <main role="main" aria-labelledby="class-MIDI::IO::SeqWriter">
         
     | 
| 
      
 100 
     | 
    
         
            +
              <h1 id="class-MIDI::IO::SeqWriter" class="class">
         
     | 
| 
      
 101 
     | 
    
         
            +
                class MIDI::IO::SeqWriter
         
     | 
| 
      
 102 
     | 
    
         
            +
              </h1>
         
     | 
| 
       210 
103 
     | 
    
         | 
| 
       211 
     | 
    
         
            -
              < 
     | 
| 
      
 104 
     | 
    
         
            +
              <section class="description">
         
     | 
| 
       212 
105 
     | 
    
         | 
| 
       213 
     | 
    
         
            -
              </ 
     | 
| 
      
 106 
     | 
    
         
            +
              </section>
         
     | 
| 
       214 
107 
     | 
    
         | 
| 
       215 
108 
     | 
    
         | 
| 
       216 
109 
     | 
    
         | 
| 
         @@ -224,10 +117,11 @@ 
     | 
|
| 
       224 
117 
     | 
    
         | 
| 
       225 
118 
     | 
    
         | 
| 
       226 
119 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
                <!-- Methods -->
         
     | 
| 
       228 
120 
     | 
    
         | 
| 
       229 
     | 
    
         
            -
                 <section id="public-class-5Buntitled-5D-method-details" class="method-section 
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
      
 121 
     | 
    
         
            +
                 <section id="public-class-5Buntitled-5D-method-details" class="method-section">
         
     | 
| 
      
 122 
     | 
    
         
            +
                   <header>
         
     | 
| 
      
 123 
     | 
    
         
            +
                     <h3>Public Class Methods</h3>
         
     | 
| 
      
 124 
     | 
    
         
            +
                   </header>
         
     | 
| 
       231 
125 
     | 
    
         | 
| 
       232 
126 
     | 
    
         | 
| 
       233 
127 
     | 
    
         
             
                  <div id="method-c-new" class="method-detail ">
         
     | 
| 
         @@ -235,7 +129,9 @@ 
     | 
|
| 
       235 
129 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       236 
130 
     | 
    
         
             
                      <span class="method-name">new</span><span
         
     | 
| 
       237 
131 
     | 
    
         
             
                        class="method-args">(seq, proc = nil) { |num_tracks, index| ... }</span>
         
     | 
| 
      
 132 
     | 
    
         
            +
                      
         
     | 
| 
       238 
133 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 134 
     | 
    
         
            +
                      
         
     | 
| 
       239 
135 
     | 
    
         
             
                    </div>
         
     | 
| 
       240 
136 
     | 
    
         | 
| 
       241 
137 
     | 
    
         | 
| 
         @@ -243,28 +139,31 @@ 
     | 
|
| 
       243 
139 
     | 
    
         | 
| 
       244 
140 
     | 
    
         | 
| 
       245 
141 
     | 
    
         | 
| 
      
 142 
     | 
    
         
            +
                      
         
     | 
| 
       246 
143 
     | 
    
         | 
| 
       247 
144 
     | 
    
         | 
| 
       248 
145 
     | 
    
         
             
                      <div class="method-source-code" id="new-source">
         
     | 
| 
       249 
146 
     | 
    
         
             
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 12</span>
         
     | 
| 
       250 
147 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">seq</span>, <span class="ruby-identifier">proc</span> = <span class="ruby-keyword">nil</span>) <span class="ruby-comment"># :yields: num_tracks, index</span>
         
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
      
 148 
     | 
    
         
            +
              <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span>
         
     | 
| 
      
 149 
     | 
    
         
            +
              <span class="ruby-ivar">@update_block</span> = <span class="ruby-identifier">block_given?</span>() <span class="ruby-operator">?</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>() <span class="ruby-operator">:</span> <span class="ruby-identifier">proc</span>
         
     | 
| 
       253 
150 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       254 
     | 
    
         
            -
                      </div 
     | 
| 
      
 151 
     | 
    
         
            +
                      </div>
         
     | 
| 
       255 
152 
     | 
    
         | 
| 
       256 
153 
     | 
    
         
             
                    </div>
         
     | 
| 
       257 
154 
     | 
    
         | 
| 
       258 
155 
     | 
    
         | 
| 
       259 
156 
     | 
    
         | 
| 
       260 
157 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
                  </div 
     | 
| 
      
 158 
     | 
    
         
            +
                  </div>
         
     | 
| 
       262 
159 
     | 
    
         | 
| 
       263 
160 
     | 
    
         | 
| 
       264 
     | 
    
         
            -
                </section 
     | 
| 
      
 161 
     | 
    
         
            +
                </section>
         
     | 
| 
       265 
162 
     | 
    
         | 
| 
       266 
     | 
    
         
            -
                 <section id="public-instance-5Buntitled-5D-method-details" class="method-section 
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
      
 163 
     | 
    
         
            +
                 <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
         
     | 
| 
      
 164 
     | 
    
         
            +
                   <header>
         
     | 
| 
      
 165 
     | 
    
         
            +
                     <h3>Public Instance Methods</h3>
         
     | 
| 
      
 166 
     | 
    
         
            +
                   </header>
         
     | 
| 
       268 
167 
     | 
    
         | 
| 
       269 
168 
     | 
    
         | 
| 
       270 
169 
     | 
    
         
             
                  <div id="method-i-possibly_munge_due_to_running_status_byte" class="method-detail ">
         
     | 
| 
         @@ -272,7 +171,9 @@ 
     | 
|
| 
       272 
171 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       273 
172 
     | 
    
         
             
                      <span class="method-name">possibly_munge_due_to_running_status_byte</span><span
         
     | 
| 
       274 
173 
     | 
    
         
             
                        class="method-args">(data, prev_status)</span>
         
     | 
| 
      
 174 
     | 
    
         
            +
                      
         
     | 
| 
       275 
175 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 176 
     | 
    
         
            +
                      
         
     | 
| 
       276 
177 
     | 
    
         
             
                    </div>
         
     | 
| 
       277 
178 
     | 
    
         | 
| 
       278 
179 
     | 
    
         | 
| 
         @@ -282,52 +183,53 @@ 
     | 
|
| 
       282 
183 
     | 
    
         
             
            data. Return the status to remember for next time as the running status
         
     | 
| 
       283 
184 
     | 
    
         
             
            byte for this event.</p>
         
     | 
| 
       284 
185 
     | 
    
         | 
| 
      
 186 
     | 
    
         
            +
                      
         
     | 
| 
       285 
187 
     | 
    
         | 
| 
       286 
188 
     | 
    
         | 
| 
       287 
189 
     | 
    
         
             
                      <div class="method-source-code" id="possibly_munge_due_to_running_status_byte-source">
         
     | 
| 
       288 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 190 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 79</span>
         
     | 
| 
       289 
191 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">possibly_munge_due_to_running_status_byte</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">prev_status</span>)
         
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
             
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
             
     | 
| 
       314 
     | 
    
         
            -
                    <span class="ruby-keyword">else</span>
         
     | 
| 
       315 
     | 
    
         
            -
                        <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">status</span>
         
     | 
| 
       316 
     | 
    
         
            -
                    <span class="ruby-keyword">end</span>
         
     | 
| 
       317 
     | 
    
         
            -
                    <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span>
         
     | 
| 
      
 192 
     | 
    
         
            +
              <span class="ruby-identifier">status</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>]
         
     | 
| 
      
 193 
     | 
    
         
            +
              <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0xf0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">prev_status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0xf0</span>
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
              <span class="ruby-identifier">chan</span> = (<span class="ruby-identifier">status</span> <span class="ruby-operator">&</span> <span class="ruby-value">0x0f</span>)
         
     | 
| 
      
 196 
     | 
    
         
            +
              <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">chan</span> <span class="ruby-operator">!=</span> (<span class="ruby-identifier">prev_status</span> <span class="ruby-operator">&</span> <span class="ruby-value">0x0f</span>)
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
              <span class="ruby-identifier">status</span> = (<span class="ruby-identifier">status</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xf0</span>)
         
     | 
| 
      
 199 
     | 
    
         
            +
              <span class="ruby-identifier">prev_status</span> = (<span class="ruby-identifier">prev_status</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xf0</span>)
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              <span class="ruby-comment"># Both events are on the same channel. If the two status bytes are</span>
         
     | 
| 
      
 202 
     | 
    
         
            +
              <span class="ruby-comment"># exactly the same, the rest is trivial. If it's note on/note off,</span>
         
     | 
| 
      
 203 
     | 
    
         
            +
              <span class="ruby-comment"># we can combine those further.</span>
         
     | 
| 
      
 204 
     | 
    
         
            +
              <span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">prev_status</span>
         
     | 
| 
      
 205 
     | 
    
         
            +
                <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] = []        <span class="ruby-comment"># delete status byte from data</span>
         
     | 
| 
      
 206 
     | 
    
         
            +
                <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chan</span>
         
     | 
| 
      
 207 
     | 
    
         
            +
              <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-constant">NOTE_OFF</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-value">64</span>
         
     | 
| 
      
 208 
     | 
    
         
            +
                <span class="ruby-comment"># If we see a note off and the velocity is 64, we can store</span>
         
     | 
| 
      
 209 
     | 
    
         
            +
                <span class="ruby-comment"># a note on with a velocity of 0. If the velocity isn't 64</span>
         
     | 
| 
      
 210 
     | 
    
         
            +
                <span class="ruby-comment"># then storing a note on would be bad because the would be</span>
         
     | 
| 
      
 211 
     | 
    
         
            +
                <span class="ruby-comment"># changed to 64 when reading the file back in.</span>
         
     | 
| 
      
 212 
     | 
    
         
            +
                <span class="ruby-identifier">data</span>[<span class="ruby-value">2</span>] = <span class="ruby-value">0</span>           <span class="ruby-comment"># set vel to 0; do before possible shrinking</span>
         
     | 
| 
      
 213 
     | 
    
         
            +
                <span class="ruby-identifier">status</span> = <span class="ruby-constant">NOTE_ON</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chan</span>
         
     | 
| 
      
 214 
     | 
    
         
            +
                <span class="ruby-keyword">if</span> <span class="ruby-identifier">prev_status</span> <span class="ruby-operator">==</span> <span class="ruby-constant">NOTE_ON</span>
         
     | 
| 
      
 215 
     | 
    
         
            +
                  <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] = []      <span class="ruby-comment"># delete status byte</span>
         
     | 
| 
       318 
216 
     | 
    
         
             
                <span class="ruby-keyword">else</span>
         
     | 
| 
       319 
     | 
    
         
            -
             
     | 
| 
       320 
     | 
    
         
            -
                    <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chan</span>
         
     | 
| 
      
 217 
     | 
    
         
            +
                  <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">status</span>
         
     | 
| 
       321 
218 
     | 
    
         
             
                <span class="ruby-keyword">end</span>
         
     | 
| 
      
 219 
     | 
    
         
            +
                <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span>
         
     | 
| 
      
 220 
     | 
    
         
            +
              <span class="ruby-keyword">else</span>
         
     | 
| 
      
 221 
     | 
    
         
            +
                <span class="ruby-comment"># Can't compress data</span>
         
     | 
| 
      
 222 
     | 
    
         
            +
                <span class="ruby-keyword">return</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">chan</span>
         
     | 
| 
      
 223 
     | 
    
         
            +
              <span class="ruby-keyword">end</span>
         
     | 
| 
       322 
224 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       323 
     | 
    
         
            -
                      </div 
     | 
| 
      
 225 
     | 
    
         
            +
                      </div>
         
     | 
| 
       324 
226 
     | 
    
         | 
| 
       325 
227 
     | 
    
         
             
                    </div>
         
     | 
| 
       326 
228 
     | 
    
         | 
| 
       327 
229 
     | 
    
         | 
| 
       328 
230 
     | 
    
         | 
| 
       329 
231 
     | 
    
         | 
| 
       330 
     | 
    
         
            -
                  </div 
     | 
| 
      
 232 
     | 
    
         
            +
                  </div>
         
     | 
| 
       331 
233 
     | 
    
         | 
| 
       332 
234 
     | 
    
         | 
| 
       333 
235 
     | 
    
         
             
                  <div id="method-i-write16" class="method-detail ">
         
     | 
| 
         @@ -335,7 +237,9 @@ byte for this event.</p> 
     | 
|
| 
       335 
237 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       336 
238 
     | 
    
         
             
                      <span class="method-name">write16</span><span
         
     | 
| 
       337 
239 
     | 
    
         
             
                        class="method-args">(val)</span>
         
     | 
| 
      
 240 
     | 
    
         
            +
                      
         
     | 
| 
       338 
241 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 242 
     | 
    
         
            +
                      
         
     | 
| 
       339 
243 
     | 
    
         
             
                    </div>
         
     | 
| 
       340 
244 
     | 
    
         | 
| 
       341 
245 
     | 
    
         | 
| 
         @@ -343,26 +247,27 @@ byte for this event.</p> 
     | 
|
| 
       343 
247 
     | 
    
         | 
| 
       344 
248 
     | 
    
         | 
| 
       345 
249 
     | 
    
         | 
| 
      
 250 
     | 
    
         
            +
                      
         
     | 
| 
       346 
251 
     | 
    
         | 
| 
       347 
252 
     | 
    
         | 
| 
       348 
253 
     | 
    
         
             
                      <div class="method-source-code" id="write16-source">
         
     | 
| 
       349 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 254 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 126</span>
         
     | 
| 
       350 
255 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write16</span>(<span class="ruby-identifier">val</span>)
         
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
      
 256 
     | 
    
         
            +
              <span class="ruby-identifier">val</span> = (<span class="ruby-operator">-</span><span class="ruby-identifier">val</span> <span class="ruby-operator">|</span> <span class="ruby-value">0x8000</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
         
     | 
| 
       352 
257 
     | 
    
         | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
             
     | 
| 
       355 
     | 
    
         
            -
             
     | 
| 
       356 
     | 
    
         
            -
             
     | 
| 
      
 258 
     | 
    
         
            +
              <span class="ruby-identifier">buffer</span> = []
         
     | 
| 
      
 259 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>((<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 260 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>(<span class="ruby-identifier">val</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 261 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-value">2</span>
         
     | 
| 
       357 
262 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       358 
     | 
    
         
            -
                      </div 
     | 
| 
      
 263 
     | 
    
         
            +
                      </div>
         
     | 
| 
       359 
264 
     | 
    
         | 
| 
       360 
265 
     | 
    
         
             
                    </div>
         
     | 
| 
       361 
266 
     | 
    
         | 
| 
       362 
267 
     | 
    
         | 
| 
       363 
268 
     | 
    
         | 
| 
       364 
269 
     | 
    
         | 
| 
       365 
     | 
    
         
            -
                  </div 
     | 
| 
      
 270 
     | 
    
         
            +
                  </div>
         
     | 
| 
       366 
271 
     | 
    
         | 
| 
       367 
272 
     | 
    
         | 
| 
       368 
273 
     | 
    
         
             
                  <div id="method-i-write32" class="method-detail ">
         
     | 
| 
         @@ -370,7 +275,9 @@ byte for this event.</p> 
     | 
|
| 
       370 
275 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       371 
276 
     | 
    
         
             
                      <span class="method-name">write32</span><span
         
     | 
| 
       372 
277 
     | 
    
         
             
                        class="method-args">(val)</span>
         
     | 
| 
      
 278 
     | 
    
         
            +
                      
         
     | 
| 
       373 
279 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 280 
     | 
    
         
            +
                      
         
     | 
| 
       374 
281 
     | 
    
         
             
                    </div>
         
     | 
| 
       375 
282 
     | 
    
         | 
| 
       376 
283 
     | 
    
         | 
| 
         @@ -378,27 +285,28 @@ byte for this event.</p> 
     | 
|
| 
       378 
285 
     | 
    
         | 
| 
       379 
286 
     | 
    
         | 
| 
       380 
287 
     | 
    
         | 
| 
      
 288 
     | 
    
         
            +
                      
         
     | 
| 
       381 
289 
     | 
    
         | 
| 
       382 
290 
     | 
    
         | 
| 
       383 
291 
     | 
    
         
             
                      <div class="method-source-code" id="write32-source">
         
     | 
| 
       384 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 292 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 135</span>
         
     | 
| 
       385 
293 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write32</span>(<span class="ruby-identifier">val</span>)
         
     | 
| 
       386 
     | 
    
         
            -
             
     | 
| 
      
 294 
     | 
    
         
            +
              <span class="ruby-identifier">val</span> = (<span class="ruby-operator">-</span><span class="ruby-identifier">val</span> <span class="ruby-operator">|</span> <span class="ruby-value">0x80000000</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
         
     | 
| 
       387 
295 
     | 
    
         | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
     | 
    
         
            -
             
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
       391 
     | 
    
         
            -
             
     | 
| 
       392 
     | 
    
         
            -
             
     | 
| 
      
 296 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>((<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 297 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>((<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 298 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>((<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 299 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>(<span class="ruby-identifier">val</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>)
         
     | 
| 
      
 300 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-value">4</span>
         
     | 
| 
       393 
301 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       394 
     | 
    
         
            -
                      </div 
     | 
| 
      
 302 
     | 
    
         
            +
                      </div>
         
     | 
| 
       395 
303 
     | 
    
         | 
| 
       396 
304 
     | 
    
         
             
                    </div>
         
     | 
| 
       397 
305 
     | 
    
         | 
| 
       398 
306 
     | 
    
         | 
| 
       399 
307 
     | 
    
         | 
| 
       400 
308 
     | 
    
         | 
| 
       401 
     | 
    
         
            -
                  </div 
     | 
| 
      
 309 
     | 
    
         
            +
                  </div>
         
     | 
| 
       402 
310 
     | 
    
         | 
| 
       403 
311 
     | 
    
         | 
| 
       404 
312 
     | 
    
         
             
                  <div id="method-i-write_bytes" class="method-detail ">
         
     | 
| 
         @@ -406,7 +314,9 @@ byte for this event.</p> 
     | 
|
| 
       406 
314 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       407 
315 
     | 
    
         
             
                      <span class="method-name">write_bytes</span><span
         
     | 
| 
       408 
316 
     | 
    
         
             
                        class="method-args">(bytes)</span>
         
     | 
| 
      
 317 
     | 
    
         
            +
                      
         
     | 
| 
       409 
318 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 319 
     | 
    
         
            +
                      
         
     | 
| 
       410 
320 
     | 
    
         
             
                    </div>
         
     | 
| 
       411 
321 
     | 
    
         | 
| 
       412 
322 
     | 
    
         | 
| 
         @@ -414,22 +324,23 @@ byte for this event.</p> 
     | 
|
| 
       414 
324 
     | 
    
         | 
| 
       415 
325 
     | 
    
         | 
| 
       416 
326 
     | 
    
         | 
| 
      
 327 
     | 
    
         
            +
                      
         
     | 
| 
       417 
328 
     | 
    
         | 
| 
       418 
329 
     | 
    
         | 
| 
       419 
330 
     | 
    
         
             
                      <div class="method-source-code" id="write_bytes-source">
         
     | 
| 
       420 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 331 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 145</span>
         
     | 
| 
       421 
332 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">bytes</span>)
         
     | 
| 
       422 
     | 
    
         
            -
             
     | 
| 
       423 
     | 
    
         
            -
             
     | 
| 
      
 333 
     | 
    
         
            +
              <span class="ruby-identifier">bytes</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">putc</span>(<span class="ruby-identifier">b</span>) }
         
     | 
| 
      
 334 
     | 
    
         
            +
              <span class="ruby-identifier">bytes</span>.<span class="ruby-identifier">length</span>
         
     | 
| 
       424 
335 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       425 
     | 
    
         
            -
                      </div 
     | 
| 
      
 336 
     | 
    
         
            +
                      </div>
         
     | 
| 
       426 
337 
     | 
    
         | 
| 
       427 
338 
     | 
    
         
             
                    </div>
         
     | 
| 
       428 
339 
     | 
    
         | 
| 
       429 
340 
     | 
    
         | 
| 
       430 
341 
     | 
    
         | 
| 
       431 
342 
     | 
    
         | 
| 
       432 
     | 
    
         
            -
                  </div 
     | 
| 
      
 343 
     | 
    
         
            +
                  </div>
         
     | 
| 
       433 
344 
     | 
    
         | 
| 
       434 
345 
     | 
    
         | 
| 
       435 
346 
     | 
    
         
             
                  <div id="method-i-write_header" class="method-detail ">
         
     | 
| 
         @@ -437,7 +348,9 @@ byte for this event.</p> 
     | 
|
| 
       437 
348 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       438 
349 
     | 
    
         
             
                      <span class="method-name">write_header</span><span
         
     | 
| 
       439 
350 
     | 
    
         
             
                        class="method-args">()</span>
         
     | 
| 
      
 351 
     | 
    
         
            +
                      
         
     | 
| 
       440 
352 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 353 
     | 
    
         
            +
                      
         
     | 
| 
       441 
354 
     | 
    
         
             
                    </div>
         
     | 
| 
       442 
355 
     | 
    
         | 
| 
       443 
356 
     | 
    
         | 
| 
         @@ -445,25 +358,26 @@ byte for this event.</p> 
     | 
|
| 
       445 
358 
     | 
    
         | 
| 
       446 
359 
     | 
    
         | 
| 
       447 
360 
     | 
    
         | 
| 
      
 361 
     | 
    
         
            +
                      
         
     | 
| 
       448 
362 
     | 
    
         | 
| 
       449 
363 
     | 
    
         | 
| 
       450 
364 
     | 
    
         
             
                      <div class="method-source-code" id="write_header-source">
         
     | 
| 
       451 
365 
     | 
    
         
             
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 29</span>
         
     | 
| 
       452 
366 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_header</span>
         
     | 
| 
       453 
     | 
    
         
            -
             
     | 
| 
       454 
     | 
    
         
            -
             
     | 
| 
       455 
     | 
    
         
            -
             
     | 
| 
       456 
     | 
    
         
            -
             
     | 
| 
       457 
     | 
    
         
            -
             
     | 
| 
      
 367 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">'MThd'</span>
         
     | 
| 
      
 368 
     | 
    
         
            +
              <span class="ruby-identifier">write32</span>(<span class="ruby-value">6</span>)
         
     | 
| 
      
 369 
     | 
    
         
            +
              <span class="ruby-identifier">write16</span>(<span class="ruby-value">1</span>)             <span class="ruby-comment"># Ignore sequence format; write as format 1</span>
         
     | 
| 
      
 370 
     | 
    
         
            +
              <span class="ruby-identifier">write16</span>(<span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">length</span>)
         
     | 
| 
      
 371 
     | 
    
         
            +
              <span class="ruby-identifier">write16</span>(<span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">ppqn</span>)
         
     | 
| 
       458 
372 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       459 
     | 
    
         
            -
                      </div 
     | 
| 
      
 373 
     | 
    
         
            +
                      </div>
         
     | 
| 
       460 
374 
     | 
    
         | 
| 
       461 
375 
     | 
    
         
             
                    </div>
         
     | 
| 
       462 
376 
     | 
    
         | 
| 
       463 
377 
     | 
    
         | 
| 
       464 
378 
     | 
    
         | 
| 
       465 
379 
     | 
    
         | 
| 
       466 
     | 
    
         
            -
                  </div 
     | 
| 
      
 380 
     | 
    
         
            +
                  </div>
         
     | 
| 
       467 
381 
     | 
    
         | 
| 
       468 
382 
     | 
    
         | 
| 
       469 
383 
     | 
    
         
             
                  <div id="method-i-write_instrument" class="method-detail ">
         
     | 
| 
         @@ -471,7 +385,9 @@ byte for this event.</p> 
     | 
|
| 
       471 
385 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       472 
386 
     | 
    
         
             
                      <span class="method-name">write_instrument</span><span
         
     | 
| 
       473 
387 
     | 
    
         
             
                        class="method-args">(instrument)</span>
         
     | 
| 
      
 388 
     | 
    
         
            +
                      
         
     | 
| 
       474 
389 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 390 
     | 
    
         
            +
                      
         
     | 
| 
       475 
391 
     | 
    
         
             
                    </div>
         
     | 
| 
       476 
392 
     | 
    
         | 
| 
       477 
393 
     | 
    
         | 
| 
         @@ -479,24 +395,25 @@ byte for this event.</p> 
     | 
|
| 
       479 
395 
     | 
    
         | 
| 
       480 
396 
     | 
    
         | 
| 
       481 
397 
     | 
    
         | 
| 
      
 398 
     | 
    
         
            +
                      
         
     | 
| 
       482 
399 
     | 
    
         | 
| 
       483 
400 
     | 
    
         | 
| 
       484 
401 
     | 
    
         
             
                      <div class="method-source-code" id="write_instrument-source">
         
     | 
| 
       485 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 402 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 114</span>
         
     | 
| 
       486 
403 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_instrument</span>(<span class="ruby-identifier">instrument</span>)
         
     | 
| 
       487 
     | 
    
         
            -
             
     | 
| 
       488 
     | 
    
         
            -
             
     | 
| 
       489 
     | 
    
         
            -
             
     | 
| 
       490 
     | 
    
         
            -
             
     | 
| 
      
 404 
     | 
    
         
            +
              <span class="ruby-identifier">event</span> = <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_INSTRUMENT</span>, <span class="ruby-identifier">instrument</span>)
         
     | 
| 
      
 405 
     | 
    
         
            +
              <span class="ruby-identifier">write_var_len</span>(<span class="ruby-value">0</span>)
         
     | 
| 
      
 406 
     | 
    
         
            +
              <span class="ruby-identifier">data</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data_as_bytes</span>()
         
     | 
| 
      
 407 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">data</span>)
         
     | 
| 
       491 
408 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       492 
     | 
    
         
            -
                      </div 
     | 
| 
      
 409 
     | 
    
         
            +
                      </div>
         
     | 
| 
       493 
410 
     | 
    
         | 
| 
       494 
411 
     | 
    
         
             
                    </div>
         
     | 
| 
       495 
412 
     | 
    
         | 
| 
       496 
413 
     | 
    
         | 
| 
       497 
414 
     | 
    
         | 
| 
       498 
415 
     | 
    
         | 
| 
       499 
     | 
    
         
            -
                  </div 
     | 
| 
      
 416 
     | 
    
         
            +
                  </div>
         
     | 
| 
       500 
417 
     | 
    
         | 
| 
       501 
418 
     | 
    
         | 
| 
       502 
419 
     | 
    
         
             
                  <div id="method-i-write_to" class="method-detail ">
         
     | 
| 
         @@ -504,7 +421,9 @@ byte for this event.</p> 
     | 
|
| 
       504 
421 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       505 
422 
     | 
    
         
             
                      <span class="method-name">write_to</span><span
         
     | 
| 
       506 
423 
     | 
    
         
             
                        class="method-args">(io)</span>
         
     | 
| 
      
 424 
     | 
    
         
            +
                      
         
     | 
| 
       507 
425 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 426 
     | 
    
         
            +
                      
         
     | 
| 
       508 
427 
     | 
    
         
             
                    </div>
         
     | 
| 
       509 
428 
     | 
    
         | 
| 
       510 
429 
     | 
    
         | 
| 
         @@ -512,28 +431,29 @@ byte for this event.</p> 
     | 
|
| 
       512 
431 
     | 
    
         | 
| 
       513 
432 
     | 
    
         
             
                      <p>Writes a <a href="../MIDI.html">MIDI</a> format 1 file.</p>
         
     | 
| 
       514 
433 
     | 
    
         | 
| 
      
 434 
     | 
    
         
            +
                      
         
     | 
| 
       515 
435 
     | 
    
         | 
| 
       516 
436 
     | 
    
         | 
| 
       517 
437 
     | 
    
         
             
                      <div class="method-source-code" id="write_to-source">
         
     | 
| 
       518 
438 
     | 
    
         
             
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 18</span>
         
     | 
| 
       519 
439 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_to</span>(<span class="ruby-identifier">io</span>)
         
     | 
| 
       520 
     | 
    
         
            -
             
     | 
| 
       521 
     | 
    
         
            -
             
     | 
| 
       522 
     | 
    
         
            -
             
     | 
| 
       523 
     | 
    
         
            -
             
     | 
| 
       524 
     | 
    
         
            -
             
     | 
| 
       525 
     | 
    
         
            -
             
     | 
| 
       526 
     | 
    
         
            -
             
     | 
| 
       527 
     | 
    
         
            -
             
     | 
| 
      
 440 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span> = <span class="ruby-identifier">io</span>
         
     | 
| 
      
 441 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> = <span class="ruby-value">0</span>
         
     | 
| 
      
 442 
     | 
    
         
            +
              <span class="ruby-identifier">write_header</span>()
         
     | 
| 
      
 443 
     | 
    
         
            +
              <span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">0</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
         
     | 
| 
      
 444 
     | 
    
         
            +
              <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">track</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
         
     | 
| 
      
 445 
     | 
    
         
            +
                <span class="ruby-identifier">write_track</span>(<span class="ruby-identifier">track</span>)
         
     | 
| 
      
 446 
     | 
    
         
            +
                <span class="ruby-ivar">@update_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">track</span>, <span class="ruby-ivar">@seq</span>.<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">length</span>, <span class="ruby-identifier">i</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@update_block</span>
         
     | 
| 
      
 447 
     | 
    
         
            +
              <span class="ruby-keyword">end</span>
         
     | 
| 
       528 
448 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       529 
     | 
    
         
            -
                      </div 
     | 
| 
      
 449 
     | 
    
         
            +
                      </div>
         
     | 
| 
       530 
450 
     | 
    
         | 
| 
       531 
451 
     | 
    
         
             
                    </div>
         
     | 
| 
       532 
452 
     | 
    
         | 
| 
       533 
453 
     | 
    
         | 
| 
       534 
454 
     | 
    
         | 
| 
       535 
455 
     | 
    
         | 
| 
       536 
     | 
    
         
            -
                  </div 
     | 
| 
      
 456 
     | 
    
         
            +
                  </div>
         
     | 
| 
       537 
457 
     | 
    
         | 
| 
       538 
458 
     | 
    
         | 
| 
       539 
459 
     | 
    
         
             
                  <div id="method-i-write_track" class="method-detail ">
         
     | 
| 
         @@ -541,7 +461,9 @@ byte for this event.</p> 
     | 
|
| 
       541 
461 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       542 
462 
     | 
    
         
             
                      <span class="method-name">write_track</span><span
         
     | 
| 
       543 
463 
     | 
    
         
             
                        class="method-args">(track)</span>
         
     | 
| 
      
 464 
     | 
    
         
            +
                      
         
     | 
| 
       544 
465 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 466 
     | 
    
         
            +
                      
         
     | 
| 
       545 
467 
     | 
    
         
             
                    </div>
         
     | 
| 
       546 
468 
     | 
    
         | 
| 
       547 
469 
     | 
    
         | 
| 
         @@ -549,57 +471,57 @@ byte for this event.</p> 
     | 
|
| 
       549 
471 
     | 
    
         | 
| 
       550 
472 
     | 
    
         | 
| 
       551 
473 
     | 
    
         | 
| 
      
 474 
     | 
    
         
            +
                      
         
     | 
| 
       552 
475 
     | 
    
         | 
| 
       553 
476 
     | 
    
         | 
| 
       554 
477 
     | 
    
         
             
                      <div class="method-source-code" id="write_track-source">
         
     | 
| 
       555 
478 
     | 
    
         
             
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 37</span>
         
     | 
| 
       556 
479 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_track</span>(<span class="ruby-identifier">track</span>)
         
     | 
| 
       557 
     | 
    
         
            -
             
     | 
| 
       558 
     | 
    
         
            -
             
     | 
| 
       559 
     | 
    
         
            -
             
     | 
| 
       560 
     | 
    
         
            -
             
     | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
       562 
     | 
    
         
            -
             
     | 
| 
       563 
     | 
    
         
            -
             
     | 
| 
       564 
     | 
    
         
            -
             
     | 
| 
       565 
     | 
    
         
            -
             
     | 
| 
       566 
     | 
    
         
            -
             
     | 
| 
       567 
     | 
    
         
            -
             
     | 
| 
       568 
     | 
    
         
            -
             
     | 
| 
       569 
     | 
    
         
            -
             
     | 
| 
       570 
     | 
    
         
            -
             
     | 
| 
       571 
     | 
    
         
            -
             
     | 
| 
       572 
     | 
    
         
            -
             
     | 
| 
       573 
     | 
    
         
            -
             
     | 
| 
       574 
     | 
    
         
            -
             
     | 
| 
       575 
     | 
    
         
            -
             
     | 
| 
       576 
     | 
    
         
            -
             
     | 
| 
       577 
     | 
    
         
            -
             
     | 
| 
       578 
     | 
    
         
            -
             
     | 
| 
       579 
     | 
    
         
            -
             
     | 
| 
       580 
     | 
    
         
            -
             
     | 
| 
       581 
     | 
    
         
            -
             
     | 
| 
       582 
     | 
    
         
            -
             
     | 
| 
       583 
     | 
    
         
            -
             
     | 
| 
       584 
     | 
    
         
            -
             
     | 
| 
       585 
     | 
    
         
            -
             
     | 
| 
       586 
     | 
    
         
            -
             
     | 
| 
       587 
     | 
    
         
            -
             
     | 
| 
       588 
     | 
    
         
            -
             
     | 
| 
       589 
     | 
    
         
            -
             
     | 
| 
       590 
     | 
    
         
            -
             
     | 
| 
       591 
     | 
    
         
            -
             
     | 
| 
       592 
     | 
    
         
            -
             
     | 
| 
       593 
     | 
    
         
            -
                <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">seek</span>(<span class="ruby-value">0</span>, <span class="ruby-operator">::</span><span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SEEK_END</span>)
         
     | 
| 
      
 480 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">'MTrk'</span>
         
     | 
| 
      
 481 
     | 
    
         
            +
              <span class="ruby-identifier">track_size_file_pos</span> = <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">tell</span>()
         
     | 
| 
      
 482 
     | 
    
         
            +
              <span class="ruby-identifier">write32</span>(<span class="ruby-value">0</span>)             <span class="ruby-comment"># Dummy byte count; overwritten later</span>
         
     | 
| 
      
 483 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> = <span class="ruby-value">0</span>     <span class="ruby-comment"># Reset after previous write</span>
         
     | 
| 
      
 484 
     | 
    
         
            +
             
     | 
| 
      
 485 
     | 
    
         
            +
              <span class="ruby-identifier">write_instrument</span>(<span class="ruby-identifier">track</span>.<span class="ruby-identifier">instrument</span>)
         
     | 
| 
      
 486 
     | 
    
         
            +
             
     | 
| 
      
 487 
     | 
    
         
            +
              <span class="ruby-identifier">prev_event</span> = <span class="ruby-keyword">nil</span>
         
     | 
| 
      
 488 
     | 
    
         
            +
              <span class="ruby-identifier">prev_status</span> = <span class="ruby-value">0</span>
         
     | 
| 
      
 489 
     | 
    
         
            +
              <span class="ruby-identifier">track</span>.<span class="ruby-identifier">events</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">event</span><span class="ruby-operator">|</span>
         
     | 
| 
      
 490 
     | 
    
         
            +
                <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">event</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Realtime</span>)
         
     | 
| 
      
 491 
     | 
    
         
            +
                  <span class="ruby-identifier">write_var_len</span>(<span class="ruby-identifier">event</span>.<span class="ruby-identifier">delta_time</span>)
         
     | 
| 
      
 492 
     | 
    
         
            +
                <span class="ruby-keyword">end</span>
         
     | 
| 
      
 493 
     | 
    
         
            +
             
     | 
| 
      
 494 
     | 
    
         
            +
                <span class="ruby-identifier">data</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">data_as_bytes</span>()
         
     | 
| 
      
 495 
     | 
    
         
            +
                <span class="ruby-identifier">status</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>] <span class="ruby-comment"># status byte plus channel number, if any</span>
         
     | 
| 
      
 496 
     | 
    
         
            +
             
     | 
| 
      
 497 
     | 
    
         
            +
                <span class="ruby-comment"># running status byte</span>
         
     | 
| 
      
 498 
     | 
    
         
            +
                <span class="ruby-identifier">status</span> = <span class="ruby-identifier">possibly_munge_due_to_running_status_byte</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">prev_status</span>)
         
     | 
| 
      
 499 
     | 
    
         
            +
             
     | 
| 
      
 500 
     | 
    
         
            +
                <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">data</span>)
         
     | 
| 
      
 501 
     | 
    
         
            +
             
     | 
| 
      
 502 
     | 
    
         
            +
                <span class="ruby-identifier">prev_event</span> = <span class="ruby-identifier">event</span>
         
     | 
| 
      
 503 
     | 
    
         
            +
                <span class="ruby-identifier">prev_status</span> = <span class="ruby-identifier">status</span>
         
     | 
| 
      
 504 
     | 
    
         
            +
              <span class="ruby-keyword">end</span>
         
     | 
| 
      
 505 
     | 
    
         
            +
             
     | 
| 
      
 506 
     | 
    
         
            +
              <span class="ruby-comment"># Write track end event.</span>
         
     | 
| 
      
 507 
     | 
    
         
            +
              <span class="ruby-identifier">event</span> = <span class="ruby-constant">MetaEvent</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">META_TRACK_END</span>)
         
     | 
| 
      
 508 
     | 
    
         
            +
              <span class="ruby-identifier">write_var_len</span>(<span class="ruby-value">0</span>)
         
     | 
| 
      
 509 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">event</span>.<span class="ruby-identifier">data_as_bytes</span>())
         
     | 
| 
      
 510 
     | 
    
         
            +
             
     | 
| 
      
 511 
     | 
    
         
            +
              <span class="ruby-comment"># Go back to beginning of track data and write number of bytes,</span>
         
     | 
| 
      
 512 
     | 
    
         
            +
              <span class="ruby-comment"># then come back here to end of file.</span>
         
     | 
| 
      
 513 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">seek</span>(<span class="ruby-identifier">track_size_file_pos</span>)
         
     | 
| 
      
 514 
     | 
    
         
            +
              <span class="ruby-identifier">write32</span>(<span class="ruby-ivar">@bytes_written</span>)
         
     | 
| 
      
 515 
     | 
    
         
            +
              <span class="ruby-ivar">@io</span>.<span class="ruby-identifier">seek</span>(<span class="ruby-value">0</span>, <span class="ruby-operator">::</span><span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-constant">SEEK_END</span>)
         
     | 
| 
       594 
516 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       595 
     | 
    
         
            -
                      </div 
     | 
| 
      
 517 
     | 
    
         
            +
                      </div>
         
     | 
| 
       596 
518 
     | 
    
         | 
| 
       597 
519 
     | 
    
         
             
                    </div>
         
     | 
| 
       598 
520 
     | 
    
         | 
| 
       599 
521 
     | 
    
         | 
| 
       600 
522 
     | 
    
         | 
| 
       601 
523 
     | 
    
         | 
| 
       602 
     | 
    
         
            -
                  </div 
     | 
| 
      
 524 
     | 
    
         
            +
                  </div>
         
     | 
| 
       603 
525 
     | 
    
         | 
| 
       604 
526 
     | 
    
         | 
| 
       605 
527 
     | 
    
         
             
                  <div id="method-i-write_var_len" class="method-detail ">
         
     | 
| 
         @@ -607,7 +529,9 @@ byte for this event.</p> 
     | 
|
| 
       607 
529 
     | 
    
         
             
                    <div class="method-heading">
         
     | 
| 
       608 
530 
     | 
    
         
             
                      <span class="method-name">write_var_len</span><span
         
     | 
| 
       609 
531 
     | 
    
         
             
                        class="method-args">(val)</span>
         
     | 
| 
      
 532 
     | 
    
         
            +
                      
         
     | 
| 
       610 
533 
     | 
    
         
             
                      <span class="method-click-advice">click to toggle source</span>
         
     | 
| 
      
 534 
     | 
    
         
            +
                      
         
     | 
| 
       611 
535 
     | 
    
         
             
                    </div>
         
     | 
| 
       612 
536 
     | 
    
         | 
| 
       613 
537 
     | 
    
         | 
| 
         @@ -615,34 +539,34 @@ byte for this event.</p> 
     | 
|
| 
       615 
539 
     | 
    
         | 
| 
       616 
540 
     | 
    
         | 
| 
       617 
541 
     | 
    
         | 
| 
      
 542 
     | 
    
         
            +
                      
         
     | 
| 
       618 
543 
     | 
    
         | 
| 
       619 
544 
     | 
    
         | 
| 
       620 
545 
     | 
    
         
             
                      <div class="method-source-code" id="write_var_len-source">
         
     | 
| 
       621 
     | 
    
         
            -
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line  
     | 
| 
      
 546 
     | 
    
         
            +
                        <pre><span class="ruby-comment"># File lib/midilib/io/seqwriter.rb, line 121</span>
         
     | 
| 
       622 
547 
     | 
    
         
             
            <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_var_len</span>(<span class="ruby-identifier">val</span>)
         
     | 
| 
       623 
     | 
    
         
            -
             
     | 
| 
       624 
     | 
    
         
            -
             
     | 
| 
      
 548 
     | 
    
         
            +
              <span class="ruby-identifier">buffer</span> = <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">as_var_len</span>(<span class="ruby-identifier">val</span>)
         
     | 
| 
      
 549 
     | 
    
         
            +
              <span class="ruby-ivar">@bytes_written</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">buffer</span>)
         
     | 
| 
       625 
550 
     | 
    
         
             
            <span class="ruby-keyword">end</span></pre>
         
     | 
| 
       626 
     | 
    
         
            -
                      </div 
     | 
| 
      
 551 
     | 
    
         
            +
                      </div>
         
     | 
| 
       627 
552 
     | 
    
         | 
| 
       628 
553 
     | 
    
         
             
                    </div>
         
     | 
| 
       629 
554 
     | 
    
         | 
| 
       630 
555 
     | 
    
         | 
| 
       631 
556 
     | 
    
         | 
| 
       632 
557 
     | 
    
         | 
| 
       633 
     | 
    
         
            -
                  </div 
     | 
| 
      
 558 
     | 
    
         
            +
                  </div>
         
     | 
| 
       634 
559 
     | 
    
         | 
| 
       635 
560 
     | 
    
         | 
| 
       636 
     | 
    
         
            -
                </section 
     | 
| 
      
 561 
     | 
    
         
            +
                </section>
         
     | 
| 
       637 
562 
     | 
    
         | 
| 
       638 
     | 
    
         
            -
              </section 
     | 
| 
       639 
     | 
    
         
            -
             
     | 
| 
       640 
     | 
    
         
            -
            </div><!-- documentation -->
         
     | 
| 
      
 563 
     | 
    
         
            +
              </section>
         
     | 
| 
      
 564 
     | 
    
         
            +
            </main>
         
     | 
| 
       641 
565 
     | 
    
         | 
| 
       642 
566 
     | 
    
         | 
| 
       643 
     | 
    
         
            -
            <footer id="validator-badges">
         
     | 
| 
       644 
     | 
    
         
            -
              <p><a href="http://validator.w3.org/check/referer"> 
     | 
| 
       645 
     | 
    
         
            -
              <p>Generated by <a href=" 
     | 
| 
       646 
     | 
    
         
            -
              <p> 
     | 
| 
      
 567 
     | 
    
         
            +
            <footer id="validator-badges" role="contentinfo">
         
     | 
| 
      
 568 
     | 
    
         
            +
              <p><a href="http://validator.w3.org/check/referer">Validate</a>
         
     | 
| 
      
 569 
     | 
    
         
            +
              <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
         
     | 
| 
      
 570 
     | 
    
         
            +
              <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
         
     | 
| 
       647 
571 
     | 
    
         
             
            </footer>
         
     | 
| 
       648 
572 
     | 
    
         |