summaryrefslogtreecommitdiff
path: root/scripts/post_export_save_hook.lua
blob: 3b31ee320b92d4441093e6d031abbecf531043a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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