File: session_template_advanced.lua

package info (click to toggle)
ardour 1%3A5.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 74,708 kB
  • sloc: cpp: 512,951; xml: 123,656; ansic: 65,010; python: 22,599; sh: 5,368; asm: 1,347; perl: 888; php: 770; makefile: 253; objc: 28
file content (59 lines) | stat: -rw-r--r-- 1,754 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ardour {
	["type"]    = "SessionInit",
	name        = "Advanced Session",
	description = [[Allows to configure master-bus and autoconnect]],
	master_bus  = 0
}

function factory () return function ()

	local auto_connect_in = {
		[0] = "Manually",
		[1] = "automatically to physical inputs",
	}

	local auto_connect_out = {
		[0] = "Manually",
		[1] = "automatically to physical outputs",
		[2] = "automatically to master bus",
	}

	local dialog_options = {
		{ type = "heading", title = "Customize Session: " .. Session:name () },
		{ type = "number",   key = "master",    title = "Master bus channels",  min = 0, max = 24, step = 1, digits = 0, default = 2 },
		{ type = "checkbox", key = "monitor",   title = "Add monitor section", default = ARDOUR.config():get_use_monitor_bus () },
		{ type = "dropdown", key = "ac_input",  title = "Autoconnect Inputs",
			values = {
				[auto_connect_in[0]] = 0,
				[auto_connect_in[1]] = 1,
			},
			default = auto_connect_in[ARDOUR.config():get_input_auto_connect ()]
		},
		{ type = "dropdown", key = "ac_output", title = "Autoconnect Outputs",
			values = {
				[auto_connect_out[0]] = 0,
				[auto_connect_out[1]] = 1,
				[auto_connect_out[2]] = 2,
			},
			default = auto_connect_out[ARDOUR.config():get_output_auto_connect ()]
		},
	}

	local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
	local rv = dlg:run()
	if (not rv) then return end

	if rv['master'] > 0 then
		local count = ARDOUR.ChanCount ( ARDOUR.DataType("audio"), rv['master'])
		Session:add_master_bus (count)
	end

	if rv['monitor'] then
		Session:add_monitor_section ()
	end

	ARDOUR.config():set_input_auto_connect (rv['ac_input'])
	ARDOUR.config():set_output_auto_connect (rv['ac_output'])

	Session:save_state("");
end end