X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=scripts%2Ftomsloop.lua;h=ea06e486e9009d2ecbab9397634362c17678494b;hb=b1d7eabf541eb157268e0165ef27160423073f4d;hp=56fec4262f4745df39ed7333ce8b5219c27ba1c8;hpb=26118af1a47ff48a34ba80f53db572b7bd54c628;p=ardour.git diff --git a/scripts/tomsloop.lua b/scripts/tomsloop.lua index 56fec4262f..ea06e486e9 100644 --- a/scripts/tomsloop.lua +++ b/scripts/tomsloop.lua @@ -171,7 +171,7 @@ function factory (params) return function () local itt = ARDOUR.InterThreadInfo () -- bounce progress info (unused) local loop = Session:locations ():auto_loop_location () - local playhead = Session:transport_frame () + local playhead = Session:transport_sample () -- make sure we have a loop, and the playhead (edit point) is after it if not loop then @@ -180,7 +180,7 @@ function factory (params) return function () goto errorout end assert (loop:start () < loop:_end ()) - if loop:_end () >= playhead then + if loop:_end () > playhead then print_help(); print ("Error: The Playhead (paste point) needs to be after the loop.") goto errorout @@ -248,7 +248,7 @@ function factory (params) return function () -- do the actual work local region = track:bounce_range (loop:start (), loop:_end (), itt, proc, false) - playlist:add_region (region, playhead, n_paste, false, 0, false) + playlist:add_region (region, playhead, n_paste, false, 0, 0, false) n_regions_created = n_regions_created + 1 @@ -278,3 +278,42 @@ function factory (params) return function () ::errorout:: end -- end of anonymous action script function end -- end of script factory + + +function icon (params) return function (ctx, width, height) + local x = width * .5 + local y = height * .5 + local r = math.min (x, y) + + ctx:set_line_width (1) + + function stroke_outline () + ctx:set_source_rgba (0, 0, 0, 1) + ctx:stroke_preserve () + ctx:set_source_rgba (1, 1, 1, 1) + ctx:fill () + end + + ctx:rectangle (x - r * .6, y - r * .05, r * .6, r * .3) + stroke_outline () + + ctx:arc (x, y, r * .61, math.pi, 0.2 * math.pi) + ctx:arc_negative (x, y, r * .35, 0.2 * math.pi, math.pi); + stroke_outline () + + function arc_arrow (rad, ang) + return x - rad * math.sin (ang * 2.0 * math.pi), y - rad * math.cos (ang * 2.0 * math.pi) + end + + ctx:move_to (arc_arrow (r * .36, .72)) + ctx:line_to (arc_arrow (r * .17, .72)) + ctx:line_to (arc_arrow (r * .56, .60)) + ctx:line_to (arc_arrow (r * .75, .72)) + ctx:line_to (arc_arrow (r * .62, .72)) + + ctx:set_source_rgba (0, 0, 0, 1) + ctx:stroke_preserve () + ctx:close_path () + ctx:set_source_rgba (1, 1, 1, 1) + ctx:fill () +end end