diff --git a/actions.py b/actions.py index 959e942..2ccfb41 100644 --- a/actions.py +++ b/actions.py @@ -240,6 +240,10 @@ class Actions(object): def seek_back_on_player(self): self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value'])) + def seek_to_location_on_player(self, position): + print("seek_to_location_on_player passed %s" % position) + self.video_driver.current_player.seek_percent(position) + def toggle_function(self): self.data.function_on = not self.data.function_on diff --git a/json_objects/midi_action_mapping_APC Key 25.json b/json_objects/midi_action_mapping_APC Key 25.json index 71ac2a8..7c2a101 100644 --- a/json_objects/midi_action_mapping_APC Key 25.json +++ b/json_objects/midi_action_mapping_APC Key 25.json @@ -41,7 +41,7 @@ }, "control_change 48": { "DEFAULT": ["set_the_shader_param_0_layer_offset_0_continuous","set_strobe_amount_continuous"], - "NAV_DETOUR": ["set_detour_speed_position_continuous"], + "NAV_DETOUR": ["set_detour_speed_position_continuous", "seek_to_location_on_player"], "NAV_WJMX": ["wj_set_position_N:x"], "NAV_MANI": ["set_variable_A"], "NAV_LPRC": ["set_automation_speed"], diff --git a/video_centre/alt_video_player.py b/video_centre/alt_video_player.py index e7d281a..7800269 100644 --- a/video_centre/alt_video_player.py +++ b/video_centre/alt_video_player.py @@ -118,6 +118,12 @@ class AltVideoPlayer: else: self.message_handler.set_message('INFO', 'can not seek outside range') + def seek_percent(self, percent): + # convert % to absolute position in current clip + duration = self.end - self.start + pos = duration * percent + self.set_position(self.start + pos) + def change_rate(self, amount): if self.rate is None: self.rate = 1 diff --git a/video_centre/video_player.py b/video_centre/video_player.py index 034f9ab..a205a0a 100644 --- a/video_centre/video_player.py +++ b/video_centre/video_player.py @@ -155,6 +155,12 @@ class VideoPlayer: else: self.message_handler.set_message('INFO', 'can not seek outside range') + def seek_percent(self, percent): + # convert % to absolute position in current clip + duration = self.end - self.start + pos = duration * percent + self.set_position(self.start + pos) + def change_rate(self, amount): new_rate = self.rate + amount if (new_rate > self.omx_player.minimum_rate() and new_rate < self.omx_player.maximum_rate()):