def _scroll_banks(self, offset): if self._bank: bank_index = clamp(self._bank.index + offset, 0, self._bank.bank_count()) self._device_bank_registry.set_device_bank(self.device(), bank_index) self._set_bank_index(bank_index)
def scroll_scales(self, offset): if self._scale: scale_index = clamp( SCALES.index(self.scale) + offset, 0, len(SCALES)) self.scale = SCALES[scale_index] or SCALES[0] self._update_note_translations() self._update_led_feedback() self._display_scale_and_key_info()
def visible_drum_pads(self): if self._visible_drum_pads and self._all_drum_pads: first_pad = first(self._visible_drum_pads) if first_pad: size = self.width * self.height first_note = first_pad.note if first_note > 128 - size: size = 128 - first_note offset = clamp(first_note, 0, 128 - len(self._visible_drum_pads)) return self._all_drum_pads[offset:offset + size] return []
def select_previous_chain_in_rack(self): device = self.selected_item if device: rack = is_rack(device) target_chain = None if rack and not is_empty_rack(device): chains = list(device.chains) selected_chain = device.view.selected_chain index = clamp(chains.index(selected_chain) - 1, 0, len(chains)) target_chain = chains[index] device.view.selected_chain = target_chain self._select_item(device)
def on_num_sends_changed(self): self.send_select_buttons.control_count = clamp(self.num_sends, 0, 8)
def scroll_keys(self, offset): index = clamp(self.root_note + offset, 0, 12) if index in range(12): self.root_note = index self._move_start_note(offset) self._display_scale_and_key_info()