Fix gmsynth detection
[ardour.git] / scripts / session_template_advanced.lua
1 ardour {
2         ["type"]    = "SessionInit",
3         name        = "Advanced Session",
4         description = [[Allows to configure master-bus and autoconnect]],
5         master_bus  = 0
6 }
7
8 function factory () return function ()
9
10         local auto_connect_in = {
11                 [0] = "Manually",
12                 [1] = "automatically to physical inputs",
13         }
14
15         local auto_connect_out = {
16                 [0] = "Manually",
17                 [1] = "automatically to physical outputs",
18                 [2] = "automatically to master bus",
19         }
20
21         local dialog_options = {
22                 { type = "heading", title = "Customize Session: " .. Session:name () },
23                 { type = "number",   key = "master",    title = "Master bus channels",  min = 0, max = 24, step = 1, digits = 0, default = 2 },
24                 { type = "checkbox", key = "monitor",   title = "Add monitor section", default = ARDOUR.config():get_use_monitor_bus () },
25                 { type = "dropdown", key = "ac_input",  title = "Autoconnect Inputs",
26                         values = {
27                                 [auto_connect_in[0]] = 0,
28                                 [auto_connect_in[1]] = 1,
29                         },
30                         default = auto_connect_in[ARDOUR.config():get_input_auto_connect ()]
31                 },
32                 { type = "dropdown", key = "ac_output", title = "Autoconnect Outputs",
33                         values = {
34                                 [auto_connect_out[0]] = 0,
35                                 [auto_connect_out[1]] = 1,
36                                 [auto_connect_out[2]] = 2,
37                         },
38                         default = auto_connect_out[ARDOUR.config():get_output_auto_connect ()]
39                 },
40         }
41
42         local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
43         local rv = dlg:run()
44         if (not rv) then return end
45
46         if rv['master'] > 0 then
47                 local count = ARDOUR.ChanCount ( ARDOUR.DataType("audio"), rv['master'])
48                 Session:add_master_bus (count)
49         end
50
51         if rv['monitor'] then
52                 Session:add_monitor_section ()
53         end
54
55         ARDOUR.config():set_input_auto_connect (rv['ac_input'])
56         ARDOUR.config():set_output_auto_connect (rv['ac_output'])
57
58         Session:save_state("");
59 end end