Class MIDI::IO::SeqReader
In: lib/midilib/io/seqreader.rb
Parent: MIDIFile

Reads MIDI files. As a subclass of MIDIFile, this class implements the callback methods for each MIDI event and use them to build Track and Event objects and give the tracks to a Sequence.

We append new events to the end of a track‘s event list, bypassing a call to Track.add. This means that we must call Track.recalc_times at the end of the track so it can update each event with its time from the track‘s start (see end_track below).

META_TRACK_END events are not added to tracks. This way, we don‘t have to worry about making sure the last event is always a track end event. We rely on the SeqWriter to append a META_TRACK_END event to each track when it is output.

Methods

Public Class methods

The optional proc block is called once at the start of the file and again at the end of each track. There are three arguments to the block: the track, the track number (1 through n), and the total number of tracks.

Public Instance methods

     def smpte(hour, min, sec, frame, fract)
     end

++

     def sequence_number(num)
     end

++

— Don‘t bother adding the META_TRACK_END event to the track. This way, we don‘t have to worry about always making sure the last event is always a track end event. We just have to make sure to write one when the track is output back to a file.

      def eot()
          @track.events << MetaEvent.new(META_TRACK_END, nil, @curr_ticks)
      end

++

Return true if the current track uses the specified channel.

[Validate]