Skip silent sources on session-archive -- fixes #7699
[ardour.git] / scripts / tomsloop.lua
index 7087d3c2884d0b911e317ed62acaadbd57652438..ea06e486e9009d2ecbab9397634362c17678494b 100644 (file)
@@ -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)
+               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