def process_midi_bytes(self, midi_bytes, midi_processor): u""" Finds the right recipient for the MIDI message and translates it into the expected format. The result is forwarded to the midi_processor. """ if midi.is_sysex(midi_bytes): result = self.get_registry_entry_for_sysex_midi_message(midi_bytes) if result is not None: identifier, recipient = result midi_processor(recipient, midi_bytes[len(identifier):-1]) #elif self.received_midi_listener_count() == 0: # logger.warning(u'Got unknown sysex message: ' + midi.pretty_print_bytes(midi_bytes)) else: recipient = self.get_recipient_for_nonsysex_midi_message(midi_bytes) if recipient is not None: midi_processor(recipient, midi.extract_value(midi_bytes))
def process_midi_bytes(self, midi_bytes, midi_processor): if midi.is_sysex(midi_bytes): result = self.get_registry_entry_for_sysex_midi_message(midi_bytes) if result is not None: identifier, recipient = result midi_processor(recipient, midi_bytes[len(identifier):-1]) else: try: self.handle_sysex(midi_bytes) except: pass else: recipient = self.get_recipient_for_nonsysex_midi_message(midi_bytes) if recipient is not None: midi_processor(recipient, midi.extract_value(midi_bytes)) else: logger.warning('Got unknown message: ' + midi.pretty_print_bytes(midi_bytes))
def process_midi_bytes(self, midi_bytes, midi_processor): if not midi.is_sysex(midi_bytes): recipient = self.get_recipient_for_nonsysex_midi_message(midi_bytes) if isinstance(recipient, ButtonElement) and midi.extract_value(midi_bytes) != 0 and self._notification is not None: self._notification.hide_notification() super(PushBase, self).process_midi_bytes(midi_bytes, midi_processor)