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(2): self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDER_CC[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) #for index in range(8): # self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self) for index in range(8): self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, KNOB_CC[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, self) for index in range(4): self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FUNCTION_NOTES[index], 'Menu_' + str(index), self) #self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self) self._livid = DoublePressElement(MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)) self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', self) self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', 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] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + 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'
def _setup_controls(self): self._pedal = [None for index in range(8)] for index in range(7): self._pedal[index] = DoublePressElement( MonoButtonElement(True, MIDI_CC_TYPE, 0, PEDAL_DEFS[index], 'Pedal_' + str(index), self)) #is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self self._pedal[index].name = 'Pedal_' + str(index) self._pedal[index]._report = False self._pedal[7] = LoopPedalExpressionElement( self, MIDI_CC_TYPE, 0, 1, Live.MidiMap.MapMode.absolute) self._pedal[7].name = 'Pedal_' + str(7) self._pedal[7]._report = False self._leds = [None for index in range(4)] for index in range(4): red_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]) green_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index] + 4) blue_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index] + 8) self._leds[index] = RGB_LED(red_led, green_led, blue_led, True, MIDI_NOTE_TYPE, 0, index + 13, 'LED_' + str(index), self) self._select_buttons = ButtonMatrixElement() self._select_buttons.name = 'SelectMatrix' self._select_buttons.add_row( [self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]]) self._doublepress_select_buttons = ButtonMatrixElement() self._doublepress_select_buttons.name = 'DoublepressSelectMatrix' self._doublepress_select_buttons.add_row([ self._pedal[6].double_press, self._pedal[5].double_press, self._pedal[4].double_press, self._pedal[3].double_press ]) self._record_button = self._pedal[1] self._mute_button = self._pedal[2] self._overdub_button = self._pedal[0]
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) def make_color_button(*a, **k): button = make_button(skin=self._color_skin, *a, **k) button.is_rgb = True button.num_delayed_messages = 2 return button def make_matrix_button(track, scene): return make_color_button(0, 32 + track - NUM_TRACKS * scene, name=u'%d_Clip_%d_Button' % (track, scene)) def make_stop_button(track): return make_button(track, 52, name=u'%d_Stop_Button' % track, skin=self._stop_button_skin) self._shift_button = make_button(0, 98, name=u'Shift_Button', resource_type=PrioritizedResource) self._bank_button = make_on_off_button(0, 103, name=u'Bank_Button') self._left_button = make_button(0, 97, name=u'Bank_Select_Left_Button') self._right_button = make_button(0, 96, name=u'Bank_Select_Right_Button') self._up_button = make_button(0, 94, name=u'Bank_Select_Up_Button') self._down_button = make_button(0, 95, name=u'Bank_Select_Down_Button') self._stop_buttons = ButtonMatrixElement( rows=[[make_stop_button(track) for track in xrange(NUM_TRACKS)]]) self._stop_all_button = make_button(0, 81, name=u'Stop_All_Clips_Button') self._scene_launch_buttons_raw = [ make_color_button(0, scene + 82, name=u'Scene_%d_Launch_Button' % scene) for scene in xrange(NUM_SCENES) ] self._scene_launch_buttons = ButtonMatrixElement( rows=[self._scene_launch_buttons_raw]) self._matrix_rows_raw = [[ make_matrix_button(track, scene) for track in xrange(NUM_TRACKS) ] for scene in xrange(NUM_SCENES)] self._session_matrix = ButtonMatrixElement(rows=self._matrix_rows_raw) self._pan_button = make_on_off_button(0, 87, name=u'Pan_Button') self._sends_button = make_on_off_button( 0, 88, name=u'Sends_Button', resource_type=PrioritizedResource) self._user_button = make_on_off_button(0, 89, name=u'User_Button') self._mixer_encoders = ButtonMatrixElement(rows=[[ make_ring_encoder( 48 + track, 56 + track, name=u'Track_Control_%d' % track) for track in xrange(NUM_TRACKS) ]]) self._volume_controls = ButtonMatrixElement(rows=[[ make_slider(track, 7, name=u'%d_Volume_Control' % track) for track in xrange(NUM_TRACKS) ]]) self._master_volume_control = make_slider( 0, 14, name=u'Master_Volume_Control') self._prehear_control = make_encoder(0, 47, name=u'Prehear_Volume_Control') self._crossfader_control = make_slider(0, 15, name=u'Crossfader') self._raw_select_buttons = [ make_on_off_button(channel, 51, name=u'%d_Select_Button' % channel) for channel in xrange(NUM_TRACKS) ] self._arm_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 48, name=u'%d_Arm_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._solo_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 49, name=u'%d_Solo_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._mute_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 50, name=u'%d_Mute_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._crossfade_buttons = ButtonMatrixElement(rows=[[ make_button(channel, 66, name=u'%d_Crossfade_Button' % channel, skin=self._crossfade_button_skin) for channel in xrange(NUM_TRACKS) ]]) self._select_buttons = ButtonMatrixElement( rows=[self._raw_select_buttons]) self._master_select_button = make_on_off_button( channel=0, identifier=80, name=u'Master_Select_Button') self._send_select_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._sends_button]) for button in self._raw_select_buttons ]]) self._quantization_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._shift_button]) for button in self._raw_select_buttons ]]) self._metronome_button = make_on_off_button(0, 90, name=u'Metronome_Button') self._play_button = make_on_off_button(0, 91, name=u'Play_Button') self._record_button = make_on_off_button(0, 93, name=u'Record_Button') self._session_record_button = make_on_off_button( 0, 102, name=u'Session_Record_Button') self._nudge_down_button = make_button(0, 100, name=u'Nudge_Down_Button') self._nudge_up_button = make_button(0, 101, name=u'Nudge_Up_Button') self._tap_tempo_button = make_button(0, 99, name=u'Tap_Tempo_Button') self._tempo_control = make_encoder(0, 13, name=u'Tempo_Control') self._device_controls = ButtonMatrixElement(rows=[[ make_ring_encoder( 16 + index, 24 + index, name=u'Device_Control_%d' % index) for index in xrange(8) ]]) self._device_control_buttons_raw = [ make_on_off_button(0, 58 + index) for index in xrange(8) ] self._device_bank_buttons = ButtonMatrixElement(rows=[[ DeviceBankButtonElement(button, modifiers=[self._shift_button]) for button in self._device_control_buttons_raw ]]) self._device_prev_bank_button = self._device_control_buttons_raw[2] self._device_prev_bank_button.name = u'Device_Prev_Bank_Button' self._device_next_bank_button = self._device_control_buttons_raw[3] self._device_next_bank_button.name = u'Device_Next_Bank_Button' self._device_on_off_button = self._device_control_buttons_raw[4] self._device_on_off_button.name = u'Device_On_Off_Button' self._device_lock_button = self._device_control_buttons_raw[5] self._device_lock_button.name = u'Device_Lock_Button' self._prev_device_button = self._device_control_buttons_raw[0] self._prev_device_button.name = u'Prev_Device_Button' self._next_device_button = self._device_control_buttons_raw[1] self._next_device_button.name = u'Next_Device_Button' self._clip_device_button = self._device_control_buttons_raw[6] self._clip_device_button.name = u'Clip_Device_Button' self._detail_view_button = self._device_control_buttons_raw[7] self._detail_view_button.name = u'Detail_View_Button' self._foot_pedal_button = DoublePressElement( make_pedal_button(64, name=u'Foot_Pedal')) self._shifted_matrix = ButtonMatrixElement( rows=recursive_map(self._with_shift, self._matrix_rows_raw)) self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]])
class BlockMod(MonOhm): __module__ = __name__ __doc__ = " Monomodular controller script for Livid Block " def __init__(self, *a, **k): self._shift_button = None #self._shift_pressed = 0 #self._shift_pressed_timer = 0 #self._shift_thresh = SHIFT_THRESH super(BlockMod, self).__init__(*a, **k) self._host_name = 'BlockMod' self._color_type = 'Monochrome' self._link_mixer = LINK_MIXER self._rgb = 1 self._ohm = 127 self._ohm_type = 'static' self._pad_translations = PAD_TRANSLATION self._mem = [4, 8, 12, 16] #self._host._navbox_selected = 8 """script initialization methods""" def _setup_monobridge(self): self._monobridge = MonoBridgeElement(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(2): self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDER_CC[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) #for index in range(8): # self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self) for index in range(8): self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, KNOB_CC[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, self) for index in range(4): self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FUNCTION_NOTES[index], 'Menu_' + str(index), self) #self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self) self._livid = DoublePressElement(MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)) self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', self) self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', 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] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + 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' def _setup_transport_control(self): self._transport = TransportComponent() self._transport.name = 'Transport' def _setup_crossfader(self): pass def _setup_modes(self): self._monomod_mode = MonomodModeComponent(self, self.monomod_mode_update) self._monomod_mode.name = 'Monomod_Mode' #self.set_shift_button(self._livid) self._on_shift_doublepress_value.subject = self._livid.double_press self._shift_mode = BlockModShiftModeComponent(self, self.shift_update) self._shift_mode.name = 'Shift_Mode' self._shift_mode.set_mode_toggle(self._shift_l, self._shift_r) self._l_function_mode = FunctionModeComponent(self, self.l_function_update) self._l_function_mode.name = 'Left_Function_Mode' self._r_function_mode = FunctionModeComponent(self, self.r_function_update) self._r_function_mode.name = 'Right_Function_Mode' self._m_function_mode = FunctionModeComponent(self, self.m_function_update) self._m_function_mode.name = 'Main_Function_Mode' self._function_modes = [self._l_function_mode, self._r_function_mode, self._m_function_mode] """livid double press mechanism""" def set_shift_button(self, button): assert ((button == None) or (isinstance(button, MonoButtonElement))) if self._shift_button != None: self._shift_button.remove_value_listener(self._shift_value) self._shift_button = button if self._shift_button != None: self._shift_button.add_value_listener(self._shift_value) def _shift_value(self, value): """self._shift_pressed = int(value != 0) if self._shift_pressed > 0: if (self._shift_pressed_timer + self._shift_thresh) > self._timer: if(self._host._active_client != None): if(self._host.is_enabled() != True): self._monomod_mode.set_mode(1) else: self._monomod_mode.set_mode(0) else: self._shift_pressed_timer = self._timer % 256""" @subject_slot('value') def _on_shift_doublepress_value(self, value): self._monomod_mode.set_mode(abs(self._monomod_mode._mode_index -1)) """shift/zoom methods""" def deassign_matrix(self): self._session_zoom.set_button_matrix(None) self._session_zoom2.set_button_matrix(None) #self._session.set_stop_track_clip_buttons(None) #self._session2.set_stop_track_clip_buttons(None) self._session_zoom_main.set_button_matrix(None) #self._session_main.set_stop_track_clip_buttons(None) for column in range(4): self._mixer2.channel_strip(column).set_select_button(None) self._mixer2.return_strip(column).set_mute_button(None) self._mixer2.return_strip(column).set_solo_button(None) self._mixer2.return_strip(column).set_arm_button(None) self._mixer2.return_strip(column).set_crossfade_toggle(None) self._mixer2.return_strip(column).set_select_button(None) #shouldn't this be somewhere else? self._mixer2.channel_strip(column).set_crossfade_toggle(None) self._mixer2.channel_strip(column).set_mute_button(None) self._mixer2.channel_strip(column).set_solo_button(None) self._mixer2.channel_strip(column).set_arm_button(None) for row in range(5): self._scene[row].clip_slot(column).set_launch_button(None) self._scene2[row].clip_slot(column).set_launch_button(None) for index in range(5): self._scene[index].set_launch_button(None) self._scene2[index].set_launch_button(None) self._scene_main[index].set_launch_button(None) self._session_zoom.set_nav_buttons(None, None, None, None) self._session_zoom2.set_nav_buttons(None, None, None, None) self._session_zoom_main.set_nav_buttons(None, None, None, None) self._session.set_track_bank_buttons(None, None) self._session.set_scene_bank_buttons(None, None) self._session2.set_track_bank_buttons(None, None) self._session2.set_scene_bank_buttons(None, None) self._session_main.set_track_bank_buttons(None, None) self._session_main.set_scene_bank_buttons(None, None) for column in range(8): self._mixer.channel_strip(column).set_select_button(None) self._mixer.channel_strip(column).set_crossfade_toggle(None) self._mixer.channel_strip(column).set_mute_button(None) self._mixer.channel_strip(column).set_solo_button(None) self._mixer.channel_strip(column).set_arm_button(None) for row in range(5): self._scene_main[row].clip_slot(column).set_launch_button(None) for row in range(8): self._grid[column][row].set_channel(0) self._grid[column][row].release_parameter() self._grid[column][row].use_default_message() self._grid[column][row].set_enabled(True) self._grid[column][row].set_on_off_values(127, 0) self._grid[column][row].send_value(0, True) self._send_reset.set_buttons(tuple(None for index in range(4))) def zoom_off(self): for column in range(4): self._grid[column][5].set_on_value(MUTE[self._rgb]) self._mixer.channel_strip(column).set_mute_button(self._grid[column][5]) self._grid[column][6].set_on_value(ARM[self._rgb]) self._mixer.channel_strip(column).set_arm_button(self._grid[column][6]) for row in range(5): self._scene[row].clip_slot(column).set_launch_button(self._grid[column][row]) if(self._r_function_mode._mode_index in range(0,3)): self._grid[column + 4][5].set_on_value(MUTE[self._rgb]) self._mixer2.channel_strip(column).set_mute_button(self._grid[column + 4][5]) self._grid[column + 4][6].set_on_value(ARM[self._rgb]) self._mixer2.channel_strip(column).set_arm_button(self._grid[column + 4][6]) for row in range(5): self._scene2[row].clip_slot(column).set_launch_button(self._grid[column + 4][row]) elif(self._r_function_mode._mode_index is 3): self._grid[column + 4][5].set_on_value(MUTE[self._rgb]) self._mixer2.return_strip(column).set_mute_button(self._grid[column + 4][5]) for row in range(5): self._grid[column + 4][row].send_value(USER1_COLOR[self._rgb], True) self._grid[column + 4][row].set_channel(RIGHT_USER1_CHANNEL) self._grid[column + 4][row].set_identifier(RIGHT_USER1_MAP[column][row]) self._grid[column + 4][row].set_enabled(False) #this has to happen for translate to work #self._session_zoom2.set_ignore_buttons(True) if(self._r_function_mode._mode_index is 0): for index in range(4): self._grid[index + 4][7].send_value(SEND_RESET[self._rgb], True) self._send_reset.set_buttons(tuple(self._grid[index + 4][7] for index in range(4))) def zoom_off_m(self): self.deassign_dials() for column in range(8): self._grid[column][5].set_on_value(MUTE[self._rgb]) self._mixer.channel_strip(column).set_mute_button(self._grid[column][5]) self._grid[column][6].set_on_value(ARM[self._rgb]) self._mixer.channel_strip(column).set_arm_button(self._grid[column][6]) for row in range(5): self._scene_main[row].clip_slot(column).set_launch_button(self._grid[column][row]) #self._session_zoom.set_button_matrix(self._matrix) def zoom_left(self): track_stop_buttons = [] track_stop_buttons2 = [] for index in range(4): self._grid[index][6].set_off_value(TRACK_STOP[self._rgb]) track_stop_buttons.append(self._grid[index][6]) self._grid[index + 4][6].set_off_value(TRACK_STOP[self._rgb]) track_stop_buttons2.append(self._grid[index + 4][6]) for index in range(5): self._grid[7][index].set_off_value(SCENE_LAUNCH[self._rgb]) self._scene[index].set_launch_button(self._grid[7][index]) #self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) #self._session.set_stop_track_clip_buttons(self._matrix.submatrix[:4][7:]) #self._session2.set_stop_track_clip_buttons(tuple(track_stop_buttons2)) #self._session2.set_stop_track_clip_buttons(self._matrix.submatrix[4:8][7:]) self._session_zoom.set_button_matrix(self._matrix) self._grid[0][5].set_on_value(RECORD[self._rgb]) self._transport.set_record_button(self._grid[0][5]) self._grid[1][5].set_on_value(OVERDUB[self._rgb]) self._transport.set_overdub_button(self._grid[1][5]) self._grid[2][5].set_on_value(LOOP[self._rgb]) self._transport.set_loop_button(self._grid[2][5]) self._grid[3][5].set_on_value(STOP_ALL[self._rgb]) self._session.set_stop_all_clips_button(self._grid[3][5]) for index in range(4): self._grid[index + 4][5].send_value(SEND_RESET[self._rgb], True) self._send_reset.set_buttons(tuple(self._grid[index + 4][5] for index in range(4))) for index in range(4): self._grid[index + 4][7].set_off_value(DEVICE_SELECT[self._rgb]) self._device_selector.set_matrix(self._monomod.submatrix[4:8][7:]) self._device_selector.set_offset(4) def zoom_right(self): track_stop_buttons = [] track_stop_buttons2 = [] for index in range(4): self._grid[index][6].set_off_value(TRACK_STOP[self._rgb]) track_stop_buttons.append(self._grid[index][6]) for index in range(5): self._grid[7][index].set_off_value(SCENE_LAUNCH[self._rgb]) self._scene2[index].set_launch_button(self._grid[7][index]) #self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) #self._session.set_stop_track_clip_buttons(self._matrix.submatrix[:4][7:]) if(self._r_function_mode._mode_index < 3): for index in range(4): self._grid[index + 4][6].set_off_value(TRACK_STOP[self._rgb]) track_stop_buttons2.append(self._grid[index + 4][6]) #self._session2.set_stop_track_clip_buttons(self._matrix.submatrix[4:8][7:]) #self._session2.set_stop_track_clip_buttons(tuple(track_stop_buttons2)) self._session_zoom2.set_button_matrix(self._matrix) self._grid[0][5].set_on_value(RECORD[self._rgb]) self._transport.set_record_button(self._grid[0][5]) self._grid[1][5].set_on_value(OVERDUB[self._rgb]) self._transport.set_overdub_button(self._grid[1][5]) self._grid[2][5].set_on_value(LOOP[self._rgb]) self._transport.set_loop_button(self._grid[2][5]) self._grid[3][5].set_on_value(STOP_ALL[self._rgb]) self._session.set_stop_all_clips_button(self._grid[3][5]) for index in range(4): self._grid[index + 4][5].send_value(SEND_RESET[self._rgb], True) self._send_reset.set_buttons(tuple(self._grid[index + 4][5] for index in range(4))) for index in range(4): self._grid[index][7].set_off_value(DEVICE_SELECT[self._rgb]) self._device_selector.set_matrix(self._monomod.submatrix[:4][7:]) self._device_selector.set_offset(0) def zoom_main(self): track_stop_buttons = [] for index in range(8): self._grid[index][6].set_on_value(TRACK_STOP[self._rgb]) track_stop_buttons.append(self._grid[index][6]) for index in range(5): self._grid[7][index].set_on_value(SCENE_LAUNCH[self._rgb]) self._scene_main[index].set_launch_button(self._grid[7][index]) #self._session_main.set_stop_track_clip_buttons(tuple(track_stop_buttons)) #self._session_main.set_stop_track_clip_buttons(self._matrix[0:8][7:]) self._session_zoom_main.set_button_matrix(self._matrix) self._grid[0][5].set_on_value(RECORD[self._rgb]) self._transport.set_record_button(self._grid[0][5]) self._grid[1][5].set_on_value(OVERDUB[self._rgb]) self._transport.set_overdub_button(self._grid[1][5]) self._grid[2][5].set_on_value(LOOP[self._rgb]) self._transport.set_loop_button(self._grid[2][5]) self._grid[3][5].set_on_value(STOP_ALL[self._rgb]) self._session.set_stop_all_clips_button(self._grid[3][5]) for index in range(4): self._grid[index + 4][5].send_value(SEND_RESET[self._rgb], True) self._send_reset.set_buttons(tuple(self._grid[index + 4][5] for index in range(4))) for index in range(4): self._grid[index + 4][7].set_off_value(DEVICE_SELECT[self._rgb]) self._device_selector.set_matrix(self._monomod.submatrix[4:8][7:]) self._device_selector.set_offset(4) """function mode callbacks""" def l_function_update(self): mode = self._l_function_mode._mode_index if(self._l_function_mode.is_enabled() is False): self._l_function_mode.set_mode_buttons(None) if not self.modhandler.is_enabled(): if(self._l_function_mode.is_enabled() is True): if(len(self._l_function_mode._modes_buttons) is 0): for index in range(4): self._mixer.channel_strip(index).set_select_button(None) buttons = [] for index in range(4): buttons.append(self._grid[index][7]) self._l_function_mode.set_mode_buttons(tuple(buttons)) if(self._shift_mode._mode_index is 2): for index in range(4): if(mode != index): self._grid[index][7].turn_off() else: self._grid[index][7].turn_on() if(mode is 0): self.assign_device_dials() self.show_message('Mixer Split:Dials Device Mode') elif(mode is 1): self.assign_send_dials() self.show_message('Mixer Split:Dials Send Mode') elif(mode is 2): self.assign_split_volume_dials() self.show_message('Mixer Split:Dials Volume Mode') elif(mode is 3): self.assign_user_dials() self.show_message('Mixer Split:Dials User Map Mode') def r_function_update(self): mode = self._r_function_mode._mode_index if(self._r_function_mode.is_enabled() is False): self._r_function_mode.set_mode_buttons(None) #self._session2.set_show_highlight(False) #self._session._highlighting_callback(self._session._track_offset, self._session._scene_offset, 4, 5, 1) if not self.modhandler.is_enabled(): if(self._r_function_mode.is_enabled() is True): if(len(self._r_function_mode._modes_buttons) is 0): for index in range(4): self._mixer2.channel_strip(index).set_select_button(None) buttons = [] for index in range(4): buttons.append(self._grid[index + 4][7]) self._r_function_mode.set_mode_buttons(tuple(buttons)) if(self._shift_mode._mode_index is 3): for index in range(4): if(mode != index): self._grid[index + 4][7].turn_off() else: self._grid[index + 4][7].turn_on() self._session2.set_offsets(int(self._mem[mode]), self._session2._scene_offset) self.show_message('Mixer Split: Track Offset' + str(RIGHT_MODE_OFFSETS[mode])) def m_function_update(self): mode = self._m_function_mode._mode_index if(self._m_function_mode.is_enabled() is False): self._m_function_mode.set_mode_buttons(None) #self._session.set_show_highlight(False) #self._session2.set_show_highlight(False) #self._session_main._highlighting_callback(self._session_main._track_offset, self._session_main._scene_offset, 8, 5, 1) if not self.modhandler.is_enabled(): if(self._m_function_mode.is_enabled() is True): if(len(self._m_function_mode._modes_buttons) is 0): for index in range(8): self._mixer.channel_strip(index).set_select_button(None) buttons = [] for index in range(4): buttons.append(self._grid[index][7]) self._m_function_mode.set_mode_buttons(tuple(buttons)) if(self._shift_mode._mode_index is 4): for index in range(4): if(mode != index): self._grid[index][7].turn_off() else: self._grid[index][7].turn_on() if(mode is 0): self.assign_device_dials() self.show_message('Mixer Linked:Dials Device Mode') elif(mode is 1): self.assign_send_dials() self.show_message('Mixer Linked:Dials Send Mode') elif(mode is 2): self.assign_volume_dials() self.show_message('Mixer Linked:Dials Volume Mode') elif(mode is 3): self.assign_user_dials() self.show_message('Mixer Linked:Dials User Map Mode') def shift_update(self): self._clutch_device_selection = True #self.allow_updates(False) #if(not self._in_build_midi_map): # self.set_suppress_rebuild_requests(True) self.deassign_channel_select_buttons() self.deassign_matrix() self.deassign_menu() if(self._monomod_mode._mode_index is 0): #if monomod is not on if(self._shift_mode._mode_index is 0): #if no shift is pressed self._shift_mode._mode_toggle1.turn_off() self._shift_mode._mode_toggle2.turn_off() if(self.split_mixer() is False): self.set_split_mixer(True) for zoom in self._zooms: zoom._on_zoom_value(0) self.zoom_off() self._device_selector.set_enabled(False) for mode in self._function_modes: mode.set_enabled(False) self.assign_channel_select_buttons() #self._recalculate_selected_channel() #self.assign_transport_to_menu() self.assign_session_nav_to_menu() self.l_function_update() self.r_function_update() self.assign_crossfader() self.set_highlighting_session_component(self._session) self._session._do_show_highlight() #self._session.set_show_highlight(True) elif(self._shift_mode._mode_index is 1): #if no shift is pressed, but mixer is linked self._shift_mode._mode_toggle1.turn_on() self._shift_mode._mode_toggle2.turn_on() if(self.split_mixer() is True): self.set_split_mixer(False) for zoom in self._zooms: zoom._on_zoom_value(0) self.zoom_off_m() self._device_selector.set_enabled(False) for mode in self._function_modes: mode.set_enabled(False) self.assign_main_channel_select_buttons() self.assign_session_main_nav_to_menu() self.m_function_update() self.assign_crossfader() self.set_highlighting_session_component(self._session_main) self._session_main._do_show_highlight() elif(self._shift_mode._mode_index > 1): #if a shift is pressed self.assign_device_nav_to_menu() self.deassign_channel_select_buttons() if(self._shift_mode._mode_index is 2): #if shift left self._shift_mode._mode_toggle1.turn_on() self.zoom_left() self._session_zoom._on_zoom_value(1) self._session.set_enabled(True) #this is a workaround so that the stop buttons still function self._l_function_mode.set_enabled(True) self.set_highlighting_session_component(self._session) self._session._do_show_highlight() elif(self._shift_mode._mode_index is 3): #if shift right self._shift_mode._mode_toggle2.turn_on() self.zoom_right() self._session_zoom2._on_zoom_value(1) self._session2.set_enabled(True) #this is a workaround so that the stop buttons still function self._r_function_mode.set_enabled(True) self.assign_master_fader() if(self._r_function_mode._mode_index < 4): self.set_highlighting_session_component(self._session2) self._session2._do_show_highlight() elif(self._shift_mode._mode_index is 4): #if either shift pressed while mixer is linked self._shift_mode._mode_toggle1.turn_on() self._shift_mode._mode_toggle2.turn_on() self.zoom_main() self._session_zoom_main._on_zoom_value(1) self._session_main.set_enabled(True) #this is a workaround so that the stop buttons still function self._m_function_mode.set_enabled(True) self.assign_master_fader() self.set_highlighting_session_component(self._session_main) self._session_main._do_show_highlight() self._device_selector.set_enabled(True) #self.modhandler._shift_value(int(self._shift_mode._mode_index>1)) else: for mode in self._function_modes: mode.set_enabled(False) self.allow_updates(True) #self.set_suppress_rebuild_requests(False) self._clutch_device_selection = False if(self._shift_mode._mode_index < 2): self._monobridge._send('touch', 'off') else: self._monobridge._send('touch', 'on') def monomod_mode_update(self): if(self._monomod_mode._mode_index == 0): self.modhandler.set_enabled(False) self.modhandler.set_grid(None) self.modhandler.set_nav_buttons(None) self.modhandler.set_shiftlock_button(None) self.modhandler.set_alt_button(None) self._livid.turn_off() self._shift_mode.set_mode_toggle(self._shift_l, self._shift_r) self._shift_mode.update() #self._session._reassign_scenes() elif(self._monomod_mode._mode_index == 1): self._livid.turn_on() self.deassign_matrix() self.deassign_menu() #self._monomod.reset() self.modhandler.set_grid(self._monomod) self.modhandler.set_nav_buttons(self._menu[0:4]) self.modhandler.set_shiftlock_button(self._shift_l) self.modhandler.set_alt_button(self._shift_r) self.modhandler.set_shift_button(self._livid) self.modhandler.set_enabled(True) self._shift_mode.set_mode_toggle(None, None) #self._shift_mode.update() self.show_message('Monomod grid enabled') """left control management methods""" def deassign_dials(self): for index in range(8): self._dial[index].use_default_message() self._dial[index].release_parameter() self._dial[index].set_enabled(True) if(self._device._parameter_controls != None): for control in self._device._parameter_controls: control.release_parameter() self._device._parameter_controls = None self._mixer.selected_strip().set_send_controls(None) self._mixer.selected_strip().set_volume_control(None) for track in range(4): self._mixer.channel_strip(track).set_volume_control(None) self._mixer.channel_strip(track+4).set_volume_control(None) self._mixer2.channel_strip(track).set_volume_control(None) self._mixer2.return_strip(track).set_volume_control(None) def assign_device_dials(self): self._ohm_type = OHM_TYPE[0] self._ohm = OHM_VALUE[0] self.deassign_dials() self._device.set_enabled(True) device_param_controls = [] for index in range(8): device_param_controls.append(self._dial[index]) self._device.set_parameter_controls(tuple(device_param_controls)) self._mixer.selected_strip().set_volume_control(self._fader[0]) def assign_send_dials(self): self._ohm_type = OHM_TYPE[1] self._ohm = OHM_VALUE[1] self.deassign_dials() dials = [] for index in range(4): dials.append(self._dial[index]) for index in range(4): if(self._mixer2.return_strip(index)): self._mixer2.return_strip(index).set_volume_control(self._dial[index + 4]) self._mixer.selected_strip().set_send_controls(tuple(dials)) self._mixer.selected_strip().set_volume_control(self._fader[0]) def assign_volume_dials(self): self._ohm_type = OHM_TYPE[2] self._ohm = OHM_VALUE[2] self.deassign_dials() for track in range(8): self._mixer.channel_strip(track).set_volume_control(self._dial[track]) self._mixer.selected_strip().set_volume_control(self._fader[0]) def assign_split_volume_dials(self): self._ohm_type = OHM_TYPE[2] self._ohm = OHM_VALUE[2] self.deassign_dials() for track in range(4): self._mixer.channel_strip(track).set_volume_control(self._dial[track]) self._mixer2.channel_strip(track).set_volume_control(self._dial[track+4]) self._mixer.selected_strip().set_volume_control(self._fader[0]) def assign_user_dials(self): self._ohm_type = OHM_TYPE[3] self._ohm = OHM_VALUE[3] self.deassign_dials() for index in range(8): self._dial[index].set_channel(L_USER_DIAL_CHAN) self._dial[index].set_identifier(L_USER_DIAL_MAP[index]) self._dial[index].set_enabled(False) self._mixer.selected_strip().set_volume_control(self._fader[0]) """menu button management methods""" def deassign_menu(self): self._device.set_lock_button(None) self._device.set_on_off_button(None) self._device_navigator.set_device_nav_buttons(None, None) self._device.set_bank_nav_buttons(None, None) self._transport.set_play_button(None) self._transport.set_record_button(None) self._transport.set_stop_button(None) self._transport.set_loop_button(None) self._transport.set_overdub_button(None) self._session.set_stop_all_clips_button(None) self._transport.set_play_button(None) self._transport.set_stop_button(None) self._session_main.set_track_bank_buttons(None, None) self._session_main.set_scene_bank_buttons(None, None) def assign_device_nav_to_menu(self): self._device_navigator.set_device_nav_buttons(self._menu[2], self._menu[3]) self._device.set_bank_nav_buttons(self._menu[0], self._menu[1]) def assign_transport_to_menu(self): self._transport.set_play_button(self._menu[0]) self._transport.set_record_button(self._menu[2]) self._transport.set_stop_button(self._menu[1]) session.set_stop_all_clips_button(self._menu[3]) def assign_session_nav_to_menu(self): self._session.set_track_bank_buttons(self._menu[3], self._menu[2]) self._session.set_scene_bank_buttons(self._menu[1], self._menu[0]) def assign_monomod_shift_to_menu(self): self._device_navigator.set_device_nav_buttons(self._menu[3], self._menu[2]) self._device.set_bank_nav_buttons(self._menu[1], self._menu[0]) def assign_session_bank_to_menu(self): self._session.set_track_bank_buttons(self._menu[3], self._menu[2]) self._session.set_scene_bank_buttons(self._menu[1], self._menu[0]) def assign_session2_bank_to_menu(self): self._session2.set_track_bank_buttons(self._menu[3], self._menu[2]) self._session2.set_scene_bank_buttons(self._menu[1], self._menu[0]) def assign_session_main_nav_to_menu(self): self._session_main.set_track_bank_buttons(self._menu[3], self._menu[2]) self._session_main.set_scene_bank_buttons(self._menu[1], self._menu[0]) """channel selection management methods""" def deassign_channel_select_buttons(self): for index in range(8): if(self._mixer.channel_strip(index)): self._mixer.channel_strip(index).set_select_button(None) self._grid[index][7].release_parameter() for index in range(4): self._mixer2.channel_strip(index).set_select_button(None) self._mixer2.return_strip(index).set_select_button(None) self._mixer2.master_strip().set_select_button(None) self._grid[index + 4][7].release_parameter() def assign_channel_select_buttons(self): for index in range(4): #if(self._mixer.channel_strip(index)): self._grid[index][7].set_on_off_values(127, 0) self._mixer.channel_strip(index).set_select_button(self._grid[index][7]) if(self._r_function_mode._mode_index < 3): for index in range(4): self._grid[index][7].set_on_off_values(127, 0) self._mixer2.channel_strip(index).set_select_button(self._grid[index + 4][7]) else: for index in range(4): self._grid[index][7].set_on_off_values(1, 0) self._mixer2.return_strip(index).set_select_button(self._grid[index + 4][7]) def assign_return_select_buttons(self): for index in range(4): self._grid[index + 4][7].set_off_value(0) if(self._mixer.channel_strip(index)): self._grid[index + 4][7].set_on_value(1) self._mixer.channel_strip(index).set_select_button(self._grid[index + 4][7]) def assign_l_channel_select_buttons(self): self._mixer.set_select_buttons(None, None) self._session.set_select_buttons(None, None) for index in range(4): self._grid[index][7].set_off_value(0) if(self._mixer.channel_strip(index)): self._mixer.channel_strip(index).set_select_button(self._grid[index][7]) def assign_r_channel_select_buttons(self): self._mixer2.set_select_buttons(None, None) self._session2.set_select_buttons(None, None) for index in range(4): self._grid[index + 4][7].set_off_value(0) if(self._mixer2.channel_strip(index)): self._mixer2.channel_strip(index).set_select_button(self._grid[index + 4][7]) def assign_main_channel_select_buttons(self): for index in range(8): self._grid[index][7].set_off_value(0) if(self._mixer.channel_strip(index)): self._grid[index][7].set_on_value(127) self._mixer.channel_strip(index).set_select_button(self._grid[index][7]) def assign_master_fader(self): self._mixer.set_crossfader_control(None) self._mixer.master_strip().set_volume_control(self._fader[1]) def assign_crossfader(self): self._mixer.master_strip().set_volume_control(None) self._mixer.set_crossfader_control(self._fader[1]) """called on timer""" def update_display(self): super(BlockMod, self).update_display() if(self._timer == 0): self._shift_pressed_timer = -12 def strobe(self): if(self._ohm_type != 'static'): if(self._ohm_type is 'pulse'): self._ohm = int(math.fabs(((self._timer * 8) % 64) -32) +32) if(self._ohm_type is 'up'): self._ohm = int(((self._timer * 4) % 64) + 16) if(self._ohm_type is 'down'): self._ohm = int(math.fabs(int(((self._timer * 4) % 64) - 64)) + 16) self._send_midi(tuple([176, 63, int(self._ohm)])) self._send_midi(tuple([176, 31, int(self._ohm)])) def handle_sysex(self, midi_bytes): pass def _on_session_offset_changes(self): if self._r_function_mode._mode_index in range(0,4): self._mem[int(self._r_function_mode._mode_index)] = self._session2.track_offset() # a