summaryrefslogtreecommitdiff
path: root/scripts/post_export_save_hook.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-14 03:29:03 +0100
committerRobin Gareus <robin@gareus.org>2017-03-14 03:29:03 +0100
commit85d741d9085a043982523c0309e64eb7a22f8d51 (patch)
tree6d473d6e2f03008f8ce955305b1889db833d3c9a /scripts/post_export_save_hook.lua
parent248521221c51f159255f947a5646b746c981c2b7 (diff)
Bundle a session-callback script
Diffstat (limited to 'scripts/post_export_save_hook.lua')
-rw-r--r--scripts/post_export_save_hook.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/post_export_save_hook.lua b/scripts/post_export_save_hook.lua
new file mode 100644
index 0000000000..3b31ee320b
--- /dev/null
+++ b/scripts/post_export_save_hook.lua
@@ -0,0 +1,26 @@
+ardour {
+ ["type"] = "EditorHook",
+ name = "Save Snapshot after Export",
+ author = "Ardour Lua Task Force",
+ description = "Save a session-snapshot on export, named after the export-timespan",
+}
+
+-- subscribe to signals
+-- http://manual.ardour.org/lua-scripting/class_reference/#LuaSignal.LuaSignal
+function signals ()
+ s = LuaSignal.Set()
+ s:add ({[LuaSignal.Exported] = true})
+ return s
+end
+
+-- create callback functions
+function factory ()
+ -- callback function which invoked when signal is emitted
+ return function (signal, ref, ...)
+ -- 'Exported' passes 2 strings: current time-span name, path to exported file
+ -- (see C++ libs/ardour/export_handler.cc Session::Exported )
+ local timespan_name, file_path = ...
+ -- save session -- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Session
+ Session:save_state ("export-" .. timespan_name, false, false, false)
+ end
+end