示例#1
0
 def system_exclusive(self, data):
     """
     data: list of values in range(128)
     """
     sysex_len = writeVar(len(data) + 1)
     self.event_slice(
         chr(SYSTEM_EXCLUSIVE) + sysex_len + data + chr(END_OFF_EXCLUSIVE))
示例#2
0
    def system_exclusive(self, data):

        """
        data: list of values in range(128)
        """
        sysex_len = writeVar(len(data)+1)
        self.event_slice(chr(SYSTEM_EXCLUSIVE) + sysex_len + data + chr(END_OFF_EXCLUSIVE))
示例#3
0
    def meta_slice(self, meta_type, data_slice):
        """
        Writes a meta event. Whatever that is.

        Parameters
        ----------
        meta_type :

        data_slice :

        """

        # EDIT: added try / except for debugging purposes! TG
        #        try:
        #            slc = fromBytes([META_EVENT, meta_type]) + \
        #                    writeVar(len(data_slice)) +  data_slice
        #
        #            self.event_slice(slc)
        #        except:
        #            pass

        # Original code:
        slc = fromBytes([META_EVENT, meta_type]) + \
              writeVar(len(data_slice)) + data_slice

        self.event_slice(slc)
示例#4
0
 def meta_slice(self, meta_type, data_slice):
     """
     Writes a meta event
     """
     slc = fromBytes([META_EVENT, meta_type]) + \
                      writeVar(len(data_slice)) +  data_slice
     self.event_slice(slc)
示例#5
0
    def meta_slice(self, meta_type, data_slice):
        """
        Writes a meta event. Whatever that is.

        Parameters
        ----------
        meta_type :

        data_slice :

        """

        # EDIT: added try / except for debugging purposes! TG
#        try:
#            slc = fromBytes([META_EVENT, meta_type]) + \
#                    writeVar(len(data_slice)) +  data_slice
#
#            self.event_slice(slc)
#        except:
#            pass

        # Original code:
        slc = fromBytes([META_EVENT, meta_type]) + \
              writeVar(len(data_slice)) + data_slice

        self.event_slice(slc)
示例#6
0
 def meta_slice(self, meta_type, data_slice):
     """
     Writes a meta event
     """
     slc = fromBytes([META_EVENT, meta_type]) + \
                      writeVar(len(data_slice)) +  data_slice
     self.event_slice(slc)
示例#7
0
 def end_of_track(self):
     """
     Writes the track to the buffer.
     """
     raw = self.raw_out
     raw.writeSlice(TRACK_HEADER)
     track_data = self._current_track_buffer.getvalue()
     # wee need to know size of track data.
     eot_slice = writeVar(self.rel_time()) + fromBytes([META_EVENT, END_OF_TRACK, 0])
     raw.writeBew(len(track_data)+len(eot_slice), 4)
     # then write
     raw.writeSlice(track_data)
     raw.writeSlice(eot_slice)
示例#8
0
 def end_of_track(self):
     """
     Writes the track to the buffer.
     """
     raw = self.raw_out
     raw.writeSlice(TRACK_HEADER)
     track_data = self._current_track_buffer.getvalue()
     # wee need to know size of track data.
     eot_slice = writeVar(self.rel_time()) + fromBytes([META_EVENT, END_OF_TRACK, 0])
     raw.writeBew(len(track_data)+len(eot_slice), 4)
     # then write
     raw.writeSlice(track_data)
     raw.writeSlice(eot_slice)
示例#9
0
 def writeVarLen(self, value):
     "Writes a variable length word to the file"
     var = self.writeSlice(writeVar(value))
示例#10
0
 def writeVarLen(self, value):
     "Writes a variable length word to the file"
     var = self.writeSlice(writeVar(value))