Fix Tom's Loop

-There's no 'printf' (!)
-New: Use LuaDialog to tell error cases instead of printing help to the log window.
This commit is contained in:
Thomas Brand 2020-11-08 22:30:21 +01:00 committed by Robin Gareus
parent 0e509fa09f
commit 275a37ff39
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 4 additions and 5 deletions

View File

@ -9,8 +9,6 @@ function factory (params) return function ()
-- when this script is called as an action, the output will be printed to the ardour log window -- when this script is called as an action, the output will be printed to the ardour log window
function print_help() function print_help()
printf("See source for help.")
---[[
print("") print("")
print("---------------------------------------------------------------------") print("---------------------------------------------------------------------")
print("") print("")
@ -157,7 +155,6 @@ function factory (params) return function ()
print("See also: Lua Action Bounce+Replace Regions") print("See also: Lua Action Bounce+Replace Regions")
print("") print("")
print("") print("")
--]]
end -- print_help() end -- print_help()
local n_paste = 1 local n_paste = 1
@ -171,14 +168,16 @@ function factory (params) return function ()
-- make sure we have a loop, and the playhead (edit point) is after it -- make sure we have a loop, and the playhead (edit point) is after it
if not loop then if not loop then
print_help(); -- print_help();
print ("Error: A Loop range must be set.") print ("Error: A Loop range must be set.")
LuaDialog.Message ("Tom's Loop", "Error: A Loop range must be set.", LuaDialog.MessageType.Error, LuaDialog.ButtonType.Close):run ()
goto errorout goto errorout
end end
assert (loop:start () < loop:_end ()) assert (loop:start () < loop:_end ())
if loop:_end () > playhead then if loop:_end () > playhead then
print_help(); -- print_help();
print ("Error: The Playhead (paste point) needs to be after the loop.") print ("Error: The Playhead (paste point) needs to be after the loop.")
LuaDialog.Message ("Tom's Loop", "Error: The Playhead (paste point) needs to be after the loop.", LuaDialog.MessageType.Error, LuaDialog.ButtonType.Close):run ()
goto errorout goto errorout
end end