def _message_callback(self, msg):
if msg.type == '<STR_LIT>':<EOL><INDENT>button = button_from_press(msg.note)<EOL>if button:<EOL><INDENT>self.on_button(button, msg.value != <NUM_LIT:0>)<EOL><DEDENT>elif msg.note == <NUM_LIT>:<EOL><INDENT>self.on_fader_touch(msg.value != <NUM_LIT:0>)<EOL><DEDENT><DEDENT>elif msg.type == '<STR_LIT>' and msg.control == <NUM_LIT:0>:<EOL><INDENT>self._msb = msg.value<EOL><DEDENT>elif msg.type == '<STR_LIT>' and msg.control == <NUM_LIT:32>:<EOL><INDENT>self._fader = (self._msb << <NUM_LIT:7> | msg.value) >> <NUM_LIT:4><EOL>self.on_fader(self._fader)<EOL><DEDENT>elif msg.type == '<STR_LIT>':<EOL><INDENT>self.on_rotary(<NUM_LIT:1> if msg.pitch < <NUM_LIT:0> else -<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>', msg)<EOL><DEDENT>
Callback function to handle incoming MIDI messages.