Beispiel #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))
Beispiel #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))
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #9
0
 def writeVarLen(self, value):
     "Writes a variable length word to the file"
     var = self.writeSlice(writeVar(value))
Beispiel #10
0
 def writeVarLen(self, value):
     "Writes a variable length word to the file"
     var = self.writeSlice(writeVar(value))