Ejemplo n.º 1
0
 def __init__(self, c_instance):
     """ Define and Initialise standard behaviour """
     object.__init__(self)
     self._c_instance = c_instance
     self._midi_map_handle = None
     self._pad_translations = None
     self._suggested_input_port = str('')
     self._suggested_output_port = str('')
     self._modes = []
     self._components = []
     self._displays = []
     self._controls = []
     self._device_component = None
     self._forwarding_registry = {}
     self._timer_callbacks = []
     self._scheduled_messages = []
     self._in_build_midi_map = False
     self._suppress_requests_counter = 0
     self._rebuild_requests_during_suppression = 0
     ControlSurfaceComponent.set_song_and_application(self.song(), self.application())
     ControlElement.set_register_control_callback(self._register_control)
     ControlElement.set_send_midi_callback(self._send_midi)
     InputControlElement.set_mapping_callback(self._install_mapping)
     InputControlElement.set_forwarding_callback(self._install_forwarding)
     InputControlElement.set_translation_callback(self._translate_message)
     ControlSurfaceComponent.set_register_component_callback(self._register_component)
     ControlSurfaceComponent.set_register_timer_notification_callback(self._register_timer_callback)
     ControlSurfaceComponent.set_unregister_timer_notification_callback(self._unregister_timer_callback)
     ControlSurfaceComponent.set_request_rebuild_callback(self.request_rebuild_midi_map)
     SessionComponent.set_highlighting_callback(self._set_session_highlight)
     self.song().add_tracks_listener(self._on_track_list_changed)
     self.song().add_scenes_listener(self._on_scene_list_changed)
     self.song().view.add_selected_track_listener(self._on_selected_track_changed)
     self.song().view.add_selected_scene_listener(self._on_selected_scene_changed)
Ejemplo n.º 2
0
    def disconnect(self):
        """ Live -> Script: Called right before we get disconnected from Live """
        for message in self._scheduled_messages:
            if (message['Parameter'] != None):
                message['Message'](message['Parameter'])
            else:
                message['Message']()

        self._scheduled_messages = None
        self._forwarding_registry = None
        for component in self._components:
            component.disconnect()

        for control in self._controls:
            control.disconnect()

        self._controls = None
        self._components = None
        self._displays = None
        self._timer_callbacks = None
        self._device_component = None
        self._pad_translations = None
        ControlElement.release_class_attributes()
        InputControlElement.release_class_attributes()
        ControlSurfaceComponent.release_class_attributes()
        SessionComponent.release_class_attributes()
        self.song().remove_tracks_listener(self._on_track_list_changed)
        self.song().remove_scenes_listener(self._on_scene_list_changed)
        self.song().view.remove_selected_track_listener(self._on_selected_track_changed)
        self.song().view.remove_selected_scene_listener(self._on_selected_scene_changed)
Ejemplo n.º 3
0
    def disconnect(self):
        """ Live -> Script: Called right before we get disconnected from Live """
        for message in self._scheduled_messages:
            if (message['Parameter'] != None):
                message['Message'](message['Parameter'])
            else:
                message['Message']()

        self._scheduled_messages = None
        self._forwarding_registry = None
        for component in self._components:
            component.disconnect()

        for control in self._controls:
            control.disconnect()

        self._controls = None
        self._components = None
        self._displays = None
        self._timer_callbacks = None
        self._device_component = None
        self._pad_translations = None
        ControlElement.release_class_attributes()
        InputControlElement.release_class_attributes()
        ControlSurfaceComponent.release_class_attributes()
        SessionComponent.release_class_attributes()
        self.song().remove_tracks_listener(self._on_track_list_changed)
        self.song().remove_scenes_listener(self._on_scene_list_changed)
        self.song().view.remove_selected_track_listener(
            self._on_selected_track_changed)
        self.song().view.remove_selected_scene_listener(
            self._on_selected_scene_changed)
Ejemplo n.º 4
0
 def __init__(self, c_instance, publish_self=True):
     """ Define and Initialise standard behaviour """
     object.__init__(self)
     self.canonical_parent = None
     if publish_self:
         if isinstance(__builtins__, dict):
             if CS_LIST_KEY not in __builtins__.keys():
                 __builtins__[CS_LIST_KEY] = []
             __builtins__[CS_LIST_KEY].append(self)
         else:
             if not hasattr(__builtins__, CS_LIST_KEY):
                 setattr(__builtins__, CS_LIST_KEY, [])
             cs_list = getattr(__builtins__, CS_LIST_KEY)
             cs_list.append(self)
             setattr(__builtins__, CS_LIST_KEY, cs_list)
     self._c_instance = c_instance
     self._midi_map_handle = None
     self._pad_translations = None
     self._suggested_input_port = str('')
     self._suggested_output_port = str('')
     self._modes = []
     self.components = []
     self._displays = []
     self.controls = []
     self._device_component = None
     self._device_selection_follows_track_selection = False
     self._forwarding_registry = {}
     self._timer_callbacks = []
     self._scheduled_messages = []
     self._in_build_midi_map = False
     self._suppress_requests_counter = 0
     self._rebuild_requests_during_suppression = 0
     self._enabled = True
     self._components_to_leave_disabled = None
     ControlSurfaceComponent.set_song_and_application(self.song(), self.application())
     ControlElement.set_register_control_callback(self._register_control)
     ControlElement.set_send_midi_callback(self._send_midi)
     InputControlElement.set_mapping_callback(self._install_mapping)
     InputControlElement.set_forwarding_callback(self._install_forwarding)
     InputControlElement.set_translation_callback(self._translate_message)
     ControlSurfaceComponent.set_register_component_callback(self._register_component)
     ControlSurfaceComponent.set_request_rebuild_callback(self.request_rebuild_midi_map)
     ControlSurfaceComponent.set_show_message_callback(self.show_message)
     ControlSurfaceComponent.set_register_timer_notification_callback(self._register_timer_callback)
     ControlSurfaceComponent.set_unregister_timer_notification_callback(self._unregister_timer_callback)
     SessionComponent.set_highlighting_callback(self._set_session_highlight)
     self.song().add_visible_tracks_listener(self._on_track_list_changed)
     self.song().add_scenes_listener(self._on_scene_list_changed)
     self.song().view.add_selected_track_listener(self._on_selected_track_changed)
     self.song().view.add_selected_scene_listener(self._on_selected_scene_changed)
     return None
 def _create_session(self):
     self._session = SessionComponent(
         SESSION_WIDTH,
         SESSION_HEIGHT,
         auto_name=True,
         enable_skinning=True,
         is_enabled=False,
         layer=Layer(track_bank_left_button=self._left_button,
                     track_bank_right_button=self._right_button,
                     scene_bank_up_button=self._up_button,
                     scene_bank_down_button=self._down_button,
                     stop_all_clips_button=self._stop_all_button,
                     stop_track_clip_buttons=self._track_stop_buttons,
                     scene_launch_buttons=self._scene_launch_buttons,
                     clip_launch_buttons=self._session_matrix,
                     slot_launch_button=self._selected_slot_launch_button,
                     selected_scene_launch_button=self.
                     _selected_scene_launch_button))
     self._session_zoom = SessionZoomingComponent(
         self._session,
         name='Session_Overview',
         enable_skinning=True,
         is_enabled=False,
         layer=Layer(button_matrix=self._shifted_matrix,
                     nav_up_button=self._with_shift(self._up_button),
                     nav_down_button=self._with_shift(self._down_button),
                     nav_left_button=self._with_shift(self._left_button),
                     nav_right_button=self._with_shift(self._right_button),
                     scene_bank_buttons=self._shifted_scene_buttons))
Ejemplo n.º 6
0
 def __init__(self, c_instance):
     """ Define and Initialise standard behaviour """
     object.__init__(self)
     self._c_instance = c_instance
     self._midi_map_handle = None
     self._pad_translations = None
     self._suggested_input_port = str('')
     self._suggested_output_port = str('')
     self._modes = []
     self._components = []
     self._displays = []
     self._controls = []
     self._device_component = None
     self._forwarding_registry = {}
     self._timer_callbacks = []
     self._scheduled_messages = []
     self._in_build_midi_map = False
     self._suppress_requests_counter = 0
     self._rebuild_requests_during_suppression = 0
     ControlSurfaceComponent.set_song_and_application(
         self.song(), self.application())
     ControlElement.set_register_control_callback(self._register_control)
     ControlElement.set_send_midi_callback(self._send_midi)
     InputControlElement.set_mapping_callback(self._install_mapping)
     InputControlElement.set_forwarding_callback(self._install_forwarding)
     InputControlElement.set_translation_callback(self._translate_message)
     ControlSurfaceComponent.set_register_component_callback(
         self._register_component)
     ControlSurfaceComponent.set_register_timer_notification_callback(
         self._register_timer_callback)
     ControlSurfaceComponent.set_unregister_timer_notification_callback(
         self._unregister_timer_callback)
     ControlSurfaceComponent.set_request_rebuild_callback(
         self.request_rebuild_midi_map)
     SessionComponent.set_highlighting_callback(self._set_session_highlight)
     self.song().add_tracks_listener(self._on_track_list_changed)
     self.song().add_scenes_listener(self._on_scene_list_changed)
     self.song().view.add_selected_track_listener(
         self._on_selected_track_changed)
     self.song().view.add_selected_scene_listener(
         self._on_selected_scene_changed)
Ejemplo n.º 7
0
 def disconnect(self):
     """ Live -> Script: Called right before we get disconnected from Live """        
     for message in self._scheduled_messages:
         if message['Parameter'] != None:
             message['Message'](message['Parameter'])
         else:
             message['Message']()
     self._scheduled_messages = None
     self._forwarding_registry = None
     for component in self.components:
         component.disconnect()
     for control in self.controls:
         control.disconnect()
     self.controls = None
     self.components = None
     self._displays = None
     self._timer_callbacks = None
     self._device_component = None
     self._pad_translations = None
     ControlElement.release_class_attributes()
     InputControlElement.release_class_attributes()
     ControlSurfaceComponent.release_class_attributes()
     SessionComponent.release_class_attributes()
     self.song().remove_visible_tracks_listener(self._on_track_list_changed)
     self.song().remove_scenes_listener(self._on_scene_list_changed)
     self.song().view.remove_selected_track_listener(self._on_selected_track_changed)
     self.song().view.remove_selected_scene_listener(self._on_selected_scene_changed)
     if isinstance(__builtins__, dict):
         if CS_LIST_KEY not in __builtins__.keys():
             __builtins__[CS_LIST_KEY] = []
         if self in __builtins__[CS_LIST_KEY]:
             __builtins__[CS_LIST_KEY].remove(self)
     else:
         if hasattr(__builtins__, CS_LIST_KEY):
             cs_list = getattr(__builtins__, CS_LIST_KEY)
             if self in cs_list:
                 cs_list.remove(self)
                 setattr(__builtins__, CS_LIST_KEY, cs_list)
     return None