Package midi :: Class MetaEvent
[hide private]
[frames] | no frames]

Class MetaEvent

source code

object --+    
         |    
     Event --+
             |
            MetaEvent
Known Subclasses:

MetaEvent is a special subclass of Event that is not meant to be used as a concrete class. It defines a subset of Events known as the Meta events.

Nested Classes [hide private]

Inherited from Event: __metaclass__

Instance Methods [hide private]
 
encode(self, last_tick=0, running=False)
Produces an encoding of this event for writing to a MIDI stream.
source code
 
decode(self, tick, command, track)
Reads MIDI data from the track stream, from which the tick and status message have already been read.
source code

Inherited from Event: __cmp__, __init__, __str__, adjust_msdelay, copy, decode_data, encode_data, encode_delta_tick

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
is_event(cls, statusmsg)
Checks whether this is of an event identified by the given status message.
source code
 
is_meta_event(cls, metacmd) source code
Class Variables [hide private]
  statusmsg = 255
  metacommand = 0
  name = 'Meta Event'
  allow_running = False
  data = ''
Raw data to store in the event

Inherited from Event: length

Instance Variables [hide private]

Inherited from Event: channel, msdelay, order, tick, track, type

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

is_event(cls, statusmsg)
Class Method

source code 

Checks whether this is of an event identified by the given status message.

Overrides: Event.is_event
(inherited documentation)

encode(self, last_tick=0, running=False)

source code 

Produces an encoding of this event for writing to a MIDI stream. Includes the delta and status message.

Parameters:
  • last_tick - tick value of the previous event that was encoded in the stream. The timing of this event will be stored as a delta, so we need to know when the last thing happened.
  • running - omits the status message if true, since it is assumed that the status is carried over from the previous event.
Overrides: Event.encode
(inherited documentation)

decode(self, tick, command, track)

source code 

Reads MIDI data from the track stream, from which the tick and status message have already been read. Removes as many bytes from the track as this event type needs. Sets instance variables according to data read from the stream.

Parameters:
  • tick - tick time of the event (already read from the stream)
  • statusmsg - the status message that was read from the stream for this event. This is expected to be of the correct type for this event type.
  • track - data stream from which to continue reading as much data as is needed for this event.
  • runningstatus - if this event had a running status in the input stream, the byte that was read off the stream to try to get a status for this event (which turned out not to be a status message) goes in here and gets treated as the first byte of the data.
Overrides: Event.decode
(inherited documentation)