summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2016-09-10 22:38:07 +0200
committerRobin Gareus <robin@gareus.org>2016-09-12 11:10:40 +0200
commitba0eb858bcd610fe67a5a5aad8a3c8156fabb296 (patch)
tree9ab29e8f6833f85336acc087ad3f361a07a2ce10 /scripts
parente54ae0217004c524998905b5e14a045052dfdcce (diff)
Example script to prepare the session to record
Often one needs to make sure that all the relevant settings are made before one actually starts recording. The Lua interface can take care of this task easily, that the operater by just one action can make sure that the relevant settings (e.g. recenables, playhead position, etc.) are ready for recording. This example was written with a quasi live podcast scenario in mind. See `scripts/prepare_record_example.lua` for details.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/preare_record_example.lua62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/preare_record_example.lua b/scripts/preare_record_example.lua
new file mode 100644
index 0000000000..9c3d6cc3e8
--- /dev/null
+++ b/scripts/preare_record_example.lua
@@ -0,0 +1,62 @@
+--[[
+
+# Example script to prepare the Ardour session for recording
+
+Usually there's a certain state needed to actually start the recording. This example
+script treats the situation of a podcast recording. When starting the recording the
+following settings have to be ensured.
+
+* Session has to be recenabled
+* Tracks have to be recenabled
+* Gain automation have to set on write in order to record events from mute buttons
+* The playhead has to be at 00:00:00.000
+* The last (failed) capture has to be cleared
+* Location markers have to be cleared
+
+So this script automizes away the task and lets the podcast moderator by just one
+action (for example triggerd by a Wiimote) prepare the session for recording.
+
+It can be used for example with the python script of the Linux podcasting hacks:
+https://github.com/linux-podcasting-hacks/wiimote-recording-control
+
+Not that this script is more meant as an demo script to demonstrate the
+possibilities of the Lua interface.
+
+--]]
+
+ardour {
+ ["type"] = "EditorAction",
+ name = "Prepare recording for podcast",
+ author = "Johannes Mueller",
+ description = [[
+Prepares the Ardour session for podcast recording.
+
+* Sets the gain automation to "Write" so that muting buttons work.
+* Recenables all tracks.
+* Clears all markers.
+* Erases the last capture (assuming that it was a failed one)
+* Rewinds the session to starting point.
+* Recenables the session.
+]]
+}
+
+function factory (unused) return function()
+ if Session:actively_recording() then
+ return end
+
+ for t in Session:get_tracks():iter() do
+ t:gain_control():set_automation_state(ARDOUR.AutoState.Write)
+ t:rec_enable_control():set_value(1, PBD.GroupControlDisposition.UseGroup)
+ end
+
+ for l in Session:locations():list():iter() do
+ if l:is_mark() then
+ Session:locations():remove(l)
+ end
+ end
+
+ Session:goto_start()
+ Editor:remove_last_capture()
+ Session:maybe_enable_record()
+
+end end