From 883859f91c166b9269e8d8df244ff987d9895b77 Mon Sep 17 00:00:00 2001 From: bitingsock Date: Sun, 24 Sep 2017 12:40:41 -0700 Subject: [PATCH] attempts to add my optional leadin (#2) * attempts to add my optional leadin speed will return to normal an optional number of seconds before the subs appear. Has worked for me so far, would you mind testing? * Update speed-transition.lua * Update speed-transition.lua --- speed-transition.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/speed-transition.lua b/speed-transition.lua index a65d0e6..b20fcbe 100644 --- a/speed-transition.lua +++ b/speed-transition.lua @@ -1,6 +1,7 @@ lookahead=5 --if nextsub >= lookahead then speedup normalspeed=mp.get_property_native("speed") speedup=2.5 +leadin=1 ------------------- state=0 @@ -41,8 +42,8 @@ function add_timers(nextsub) if nextsub ~= 0 then --make sure we reset the speed on the unlikely case when a timer fires --within one second of the next sub - if nextsub - 1 > 0 then - mp.add_timeout((nextsub-1)/speedup, reset_early) + if nextsub - leadin > 0 then + mp.add_timeout((nextsub-leadin)/speedup, reset_early) else restore_normalspeed() end @@ -50,7 +51,7 @@ function add_timers(nextsub) elseif nextsub == 0 then --search for next sub after time_out seconds, when its position might be known if not mp.get_property_native("pause") and set_timeout() - 1 > 0 then - mp.add_timeout((time_out-1)/speedup, search_next_sub) + mp.add_timeout((time_out-leadin)/speedup, search_next_sub) end end end