コード例 #1
0
    def handle_sysex(self, midi_bytes):
        # MK2 has different challenge and params
        if len(midi_bytes) == 10 and midi_bytes[:7] == (240, 0, 32, 41, 2, 24,
                                                        64):
            response = long(midi_bytes[7])
            response += long(midi_bytes[8]) << 8
            if response == Live.Application.encrypt_challenge2(
                    self._challenge):
                self._mk2_rgb = True
                self.log_message("Challenge Response ok (mk2)")

                self._suppress_send_midi = False
                self.set_enabled(True)
                self.init()
        #MK1 Challenge
        elif len(midi_bytes) == 8 and midi_bytes[1:5] == (0, 32, 41, 6):
            response = long(midi_bytes[5])
            response += long(midi_bytes[6]) << 8
            if response == Live.Application.encrypt_challenge2(
                    self._challenge):
                self.log_message("Challenge Response ok (mk1)")
                self._mk2_rgb = False
                self.init()
                self._suppress_send_midi = False
                self.set_enabled(True)
        else:
            ControlSurface.handle_sysex(self, midi_bytes)
コード例 #2
0
    def handle_sysex(self, midi_bytes):
        if len(midi_bytes) >= 10 and midi_bytes[:8] == (240, 126, 0, 6, 2, 0,
                                                        32,
                                                        41):  #0,32,41=novation
            if len(midi_bytes) >= 12 and midi_bytes[8:10] == (19, 1):
                self._mk3_rgb = True
                #programmer mode
                self._send_midi(STD_MSG_HEADER +
                                (LP_MINI_MK3_ID, 14, 1, SYSEX_END))
                #led feedback: internal off, external on
                self._send_midi(STD_MSG_HEADER +
                                (LP_MINI_MK3_ID, 10, 0, 1, SYSEX_END))
                #disable sleep mode
                self._send_midi(STD_MSG_HEADER +
                                (LP_MINI_MK3_ID, 9, 1, SYSEX_END))
                self._suppress_send_midi = False
                self.set_enabled(True)
                self.init()
            elif len(midi_bytes) >= 12 and midi_bytes[8:10] == (3, 1):
                self._lpx = True
                #programmer mode
                self._send_midi(STD_MSG_HEADER + (LP_X_ID, 14, 1, SYSEX_END))
                #led feedback: internal off, external on
                self._send_midi(STD_MSG_HEADER +
                                (LP_X_ID, 10, 0, 1, SYSEX_END))
                #disable sleep mode
                self._send_midi(STD_MSG_HEADER + (LP_X_ID, 9, 1, SYSEX_END))
                self._suppress_send_midi = False
                self.set_enabled(True)
                self.init()
            else:
                ControlSurface.handle_sysex(self, midi_bytes)
                #self.log_message("OTHER NOVATION")

        # MK2 has different challenge and params
        elif len(midi_bytes) == 10 and midi_bytes[:7] == (240, 0, 32, 41, 2,
                                                          24, 64):
            response = long(midi_bytes[7])
            response += long(midi_bytes[8]) << 8
            if response == Live.Application.encrypt_challenge2(
                    self._challenge):
                self.log_message("Challenge Response ok (mk2)")
                self._mk2_rgb = True
                self._suppress_send_midi = False
                self.set_enabled(True)
                self.init()
        #MK1 Challenge
        elif len(midi_bytes) == 8 and midi_bytes[1:5] == (0, 32, 41, 6):
            response = long(midi_bytes[5])
            response += long(midi_bytes[6]) << 8
            if response == Live.Application.encrypt_challenge2(
                    self._challenge):
                self.log_message("Challenge Response ok (mk1)")
                self._mk2_rgb = False
                self.init()
                self._suppress_send_midi = False
                self.set_enabled(True)
        else:
            ControlSurface.handle_sysex(self, midi_bytes)
コード例 #3
0
ファイル: Launchpad.py プロジェクト: ampg99/Launchpad95
	def handle_sysex(self, midi_bytes):
		# MK2 has different challenge and params
		if len(midi_bytes) == 10 and midi_bytes[:7] == (240, 0, 32, 41, 2, 24, 64):
					response = long(midi_bytes[7])
					response += long(midi_bytes[8]) << 8
					if response == Live.Application.encrypt_challenge2(self._challenge):
						self._mk2_rgb = True
						self.log_message("Challenge Response ok (mk2)")
						
						self._suppress_send_midi = False
						self.set_enabled(True)
						self.init()
		#MK1 Challenge
		elif len(midi_bytes) == 8 and midi_bytes[1:5] == (0, 32, 41, 6):
					response = long(midi_bytes[5])
					response += long(midi_bytes[6]) << 8
					if response == Live.Application.encrypt_challenge2(self._challenge):
						self.log_message("Challenge Response ok (mk1)")
						self._mk2_rgb = False
						self.init()
						self._suppress_send_midi = False
						self.set_enabled(True)
		else:
			ControlSurface.handle_sysex(self,midi_bytes)