3 # Example script to prepare the Ardour session for recording
5 Usually there's a certain state needed to actually start the recording. This example
6 script treats the situation of a podcast recording. When starting the recording the
7 following settings have to be ensured.
9 * Session has to be recenabled
10 * Tracks have to be recenabled
11 * Gain automation have to set on write in order to record events from mute buttons
12 * The playhead has to be at 00:00:00.000
13 * The last (failed) capture has to be cleared
14 * Location markers have to be cleared
16 So this script automizes away the task and lets the podcast moderator by just one
17 action (for example triggerd by a Wiimote) prepare the session for recording.
19 It can be used for example with the python script of the Linux podcasting hacks:
20 https://github.com/linux-podcasting-hacks/wiimote-recording-control
22 Not that this script is more meant as an demo script to demonstrate the
23 possibilities of the Lua interface.
28 ["type"] = "EditorAction",
29 name = "Prepare recording for podcast",
30 author = "Johannes Mueller",
32 Prepares the Ardour session for podcast recording.
34 * Sets the gain automation to "Write" so that muting buttons work.
35 * Recenables all tracks.
37 * Erases the last capture (assuming that it was a failed one)
38 * Rewinds the session to starting point.
39 * Recenables the session.
43 function factory (unused) return function()
44 if Session:actively_recording() then
47 for t in Session:get_tracks():iter() do
48 t:gain_control():set_automation_state(ARDOUR.AutoState.Write)
49 t:rec_enable_control():set_value(1, PBD.GroupControlDisposition.UseGroup)
52 for l in Session:locations():list():iter() do
54 Session:locations():remove(l)
59 Editor:remove_last_capture()
60 Session:maybe_enable_record()
64 function icon (params) return function (ctx, width, height)
67 local r = math.min (x, y) * .55
69 ctx:arc (x, y, r, 0, 2 * math.pi)
70 ctx:set_source_rgba (.9, .3, .3, 1.)
72 ctx:set_source_rgba (0, 0, 0, .8)
73 ctx:set_line_width (1)
76 local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(r * 1.5) .. "px")
78 local tw, th = txt:get_pixel_size ()
79 ctx:set_source_rgba (0, 0, 0, 1.0)
80 ctx:move_to (.5 * (width - tw), .5 * (height - th))
81 txt:show_in_cairo_context (ctx)