Fix crash when closing session, recursive mon-section removal
[ardour.git] / scripts / tomsloop.lua
index 6b643506d43fcadaef82fa2ebd6b3adfdc253919..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, false)
+               playlist:add_region (region, playhead, n_paste, false, 0, 0, false)
 
                n_regions_created = n_regions_created + 1