示例#1
0
 def process_next_buffer(self):
     if not len(self.queue):
         self.processing.clear()
         return
     buffer = self.queue.popleft()
     for data in buffer:
         msg = messages.parse_midi_message(data[0])
         if msg is None:
             continue
         self.emit('msg_received', msg=msg, timestamp=data[1])
示例#2
0
 def parse_midi_message(self, **kwargs):
     data = kwargs.get('data')
     timestamp = kwargs.get('timestamp', 0)
     if timestamp == 0:
         timestamp = self.midi_io.get_module_time()
     #now = time.time()
     t = self.midi_io.module_time_to_time(timestamp)
     #nowdiff = now - self.midi_io.start_time['time']
     #tdiff = t - self.midi_io.start_time['time']
     #print 'realtime=%010.8f, modtime=%010.8f, diff=%010.8f' % (nowdiff, tdiff, tdiff - nowdiff)
     msg = messages.parse_midi_message(data, timestamp=t)
     if msg is None:
         return
     self.scheduler.add_item(t, msg)
     return msg
示例#3
0
 def parse_midi_message(self, **kwargs):
     data = kwargs.get('data')
     timestamp = kwargs.get('timestamp', 0)
     if timestamp == 0:
         timestamp = self.midi_io.get_module_time()
     #now = time.time()
     t = self.midi_io.module_time_to_time(timestamp)
     #nowdiff = now - self.midi_io.start_time['time']
     #tdiff = t - self.midi_io.start_time['time']
     #print 'realtime=%010.8f, modtime=%010.8f, diff=%010.8f' % (nowdiff, tdiff, tdiff - nowdiff)
     msg = messages.parse_midi_message(data, timestamp=t)
     if msg is None:
         return
     self.scheduler.add_item(t, msg)
     return msg