From 85d741d9085a043982523c0309e64eb7a22f8d51 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 14 Mar 2017 03:29:03 +0100 Subject: Bundle a session-callback script --- scripts/_post_export_save_hook.lua | 26 -------------------------- scripts/post_export_save_hook.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 scripts/_post_export_save_hook.lua create mode 100644 scripts/post_export_save_hook.lua diff --git a/scripts/_post_export_save_hook.lua b/scripts/_post_export_save_hook.lua deleted file mode 100644 index 47b4861149..0000000000 --- a/scripts/_post_export_save_hook.lua +++ /dev/null @@ -1,26 +0,0 @@ -ardour { - ["type"] = "EditorHook", - name = "Save Snapshot after Export", - author = "Ardour Lua Task Force", - description = "Snapshot after Export", -} - --- 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 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 -- cgit v1.2.3