def _update_editor_matrix_leds(self): """ update hardware LEDS to match offline array values """ if self.is_enabled() and self._matrix: for row, col in product(xrange(self._height), xrange(self._width)): index = row * self._width + col color = self._step_colors[index] self._matrix.set_light(col, row, color)
def set_button_matrix(self, matrix): last_page_length = self.page_length self._matrix = matrix self._on_matrix_value.subject = matrix if matrix: self._width = matrix.width() self._height = matrix.height() matrix.reset() for button, _ in ifilter(first, matrix.iterbuttons()): button.set_channel(PLAYHEAD_FEEDBACK_CHANNELS[0]) for t in self._step_tap_tasks.itervalues(): t.kill() def trigger_modification_task(x, y): trigger = partial(self._trigger_modification, (x, y), done=True) return self._tasks.add( task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(trigger))).kill() self._step_tap_tasks = dict([ ((x, y), trigger_modification_task(x, y)) for x, y in product(xrange(self._width), xrange(self._height)) ]) if matrix and last_page_length != self.page_length: self._on_clip_notes_changed() self.notify_page_length() else: self._update_editor_matrix()
def set_clip_slot_leds(self, leds): if leds: for led, (x, y) in leds.iterbuttons(): scene = self.scene(y) slot = scene.clip_slot(x) slot.set_led(led) else: for x, y in product(range(self._session_ring.num_tracks), range(self._session_ring.num_scenes)): scene = self.scene(y) slot = scene.clip_slot(x) slot.set_led(None)
def set_clip_slot_leds(self, leds): assert not leds or leds.width() == self._session_ring.num_tracks and leds.height() == self._session_ring.num_scenes if leds: for led, (x, y) in leds.iterbuttons(): scene = self.scene(y) slot = scene.clip_slot(x) slot.set_led(led) else: for x, y in product(range(self._session_ring.num_tracks), range(self._session_ring.num_scenes)): scene = self.scene(y) slot = scene.clip_slot(x) slot.set_led(None)
def set_clip_launch_buttons(self, matrix): self._clip_launch_buttons = matrix if matrix: for button, (x,y) in matrix.iterbuttons(): debug('session button is:', button) if button: button.display_press = False button.set_off_value('DefaultButton.Off') button.reset() index = x + (y*matrix.width()) scene = self.scene(index) slot = scene.clip_slot(0) slot.set_launch_button(button) #self._session_ring.update_highlight(ring.tracks_to_use(), ring.song.return_tracks) else: for x, y in product(xrange(self._session_ring.num_tracks), xrange(self._session_ring.num_scenes)): scene = self.scene(y) slot = scene.clip_slot(x) slot.set_launch_button(None) self._reassign_tracks() self._reassign_scenes() self.update()
# Decompiled from: Python 3.8.9 (default, Mar 30 2022, 13:51:17) # [Clang 13.1.6 (clang-1316.0.21.2.3)] # Embedded file name: output/Live/mac_64_static/Release/python-bundle/MIDI Remote Scripts/pushbase/grid_resolution.py # Compiled at: 2022-01-27 16:28:17 # Size of source mod 2**32: 2502 bytes from __future__ import absolute_import, division, print_function, unicode_literals from past.utils import old_div import Live from ableton.v2.base import listenable_property, product from ableton.v2.control_surface.control import ControlManager, RadioButtonControl, control_list GridQuantization = Live.Clip.GridQuantization QUANTIZATION_FACTOR = 24 QUANTIZATION_LIST = [2.0, 3.0, 4.0, 6.0, 8.0, 12.0, 16.0, 24.0] CLIP_VIEW_GRID_LIST = tuple( product([ GridQuantization.g_thirtysecond, GridQuantization.g_sixteenth, GridQuantization.g_eighth, GridQuantization.g_quarter ], [True, False])) CLIP_LENGTH_LIST = [2.0, 4.0, 4.0, 8.0, 8.0, 16.0, 16.0, 32.0] DEFAULT_INDEX = 3 class GridResolution(ControlManager): quantization_buttons = control_list( RadioButtonControl, checked_color='NoteEditor.QuantizationSelected', unchecked_color='NoteEditor.QuantizationUnselected', control_count=8) index = listenable_property.managed(DEFAULT_INDEX) def __init__(self, *a, **k): (super(GridResolution, self).__init__)(*a, **k)
def set_button_matrix(self, matrix): last_page_length = self.page_length self._matrix = matrix self._on_matrix_value.subject = matrix if matrix: self._width = matrix.width() self._height = matrix.height() matrix.reset() for button, _ in ifilter(first, matrix.iterbuttons()): button.set_channel(PLAYHEAD_FEEDBACK_CHANNELS[0]) for t in self._step_tap_tasks.itervalues(): t.kill() def trigger_modification_task(x, y): trigger = partial(self._trigger_modification, (x, y), done=True) return self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(trigger))).kill() self._step_tap_tasks = dict([ ((x, y), trigger_modification_task(x, y)) for x, y in product(xrange(self._width), xrange(self._height)) ]) if matrix and last_page_length != self.page_length: self._on_clip_notes_changed() self.notify_page_length() else: self._update_editor_matrix()
from ableton.v2.base import listenable_property, product from ableton.v2.control_surface.control import control_list, ControlManager, RadioButtonControl GridQuantization = Live.Clip.GridQuantization QUANTIZATION_FACTOR = 24 QUANTIZATION_LIST = [ 2.0, 3.0, 4.0, 6.0, 8.0, 12.0, 16.0, 24.0] CLIP_VIEW_GRID_LIST = tuple(product([ GridQuantization.g_thirtysecond, GridQuantization.g_sixteenth, GridQuantization.g_eighth, GridQuantization.g_quarter], [ True, False])) CLIP_LENGTH_LIST = [ 2.0, 4.0, 4.0, 8.0, 8.0, 16.0, 16.0, 32.0] DEFAULT_INDEX = 3 class GridResolution(ControlManager): quantization_buttons = control_list(RadioButtonControl, checked_color='NoteEditor.QuantizationSelected', unchecked_color='NoteEditor.QuantizationUnselected', control_count=8)
from __future__ import absolute_import, print_function import Live from ableton.v2.base import EventObject, product, listens GridQuantization = Live.Clip.GridQuantization QUANTIZATION_FACTOR = 24 QUANTIZATION_LIST = [2.0, 3.0, 4.0, 6.0, 8.0, 12.0, 16.0, 24.0] CLIP_VIEW_GRID_LIST = tuple(product([GridQuantization.g_thirtysecond, GridQuantization.g_sixteenth, GridQuantization.g_eighth, GridQuantization.g_quarter], [True, False])) CLIP_LENGTH_LIST = [2.0, 4.0, 4.0, 8.0, 8.0, 16.0, 16.0, 32.0] DEFAULT_INDEX = 3 class GridResolution(EventObject): __events__ = ('index',) def __init__(self, *a, **k):
def set_matrix(self, matrix): last_page_length = self.page_length self.matrix.set_control_element(matrix) if matrix: for control in self.matrix: control.set_playable(False) for t in self._step_tap_tasks.itervalues(): t.kill() def trigger_modification_task(x, y): trigger = partial(self._trigger_modification, (x, y), done=True) return self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(trigger))).kill() self._step_tap_tasks = dict([ ((x, y), trigger_modification_task(x, y)) for x, y in product(xrange(self._get_width()), xrange(self._get_height())) ]) if matrix and last_page_length != self.page_length: self._on_clip_notes_changed() self.notify_page_length() else: self._update_editor_matrix()