示例#1
0
    def scroll_position(self, go_next):
        # type: (Scene, bool) -> None
        from protocol0.lom.Scene import Scene

        if Scene.LAST_MANUALLY_STARTED_SCENE != self:
            Scene.LAST_MANUALLY_STARTED_SCENE_BAR_POSITION = 0
            Scene.LAST_MANUALLY_STARTED_SCENE = self
        scene_position = Scene.LAST_MANUALLY_STARTED_SCENE_BAR_POSITION

        if self.has_playing_clips:
            bar_position = self.playing_position * self.song.signature_numerator
            rounded_bar_position = floor(bar_position) if go_next else round(
                bar_position)
            scene_position = int(
                scroll_values(range(0, self.bar_length),
                              rounded_bar_position,
                              go_next=go_next))
            self.jump_to_bar(scene_position)
        else:
            scene_position = scroll_values(range(0, self.bar_length),
                                           scene_position,
                                           go_next=go_next)

        Scene.LAST_MANUALLY_STARTED_SCENE_BAR_POSITION = scene_position
        self.scene_name.update(bar_position=scene_position)
示例#2
0
 def scroll_presets(self, go_next):
     # type: (bool) -> None
     """" unused atm """
     self.parent.navigationManager.focus_detail()
     self.is_collapsed = False
     selected_preset = scroll_values(self.presets, self.selected_preset,
                                     go_next)
     self.selected_preset_index = self.presets.index(selected_preset)
示例#3
0
 def scroll_preset_categories(self, go_next):
     # type: (AbstractInstrument, bool) -> None
     if not len(self._preset_list.categories):
         self.parent.show_message("this instrument does not have categories")
         return
     self.parent.navigationManager.show_device_view()
     self._preset_list.selected_category = scroll_values(
         self._preset_list.categories, self._preset_list.selected_category, go_next
     ).lower()
     if self.PRESET_DISPLAY_OPTION == PresetDisplayOptionEnum.CATEGORY:
         self.track.abstract_track.track_name.update()
     else:
         self.parent.show_message("selected preset category %s" % self._preset_list.selected_category.title())
    def scroll_tracks(self, go_next):
        # type: (Song, bool) -> None
        if not self.song.selected_track.IS_ACTIVE:
            next(self.song.simple_tracks).select()
            return None

        next_track = scroll_values(self.scrollable_tracks,
                                   self.current_track,
                                   go_next,
                                   rotate=False)
        if next_track:
            next_track.select()
            if next_track == list(self.scrollable_tracks)[-1]:
                self.parent.sessionManager.toggle_session_ring()
    def scroll_automation_envelopes(self, go_next):
        # type: (bool) -> None
        selected_clip = self.song.selected_clip
        if not selected_clip:
            self.parent.show_message("No playable clip")
            return
        automated_parameters = selected_clip.automated_parameters
        if len(automated_parameters) == 0:
            self.parent.show_message("No automated parameters")
            return
        if selected_clip.displayed_automated_parameter is None:
            selected_clip.displayed_automated_parameter = automated_parameters[
                0]
        else:
            selected_clip.displayed_automated_parameter = scroll_values(
                automated_parameters,
                selected_clip.displayed_automated_parameter, go_next)

        self.display_selected_parameter_automation(selected_clip)
    def scroll_duplicate_scene_bar_lengths(cls, go_next):
        # type: (bool) -> None
        from protocol0 import Protocol0
        selected_scene = Protocol0.SELF.protocol0_song.selected_scene
        if selected_scene.length < 2:
            Protocol0.SELF.log_warning(
                "Cannot partial duplicate scene with length %s (min 2 bars)" % selected_scene.length)
            return
        bar_lengths = []
        power = 0
        while pow(2, power) <= selected_scene.bar_length / 2:
            bar_lengths += [pow(2, power), -pow(2, power)]
            power += 1
        bar_lengths.sort()
        log_ableton("bar_lengths: %s" % bar_lengths)

        from protocol0.lom.Scene import Scene
        Scene.SELECTED_DUPLICATE_SCENE_BAR_LENGTH = scroll_values(
            bar_lengths, Scene.SELECTED_DUPLICATE_SCENE_BAR_LENGTH, go_next
        )
        cls.show_selected_bar_length("SCENE DUPLICATE", Scene.SELECTED_DUPLICATE_SCENE_BAR_LENGTH)
 def scroll_recording_time(cls, go_next):
     # type: (bool) -> None
     cls.SELECTED_RECORDING_BAR_LENGTH = scroll_values(
         list(BarLengthEnum), cls.SELECTED_RECORDING_BAR_LENGTH, go_next
     )
     cls.show_selected_bar_length("RECORDING", cls.SELECTED_RECORDING_BAR_LENGTH)
 def scroll_scenes(self, go_next):
     # type: (Song, bool) -> None
     scroll_values(self.scenes, self.selected_scene, go_next,
                   rotate=False).select()