def _setup_monomod(self): self._host = MonomodComponent(self) self._host.name = 'Monomod_Host' self._host2 = SpecialMonomodComponent(self) self._host2.name = '256_Monomod_Host' self.hosts = [self._host, self._host2]
class LemurPad(MonOhm): __module__ = __name__ __doc__ = " Lemur version of the MonOhm companion controller script " def __init__(self, *a, **k): self._timer_callbacks = [] #Used for _monobridge, which uses L8 method for registering timer callbacks. deprecated, needs to be replaced by new L9 Task class. self._osc_registry = {} self._display_button_names = DISPLAY_BUTTON_NAMES super(LemurPad, self).__init__(*a, **k) self._host_name = "LemurPad" self._color_type = 'AumPad' self.connected = 0 with self.component_guard(): self._setup_touchosc() self._assign_host2() self._assign_session_colors() def query_ohm(self): pass """script initialization methods""" def _setup_monobridge(self): self._monobridge = OSCMonoBridgeElement(self) self._monobridge.name = 'MonoBridge' def _setup_controls(self): is_momentary = True self._fader = [None for index in range(8)] self._dial = [None for index in range(16)] self._button = [None for index in range(8)] self._menu = [None for index in range(6)] for index in range(8): self._fader[index] = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, '/Fader_'+str(index)+'/x', '/Strip'+str(index+8)+'/set', '/Strip'+str(index)+'/set', self) for index in range(8): self._button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_'+str(index), '/Select_'+str(index)+'/value', '/Select/set '+str(index), '/Select/text '+str(index), self) for index in range(16): self._dial[index] = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_DIALS[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, '/Dial_'+str(index)+'/x', '/Dial'+str(index)+'val/set', '/Dial'+str(index)+'name/set', self) for index in range(6): self._menu[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_MENU[index], 'Menu_' + str(index), '/Function_'+str(index)+'/value', '/Function/set '+str(index), '/Function/text '+str(index), self) self._crossfader = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CROSSFADER, Live.MidiMap.MapMode.absolute, "Crossfader", 24, '/XFader/x', '/XFader/none', None, self) self._livid = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', '/Livid/x', '/Livid/x', None, self) self._shift_l = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', '/ShiftL/x', '/ShiftL/x', None, self) self._shift_r = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', '/ShiftR/x', '/ShiftR/x', None, self) self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' self._monomod = ButtonMatrixElement() self._monomod.name = 'Monomod' self._grid = [None for index in range(8)] for column in range(8): self._grid[column] = [None for index in range(8)] for row in range(8): self._grid[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + str(column) + '_' + str(row), '/ClipGrid_'+str(column)+'_'+str(row)+'/value', '/ClipGrid/set '+str(column)+' '+str(row), '/ClipGrid/text '+str(column)+' '+str(row), self) for row in range(5): button_row = [] for column in range(7): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row)) for row in range(8): button_row = [] for column in range(8): button_row.append(self._grid[column][row]) self._monomod.add_row(tuple(button_row)) self._dummy_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 125) self._dummy_button.name = 'Dummy1' self._dummy_button2 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 126) self._dummy_button2.name = 'Dummy2' self._dummy_button3 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 127) self._dummy_button2.name = 'Dummy3' self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), '/Grid_'+str(column)+'_'+str(row)+'/value', '/Grid/set '+str(column)+' '+str(row), None, self) #self._square[column][row] = FlashingButtonElement(is_momentary, 0, 15, -1, '256Grid_' + str(column) + '_' + str(row), '/1/p_grid/'+str(column)+'/'+str(row), '/1/c_grid/'+str(column)+'/'+str(row), self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) self._bank_buttons = ButtonMatrixElement() self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/Shift_'+str(index)+'/value', '/Shift/set '+str(index), None, self) button_row = [] for index in range(2): button_row.append(self._bank_button[index]) self._bank_buttons.add_row(tuple(button_row)) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), '/Keys_'+str(index)+'/value', '/Keys/set '+str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row)) self._pedal = [None for index in range(8)] if self._use_pedal is True: for index in range(8): self._pedal[index] = EncoderElement(MIDI_CC_TYPE, 0, 25+index, Live.MidiMap.MapMode.absolute) self._pedal[index].name = 'Pedal_'+str(index) self._pedal[index]._report = False def _setup_session_control(self): is_momentary = True num_tracks = 4 num_scenes = 5 self._session = NameServerSessionComponent(num_tracks, num_scenes, self) self._session.name = "Left_Session" self._session.set_offsets(0, 0) self._session.set_stop_clip_value(self._color_defs['STOP_CLIP']) self._scene = [None for index in range(5)] for row in range(num_scenes): self._scene[row] = self._session.scene(row) self._scene[row].name = 'L_Scene_' + str(row) for column in range(num_tracks): clip_slot = self._scene[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_L_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session.set_mixer(self._mixer) self._session_zoom = SessionZoomingComponent(self._session) self._session_zoom.name = 'L_Session_Overview' self._session_zoom.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom._zoom_button = (self._dummy_button) self._session_zoom.set_enabled(True) self._session2 = SessionComponent(num_tracks, num_scenes) self._session2.name = 'Right_Session' self._session2.set_offsets(4, 0) self._session2.set_stop_clip_value(self._color_defs['STOP_CLIP']) self._scene2 = [None for index in range(5)] for row in range(num_scenes): self._scene2[row] = self._session2.scene(row) self._scene2[row].name = 'R_Scene_' + str(row) for column in range(num_tracks): clip_slot = self._scene2[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_R_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session2.set_mixer(self._mixer2) self._session2.add_offset_listener(self._on_session_offset_changes) self._session_zoom2 = SessionZoomingComponent(self._session2) self._session_zoom2.name = 'R_Session_Overview' self._session_zoom2.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom2.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom2.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom.set_enabled(True) self._session_zoom2._zoom_button = (self._dummy_button2) self._session_main = SessionComponent(8, num_scenes) self._session_main.name = 'Main_Session' self._session_main.set_stop_clip_value(self._color_defs['STOP_CLIP']) self._scene_main = [None for index in range(5)] for row in range(num_scenes): self._scene_main[row] = self._session_main.scene(row) self._scene_main[row].name = 'M_Scene_' + str(row) for column in range(8): clip_slot = self._scene_main[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_M_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session_main.set_mixer(self._mixer) self._session_zoom_main = SessionZoomingComponent(self._session_main) self._session_zoom_main.name = 'M_Session_Overview' self._session_zoom_main.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom_main.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom_main.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom_main.set_enabled(True) self._session_zoom_main._zoom_button = (self._dummy_button3) self._sessions = [self._session, self._session2, self._session_main] self._zooms = [self._session_zoom, self._session_zoom2, self._session_zoom_main] def _setup_monomod(self): self._host = MonomodComponent(self) self._host.name = 'Monomod_Host' self._host2 = SpecialMonomodComponent(self) self._host2.name = '256_Monomod_Host' self.hosts = [self._host, self._host2] def _assign_host2(self): self._host2._set_shift_button(self._bank_button[0]) self._host2._set_alt_button(self._bank_button[1]) self._host2._set_button_matrix(self._monomod256) self._host2._set_key_buttons(self._key_button) self._host2.set_enabled(True) def _setup_touchosc(self): self._osc_registry = {} #self._osc_registry['/ping'] = self._monobridge.ping #self._osc_registry['/1'] = self._monobridge.page1 #self._osc_registry['/2'] = self._monobridge.page2 for control in self.controls: if hasattr(control, 'osc'): self._osc_registry[control.osc] = control.set_value #if hasattr(control, 'osc_alt'): # self._osc_registry[control.osc_alt] = control.set_value #self.log_message('create dict key: ' + str(control.osc) + str(control.name)) """shift/zoom methods""" def deassign_matrix(self): super(LemurPad, self).deassign_matrix() self.clear_grid_names() """menu button management methods""" def deassign_menu(self): super(LemurPad, self).deassign_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(' ')) def assign_device_nav_to_menu(self): super(LemurPad, self).assign_device_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(DEVICE_NAV_NAMES[index]))) def assign_transport_to_menu(self): super(LemurPad, self).assign_transport_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(TRANSPORT_NAMES[index]))) def assign_session_nav_to_menu(self): super(LemurPad, self).assign_session_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_NAV_NAMES[index]))) def assign_session_main_nav_to_menu(self): super(LemurPad, self).assign_session_main_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_NAV_NAMES[index]))) def assign_monomod_shift_to_menu(self): super(LemurPad, self).assign_monomod_shift_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(MONOMOD_SHIFT_NAMES[index]))) def assign_monomod_to_menu(self): super(LemurPad, self).assign_monomod_shift_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(MONOMOD_NAMES[index]))) def assign_session_bank_to_menu(self): super(LemurPad, self).assign_session_bank_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_BANK_NAMES[index]))) def assign_session2_bank_to_menu(self): super(LemurPad, self).assign_session2_bank_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_BANK2_NAMES[index]))) def assign_session_main_nav_to_menu(self): super(LemurPad, self).assign_session_main_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_MAIN_BANK_NAMES[index]))) """m4l bridge""" def generate_strip_string(self, display_string): NUM_CHARS_PER_DISPLAY_STRIP = 9 if (not display_string): return ('`_') if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))): display_string = display_string[:-2] if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)): for um in [' ', 'i', 'o', 'u', 'e', 'a']: while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)): um_pos = display_string.rfind(um, 1) display_string = (display_string[:um_pos] + display_string[(um_pos + 1):]) else: display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1)) ret = u'' for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)): if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)): ret += ' ' else: ret += display_string[i] ret += ' ' assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP) return '`' + ret.replace(' ', '_') def notification_to_bridge(self, name, value, sender): if(isinstance(sender, MonoEncoderElement2)): #self.log_message(str(name) + str(value) + str(sender.num)) self._monobridge._send('lcd_name', sender.name, self.generate_strip_string(str(name))) self._monobridge._send('lcd_value', sender.name, self.generate_strip_string(str(value))) def clip_name(self, sender, name): #self.log_message('clip name ' + str(sender.osc_name) + ' ' + str(self.generate_strip_string(str(name)))) self._monobridge._send_osc(sender.osc_name, self.generate_strip_string(str(name))) """def get_clip_names(self): clip_names = [] for scene in self._session._scenes: for clip_slot in scene._clip_slots: if clip_slot.has_clip(): clip_names.append(clip_slot._clip_slot)##.clip.name) #return clip_slot._clip_slot #self.log_message('clip name' + str(clip_slot._clip_slot.clip.name)) return clip_names""" """called on timer""" def update_display(self): super(LemurPad, self).update_display() for callback in self._timer_callbacks: callback() def flash(self): if(self.flash_status > 0): for control in self.controls: if isinstance(control, MonoButtonElement): control.flash(self._timer) def strobe(self): pass """general functionality""" def disconnect(self): super(MonOhm, self).disconnect() def clear_grid_names(self): #self.log_message('clear grid names' + str(self)) for column in range(8): for row in range(8): self._monobridge._send_osc(self._grid[column][row].osc_name, '`_') def _register_timer_callback(self, callback): """ Registers a callback that is triggerd on every call of update_display """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 0) self._timer_callbacks.append(callback) return None def _unregister_timer_callback(self, callback): """ Unregisters a timer callback """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 1) self._timer_callbacks.remove(callback) return None def _set_brightness(self, value): #self._bright = (value != 0) #for control in self.controls: # if isinstance(control, OSCMonoButtonElement): # self._monobridge._send_osc(control.osc_alt, int(self._bright), True) pass def reset(self): #self._monobridge._send_osc('/reset') for control in self.controls: control.reset() def assign_lower_grid_names(self, mode): if self._display_button_names is True: for column in range(8): for row in range(3): self._monobridge._send_osc(self._grid[column][row+5].osc_name, self.generate_strip_string(str(GRID_NAMES[mode][row][column]))) def reset_and_refresh_state(self, *a, **k): self.schedule_message(1, self.reset) self.schedule_message(2, self.refresh_state)
class LemurPad(MonOhm): __module__ = __name__ __doc__ = " Lemur version of the MonOhm companion controller script " def __init__(self, *a, **k): self._timer_callbacks = [] #Used for _monobridge, which uses L8 method for registering timer callbacks. deprecated, needs to be replaced by new L9 Task class. self._osc_registry = {} self._display_button_names = DISPLAY_BUTTON_NAMES super(LemurPad, self).__init__(*a, **k) self._host_name = "LemurPad" self._color_type = 'AumPad' self.connected = 0 with self.component_guard(): self._setup_touchosc() self._assign_host2() self._assign_session_colors() def query_ohm(self): pass """script initialization methods""" def _setup_monobridge(self): self._monobridge = OSCMonoBridgeElement(self) self._monobridge.name = 'MonoBridge' def _setup_controls(self): is_momentary = True self._fader = [None for index in range(8)] self._dial = [None for index in range(16)] self._button = [None for index in range(8)] self._menu = [None for index in range(6)] for index in range(8): self._fader[index] = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, '/Fader_'+str(index)+'/x', '/Strip'+str(index+8)+'/set', '/Strip'+str(index)+'/set', self) for index in range(8): self._button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_'+str(index), '/Select_'+str(index)+'/value', '/Select/set '+str(index), '/Select/text '+str(index), self) for index in range(16): self._dial[index] = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_DIALS[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, '/Dial_'+str(index)+'/x', '/Dial'+str(index)+'val/set', '/Dial'+str(index)+'name/set', self) for index in range(6): self._menu[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_MENU[index], 'Menu_' + str(index), '/Function_'+str(index)+'/value', '/Function/set '+str(index), '/Function/text '+str(index), self) self._crossfader = OSCMonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CROSSFADER, Live.MidiMap.MapMode.absolute, "Crossfader", 24, '/XFader/x', '/XFader/none', None, self) self._livid = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', '/Livid/x', '/Livid/x', None, self) self._shift_l = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', '/ShiftL/x', '/ShiftL/x', None, self) self._shift_r = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', '/ShiftR/x', '/ShiftR/x', None, self) self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' self._monomod = ButtonMatrixElement() self._monomod.name = 'Monomod' self._grid = [None for index in range(8)] for column in range(8): self._grid[column] = [None for index in range(8)] for row in range(8): self._grid[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + str(column) + '_' + str(row), '/ClipGrid_'+str(column)+'_'+str(row)+'/value', '/ClipGrid/set '+str(column)+' '+str(row), '/ClipGrid/text '+str(column)+' '+str(row), self) for row in range(5): button_row = [] for column in range(7): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row)) for row in range(8): button_row = [] for column in range(8): button_row.append(self._grid[column][row]) self._monomod.add_row(tuple(button_row)) self._dummy_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 125) self._dummy_button.name = 'Dummy1' self._dummy_button2 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 126) self._dummy_button2.name = 'Dummy2' self._dummy_button3 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 127) self._dummy_button2.name = 'Dummy3' self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), '/Grid_'+str(column)+'_'+str(row)+'/value', '/Grid/set '+str(column)+' '+str(row), None, self) #self._square[column][row] = FlashingButtonElement(is_momentary, 0, 15, -1, '256Grid_' + str(column) + '_' + str(row), '/1/p_grid/'+str(column)+'/'+str(row), '/1/c_grid/'+str(column)+'/'+str(row), self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) self._bank_buttons = ButtonMatrixElement() self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/Shift_'+str(index)+'/value', '/Shift/set '+str(index), None, self) button_row = [] for index in range(2): button_row.append(self._bank_button[index]) self._bank_buttons.add_row(tuple(button_row)) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), '/Keys_'+str(index)+'/value', '/Keys/set '+str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row)) self._pedal = [None for index in range(8)] if self._use_pedal is True: for index in range(8): self._pedal[index] = EncoderElement(MIDI_CC_TYPE, 0, 25+index, Live.MidiMap.MapMode.absolute) self._pedal[index].name = 'Pedal_'+str(index) self._pedal[index]._report = False def _setup_session_control(self): is_momentary = True num_tracks = 4 num_scenes = 5 self._session = NameServerSessionComponent(num_tracks, num_scenes, self) self._session.name = "Left_Session" self._session.set_offsets(0, 0) self._session.set_stop_track_clip_value(self._color_defs['STOP_CLIP']) self._scene = [None for index in range(5)] for row in range(num_scenes): self._scene[row] = self._session.scene(row) self._scene[row].name = 'L_Scene_' + str(row) for column in range(num_tracks): clip_slot = self._scene[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_L_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session.set_mixer(self._mixer) self._session_zoom = SessionZoomingComponent(self._session) self._session_zoom.name = 'L_Session_Overview' self._session_zoom.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom._zoom_button = (self._dummy_button) self._session_zoom.set_enabled(True) self._session2 = SessionComponent(num_tracks, num_scenes) self._session2.name = 'Right_Session' self._session2.set_offsets(4, 0) self._session2.set_stop_track_clip_value(self._color_defs['STOP_CLIP']) self._scene2 = [None for index in range(5)] for row in range(num_scenes): self._scene2[row] = self._session2.scene(row) self._scene2[row].name = 'R_Scene_' + str(row) for column in range(num_tracks): clip_slot = self._scene2[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_R_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session2.set_mixer(self._mixer2) self._session2.add_offset_listener(self._on_session_offset_changes) self._session_zoom2 = SessionZoomingComponent(self._session2) self._session_zoom2.name = 'R_Session_Overview' self._session_zoom2.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom2.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom2.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom.set_enabled(True) self._session_zoom2._zoom_button = (self._dummy_button2) self._session_main = SessionComponent(8, num_scenes) self._session_main.name = 'Main_Session' self._session_main.set_stop_track_clip_value(self._color_defs['STOP_CLIP']) self._scene_main = [None for index in range(5)] for row in range(num_scenes): self._scene_main[row] = self._session_main.scene(row) self._scene_main[row].name = 'M_Scene_' + str(row) for column in range(8): clip_slot = self._scene_main[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_M_' + str(row) clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY']) clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC']) clip_slot.set_stopped_value(self._color_defs['CLIP_STOP']) clip_slot.set_started_value(self._color_defs['CLIP_STARTED']) clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING']) self._session_main.set_mixer(self._mixer) self._session_zoom_main = SessionZoomingComponent(self._session_main) self._session_zoom_main.name = 'M_Session_Overview' self._session_zoom_main.set_stopped_value(self._color_defs['ZOOM_STOPPED']) self._session_zoom_main.set_playing_value(self._color_defs['ZOOM_PLAYING']) self._session_zoom_main.set_selected_value(self._color_defs['ZOOM_SELECTED']) self._session_zoom_main.set_enabled(True) self._session_zoom_main._zoom_button = (self._dummy_button3) self._sessions = [self._session, self._session2, self._session_main] self._zooms = [self._session_zoom, self._session_zoom2, self._session_zoom_main] def _setup_monomod(self): self._host = MonomodComponent(self) self._host.name = 'Monomod_Host' self._host2 = SpecialMonomodComponent(self) self._host2.name = '256_Monomod_Host' self.hosts = [self._host, self._host2] def _assign_host2(self): self._host2._set_shift_button(self._bank_button[0]) self._host2._set_alt_button(self._bank_button[1]) self._host2._set_button_matrix(self._monomod256) self._host2._set_key_buttons(self._key_button) self._host2.set_enabled(True) def _setup_touchosc(self): self._osc_registry = {} #self._osc_registry['/ping'] = self._monobridge.ping #self._osc_registry['/1'] = self._monobridge.page1 #self._osc_registry['/2'] = self._monobridge.page2 for control in self.controls: if hasattr(control, 'osc'): self._osc_registry[control.osc] = control.set_value #if hasattr(control, 'osc_alt'): # self._osc_registry[control.osc_alt] = control.set_value #self.log_message('create dict key: ' + str(control.osc) + str(control.name)) """shift/zoom methods""" def deassign_matrix(self): super(LemurPad, self).deassign_matrix() self.clear_grid_names() """menu button management methods""" def deassign_menu(self): super(LemurPad, self).deassign_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(' ')) def assign_device_nav_to_menu(self): super(LemurPad, self).assign_device_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(DEVICE_NAV_NAMES[index]))) def assign_transport_to_menu(self): super(LemurPad, self).assign_transport_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(TRANSPORT_NAMES[index]))) def assign_session_nav_to_menu(self): super(LemurPad, self).assign_session_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_NAV_NAMES[index]))) def assign_session_main_nav_to_menu(self): super(LemurPad, self).assign_session_main_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_NAV_NAMES[index]))) def assign_monomod_shift_to_menu(self): super(LemurPad, self).assign_monomod_shift_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(MONOMOD_SHIFT_NAMES[index]))) def assign_monomod_to_menu(self): super(LemurPad, self).assign_monomod_shift_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(MONOMOD_NAMES[index]))) def assign_session_bank_to_menu(self): super(LemurPad, self).assign_session_bank_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_BANK_NAMES[index]))) def assign_session2_bank_to_menu(self): super(LemurPad, self).assign_session2_bank_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_BANK2_NAMES[index]))) def assign_session_main_nav_to_menu(self): super(LemurPad, self).assign_session_main_nav_to_menu() for index in range(6): self._monobridge._send_osc(self._menu[index].osc_name, self.generate_strip_string(str(SESSION_MAIN_BANK_NAMES[index]))) """m4l bridge""" def generate_strip_string(self, display_string): NUM_CHARS_PER_DISPLAY_STRIP = 9 if (not display_string): return ('`_') if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))): display_string = display_string[:-2] if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)): for um in [' ', 'i', 'o', 'u', 'e', 'a']: while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)): um_pos = display_string.rfind(um, 1) display_string = (display_string[:um_pos] + display_string[(um_pos + 1):]) else: display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1)) ret = u'' for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)): if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)): ret += ' ' else: ret += display_string[i] ret += ' ' assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP) return '`' + ret.replace(' ', '_') def notification_to_bridge(self, name, value, sender): if(isinstance(sender, MonoEncoderElement2)): #self.log_message(str(name) + str(value) + str(sender.num)) self._monobridge._send('lcd_name', sender.name, self.generate_strip_string(str(name))) self._monobridge._send('lcd_value', sender.name, self.generate_strip_string(str(value))) def clip_name(self, sender, name): #self.log_message('clip name ' + str(sender.osc_name) + ' ' + str(self.generate_strip_string(str(name)))) self._monobridge._send_osc(sender.osc_name, self.generate_strip_string(str(name))) """def get_clip_names(self): clip_names = [] for scene in self._session._scenes: for clip_slot in scene._clip_slots: if clip_slot.has_clip(): clip_names.append(clip_slot._clip_slot)##.clip.name) #return clip_slot._clip_slot #self.log_message('clip name' + str(clip_slot._clip_slot.clip.name)) return clip_names""" """called on timer""" def update_display(self): super(LemurPad, self).update_display() for callback in self._timer_callbacks: callback() def flash(self): if(self.flash_status > 0): for control in self.controls: if isinstance(control, MonoButtonElement): control.flash(self._timer) def strobe(self): pass """general functionality""" def disconnect(self): super(MonOhm, self).disconnect() def clear_grid_names(self): #self.log_message('clear grid names' + str(self)) for column in range(8): for row in range(8): self._monobridge._send_osc(self._grid[column][row].osc_name, '`_') def _register_timer_callback(self, callback): """ Registers a callback that is triggerd on every call of update_display """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 0) self._timer_callbacks.append(callback) return None def _unregister_timer_callback(self, callback): """ Unregisters a timer callback """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 1) self._timer_callbacks.remove(callback) return None def _set_brightness(self, value): #self._bright = (value != 0) #for control in self.controls: # if isinstance(control, OSCMonoButtonElement): # self._monobridge._send_osc(control.osc_alt, int(self._bright), True) pass def reset(self): #self._monobridge._send_osc('/reset') for control in self.controls: control.reset() def assign_lower_grid_names(self, mode): if self._display_button_names is True: for column in range(8): for row in range(3): self._monobridge._send_osc(self._grid[column][row+5].osc_name, self.generate_strip_string(str(GRID_NAMES[mode][row][column]))) def reset_and_refresh_state(self, *a, **k): self.schedule_message(1, self.reset) self.schedule_message(2, self.refresh_state)
class Lemur256(ControlSurface): __module__ = __name__ __doc__ = " Lemur Monomodular 256cell controller script " def __init__(self, *a, **k): self._timer_callbacks = [ ] #Used for _monobridge, which uses L8 method for registering timer callbacks. deprecated, needs to be replaced by new L9 Task class. super(Lemur256, self).__init__(*a, **k) self._host_name = "Lemur256" self._color_type = 'AumPad' self.connected = 0 self._suggested_input_port = 'None' self._suggested_output_port = 'None' self._monomod_version = 'b995' self.hosts = [] self._bright = True self._rgb = 0 self._timer = 0 self.flash_status = 1 self._osc_registry = {} with self.component_guard(): self._setup_monobridge() self._setup_controls() self._setup_monomod() self._setup_touchosc() self._assign_host2() self.reset() self.refresh_state() self.show_message(str(self._host_name) + ' Control Surface Loaded') self.log_message("<<<<<<<<<<<<<<<<<<<< " + str(self._host_name) + " " + str(self._monomod_version) + " log opened >>>>>>>>>>>>>>>>>>>>") def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCMonoButtonElement( is_momentary, MIDI_NOTE_TYPE, int(column / 8) + 1, row + ((column % 8) * 16), '256Grid_' + str(column) + '_' + str(row), '/Grid_' + str(column) + '_' + str(row), '/Grid/set ' + str(column) + ' ' + str(row), None, self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCMonoButtonElement( is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/Shift_' + str(index), '/Shift/set ' + str(index), None, self) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCMonoButtonElement( is_momentary, MIDI_NOTE_TYPE, 15, index + 8, '256Grid_Key_' + str(index), '/Keys_' + str(index), '/Keys/set ' + str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row)) def _setup_monomod(self): self._host2 = SpecialMonomodComponent(self) self._host2.name = '256_Monomod_Host' self.hosts = [self._host2] """script initialization methods""" def _setup_monobridge(self): self._monobridge = OSCMonoBridgeElement(self) self._monobridge.name = 'MonoBridge' def _assign_host2(self): self._host2._set_shift_button(self._bank_button[0]) self._host2._set_alt_button(self._bank_button[1]) self._host2._set_button_matrix(self._monomod256) self._host2._set_key_buttons(self._key_button) self._host2.set_enabled(True) def _setup_touchosc(self): self._osc_registry = {} self._osc_registry['/ping'] = self._monobridge.ping self._osc_registry['/1'] = self._monobridge.page1 for control in self.controls: if hasattr(control, 'osc'): self._osc_registry[control.osc] = control.set_value #if hasattr(control, 'osc_alt'): # self._osc_registry[control.osc_alt] = control.set_value #self.log_message('create dict key: ' + str(control.osc) + str(control.name)) """m4l bridge""" def generate_strip_string(self, display_string): NUM_CHARS_PER_DISPLAY_STRIP = 9 if (not display_string): return ('`_') if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))): display_string = display_string[:-2] if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)): for um in [' ', 'i', 'o', 'u', 'e', 'a']: while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)): um_pos = display_string.rfind(um, 1) display_string = (display_string[:um_pos] + display_string[(um_pos + 1):]) else: display_string = display_string.center( (NUM_CHARS_PER_DISPLAY_STRIP - 1)) ret = u'' for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)): if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)): ret += ' ' else: ret += display_string[i] ret += ' ' assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP) return '`' + ret.replace(' ', '_') def notification_to_bridge(self, name, value, sender): if (isinstance(sender, MonoEncoderElement2)): #self.log_message(str(name) + str(value) + str(sender.num)) self._monobridge._send('lcd_name', sender.name, self.generate_strip_string(str(name))) self._monobridge._send('lcd_value', sender.name, self.generate_strip_string(str(value))) def clip_name(self, sender, name): #self.log_message('clip name ' + str(sender.osc_name) + ' ' + str(self.generate_strip_string(str(name)))) self._monobridge._send_osc(sender.osc_name, self.generate_strip_string(str(name))) """def get_clip_names(self): clip_names = [] for scene in self._session._scenes: for clip_slot in scene._clip_slots: if clip_slot.has_clip(): clip_names.append(clip_slot._clip_slot)##.clip.name) #return clip_slot._clip_slot #self.log_message('clip name' + str(clip_slot._clip_slot.clip.name)) return clip_names""" """called on timer""" def update_display(self): super(Lemur256, self).update_display() for callback in self._timer_callbacks: callback() def flash(self): if (self.flash_status > 0): for control in self.controls: if isinstance(control, MonoButtonElement): control.flash(self._timer) def strobe(self): pass """general functionality""" def disconnect(self): self.log_message("<<<<<<<<<<<<<<<<<<<< " + str(self._host_name) + " log closed >>>>>>>>>>>>>>>>>>>>") super(ControlSurface, self).disconnect() def clear_grid_names(self): #self.log_message('clear grid names' + str(self)) for column in range(8): for row in range(8): self._monobridge._send_osc(self._grid[column][row].osc_name, '`_') def _register_timer_callback(self, callback): """ Registers a callback that is triggerd on every call of update_display """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 0) self._timer_callbacks.append(callback) return None def _unregister_timer_callback(self, callback): """ Unregisters a timer callback """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 1) self._timer_callbacks.remove(callback) return None def _set_brightness(self, value): pass def reset(self): #self._monobridge._send_osc('/reset') for control in self.controls: control.reset() def assign_lower_grid_names(self, mode): if self._display_button_names is True: for column in range(8): for row in range(3): self._monobridge._send_osc( self._grid[column][row + 5].osc_name, self.generate_strip_string( str(GRID_NAMES[mode][row][column]))) def reset_and_refresh_state(self, *a, **k): self.schedule_message(1, self.reset) self.schedule_message(2, self.refresh_state)
class Lemur256(ControlSurface): __module__ = __name__ __doc__ = " Lemur Monomodular 256cell controller script " def __init__(self, *a, **k): self._timer_callbacks = [] #Used for _monobridge, which uses L8 method for registering timer callbacks. deprecated, needs to be replaced by new L9 Task class. super(Lemur256, self).__init__(*a, **k) self._host_name = "Lemur256" self._color_type = 'AumPad' self.connected = 0 self._suggested_input_port = 'None' self._suggested_output_port = 'None' self._monomod_version = 'b995' self.hosts = [] self._bright = True self._rgb = 0 self._timer = 0 self.flash_status = 1 self._osc_registry = {} with self.component_guard(): self._setup_monobridge() self._setup_controls() self._setup_monomod() self._setup_touchosc() self._assign_host2() self.reset() self.refresh_state() self.show_message(str(self._host_name) + ' Control Surface Loaded') self.log_message("<<<<<<<<<<<<<<<<<<<< "+ str(self._host_name) + " " + str(self._monomod_version) + " log opened >>>>>>>>>>>>>>>>>>>>") def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), '/Grid_'+str(column)+'_'+str(row), '/Grid/set '+str(column)+' '+str(row), None, self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/Shift_'+str(index), '/Shift/set '+str(index), None, self) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), '/Keys_'+str(index), '/Keys/set '+str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row)) def _setup_monomod(self): self._host2 = SpecialMonomodComponent(self) self._host2.name = '256_Monomod_Host' self.hosts = [self._host2] """script initialization methods""" def _setup_monobridge(self): self._monobridge = OSCMonoBridgeElement(self) self._monobridge.name = 'MonoBridge' def _assign_host2(self): self._host2._set_shift_button(self._bank_button[0]) self._host2._set_alt_button(self._bank_button[1]) self._host2._set_button_matrix(self._monomod256) self._host2._set_key_buttons(self._key_button) self._host2.set_enabled(True) def _setup_touchosc(self): self._osc_registry = {} self._osc_registry['/ping'] = self._monobridge.ping self._osc_registry['/1'] = self._monobridge.page1 for control in self.controls: if hasattr(control, 'osc'): self._osc_registry[control.osc] = control.set_value #if hasattr(control, 'osc_alt'): # self._osc_registry[control.osc_alt] = control.set_value #self.log_message('create dict key: ' + str(control.osc) + str(control.name)) """m4l bridge""" def generate_strip_string(self, display_string): NUM_CHARS_PER_DISPLAY_STRIP = 9 if (not display_string): return ('`_') if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))): display_string = display_string[:-2] if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)): for um in [' ', 'i', 'o', 'u', 'e', 'a']: while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)): um_pos = display_string.rfind(um, 1) display_string = (display_string[:um_pos] + display_string[(um_pos + 1):]) else: display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1)) ret = u'' for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)): if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)): ret += ' ' else: ret += display_string[i] ret += ' ' assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP) return '`' + ret.replace(' ', '_') def notification_to_bridge(self, name, value, sender): if(isinstance(sender, MonoEncoderElement2)): #self.log_message(str(name) + str(value) + str(sender.num)) self._monobridge._send('lcd_name', sender.name, self.generate_strip_string(str(name))) self._monobridge._send('lcd_value', sender.name, self.generate_strip_string(str(value))) def clip_name(self, sender, name): #self.log_message('clip name ' + str(sender.osc_name) + ' ' + str(self.generate_strip_string(str(name)))) self._monobridge._send_osc(sender.osc_name, self.generate_strip_string(str(name))) """def get_clip_names(self): clip_names = [] for scene in self._session._scenes: for clip_slot in scene._clip_slots: if clip_slot.has_clip(): clip_names.append(clip_slot._clip_slot)##.clip.name) #return clip_slot._clip_slot #self.log_message('clip name' + str(clip_slot._clip_slot.clip.name)) return clip_names""" """called on timer""" def update_display(self): super(Lemur256, self).update_display() for callback in self._timer_callbacks: callback() def flash(self): if(self.flash_status > 0): for control in self.controls: if isinstance(control, MonoButtonElement): control.flash(self._timer) def strobe(self): pass """general functionality""" def disconnect(self): self.log_message("<<<<<<<<<<<<<<<<<<<< "+ str(self._host_name) + " log closed >>>>>>>>>>>>>>>>>>>>") super(ControlSurface, self).disconnect() def clear_grid_names(self): #self.log_message('clear grid names' + str(self)) for column in range(8): for row in range(8): self._monobridge._send_osc(self._grid[column][row].osc_name, '`_') def _register_timer_callback(self, callback): """ Registers a callback that is triggerd on every call of update_display """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 0) self._timer_callbacks.append(callback) return None def _unregister_timer_callback(self, callback): """ Unregisters a timer callback """ assert (callback != None) assert (dir(callback).count('im_func') is 1) assert (self._timer_callbacks.count(callback) == 1) self._timer_callbacks.remove(callback) return None def _set_brightness(self, value): pass def reset(self): #self._monobridge._send_osc('/reset') for control in self.controls: control.reset() def assign_lower_grid_names(self, mode): if self._display_button_names is True: for column in range(8): for row in range(3): self._monobridge._send_osc(self._grid[column][row+5].osc_name, self.generate_strip_string(str(GRID_NAMES[mode][row][column]))) def reset_and_refresh_state(self, *a, **k): self.schedule_message(1, self.reset) self.schedule_message(2, self.refresh_state)