def _init_handshake(self): dongle_message, dongle = make_dongle_message(sysex.DONGLE_ENQUIRY_PREFIX) identity_control = create_sysex_element(sysex.IDENTITY_PREFIX, sysex.IDENTITY_ENQUIRY) dongle_control = create_sysex_element(sysex.DONGLE_PREFIX, dongle_message) presentation_control = create_sysex_element(sysex.DONGLE_PREFIX, sysex.make_presentation_message(self.application())) self._handshake = HandshakeComponent(identity_control=identity_control, dongle_control=dongle_control, presentation_control=presentation_control, dongle=dongle, is_root=True) self._on_handshake_success.subject = self._handshake self._on_handshake_failure.subject = self._handshake self._start_handshake_task = self._tasks.add(task.sequence(task.wait(HANDSHAKE_DELAY), task.run(self._start_handshake))) self._start_handshake_task.kill()
def _create_pad_sensitivity_update(self): all_pad_sysex_control = create_sysex_element( sysex.ALL_PADS_SENSITIVITY_PREFIX) pad_sysex_control = create_sysex_element(sysex.PAD_SENSITIVITY_PREFIX) sensitivity_sender = pad_parameter_sender(all_pad_sysex_control, pad_sysex_control) self._pad_sensitivity_update = PadUpdateComponent( all_pads=list(range(64)), parameter_sender=sensitivity_sender, default_profile=action_pad_sensitivity, update_delay=TIMER_DELAY)
def __init__(self, *a, **k): super(Push, self).__init__(*a, **k) with self.component_guard(): self._suppress_sysex = False self._create_components() self._mode_change = create_sysex_element(sysex.MODE_CHANGE) self._send_midi((144,60,30)) self._write_line1 = create_sysex_element(sysex.WRITE_LINE1) # super(Push,self)._send_midi((240, 71, 127, 21, 98, 0, 1, 0, 247)) # self.log_message('Push script loaded') # logger.info('Handshake succeded with firmware version %.2f!' % self._handshake.firmware_version) self.show_message('Push script loaded')
def _create_user_component(self): sysex_control = create_sysex_element(sysex.MODE_CHANGE) user = UserComponent(value_control=sysex_control, is_root=True) user.layer = Layer(action_button='user_button') user.settings_layer = Layer(display_line1='display_line1', display_line2='display_line2', display_line3='display_line3', display_line4='display_line4', encoders='global_param_controls') user.settings_layer.priority = consts.DIALOG_PRIORITY return user
def _init_global_pad_parameters(self): self._pad_parameter_control = self._with_firmware_version( 1, 16, create_sysex_element( sysex.PAD_PARAMETER_PREFIX, default_value=sysex.make_pad_parameter_message())) aftertouch_threshold = self._settings['aftertouch_threshold'].value self._global_pad_parameters = GlobalPadParameters( aftertouch_threshold=aftertouch_threshold, is_enabled=False, layer=Layer(pad_parameter=self._pad_parameter_control))
def _init_global_pad_parameters(self): self._pad_parameter_control = self._with_firmware_version(1, 16, create_sysex_element(sysex.PAD_PARAMETER_PREFIX, default_value=sysex.make_pad_parameter_message())) aftertouch_threshold = self._settings['aftertouch_threshold'].value self._global_pad_parameters = GlobalPadParameters(aftertouch_threshold=aftertouch_threshold, is_enabled=False, layer=Layer(pad_parameter=self._pad_parameter_control))
def _create_pad_sensitivity_update(self): all_pad_sysex_control = create_sysex_element(sysex.ALL_PADS_SENSITIVITY_PREFIX) pad_sysex_control = create_sysex_element(sysex.PAD_SENSITIVITY_PREFIX) sensitivity_sender = pad_parameter_sender(all_pad_sysex_control, pad_sysex_control) self._pad_sensitivity_update = PadUpdateComponent(all_pads=range(64), parameter_sender=sensitivity_sender, default_profile=action_pad_sensitivity, update_delay=TIMER_DELAY, is_root=True)