mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Add some more Lua script examples
This commit is contained in:
parent
e983e08f1d
commit
8fbc2c6484
3 changed files with 92 additions and 0 deletions
32
scripts/_session_load_hook.lua
Normal file
32
scripts/_session_load_hook.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
ardour {
|
||||
["type"] = "EditorHook",
|
||||
name = "Load Session Hook Example",
|
||||
author = "Ardour Lua Task Force",
|
||||
description = "Display some dialogs during session load and execute actions",
|
||||
}
|
||||
|
||||
-- subscribe to signals
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#LuaSignal.LuaSignal
|
||||
function signals ()
|
||||
s = LuaSignal.Set()
|
||||
s:add ({[LuaSignal.SetSession] = true})
|
||||
return s
|
||||
end
|
||||
|
||||
-- create callback functions
|
||||
function factory () return function (signal, ...)
|
||||
assert (signal == LuaSignal.SetSession)
|
||||
local md = LuaDialog.Message ("Set Session", "Loading Session:" .. Session:name(), LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close)
|
||||
md:run()
|
||||
|
||||
local dialog_options = {
|
||||
{ type = "checkbox", key = "tempo", default = true, title = "Show Tempo Ruler" },
|
||||
{ type = "checkbox", key = "meter", default = true, title = "Show Meter Ruler" },
|
||||
}
|
||||
local dlg = LuaDialog.Dialog ("Tweak Rulers", dialog_options)
|
||||
local rv = dlg:run()
|
||||
if (rv) then
|
||||
Editor:set_toggleaction ("Rulers", "toggle-tempo-ruler", rv['tempo'])
|
||||
Editor:set_toggleaction ("Rulers", "toggle-meter-ruler", rv['meter'])
|
||||
end
|
||||
end end
|
||||
Loading…
Add table
Add a link
Reference in a new issue