Lua Signals (eg. On Record)

Where can I find available Lua signals? Are they tied to function names in the source code? I’d like to run a script to record from webcams when record is rolling. Does anyone know the appropriate Lua.Singal? I guess I’ll also need one to kill the process when the transports stops.
Cheers
John

https://manual.ardour.org/lua-scripting/class_reference/#LuaSignal.LuaSignal

You’ll want TransportStateChange and/or RecordStateChanged.

The following example should get you going. However synchronization will be tricky. The webcam will start shortly after ardour is recording.

ardour {  ["type"] = "EditorHook", name = "Tally Light Trigger" }

function signals ()
  return LuaSignal.Set():add ({[LuaSignal.RecordStateChanged] = true})
end

function factory () return function (signal)
  if Session:actively_recording (true) then
    os.execute ('/usr/bin/lights_on');
  else
    os.execute ('/usr/bin/lights_off');
  end
end end

Also have a look at some of the examples: https://github.com/Ardour/ardour/blob/master/share/scripts/_osc_hook_example.lua perhaps

Thanks for the pointers, I’ve had some success doing it the other way round - running a bash script to launch a couple of ffmpeg instances then sending mmc record to ardour. It’d be nice not to have to switch away from ardour though.

Is there any way to see the system console output of os.execute()?
Also is there some kind of unique id ardour gives to new regions? So I could pass the id and name the videos accordingly?

The regions are not created till capture finishes. Only the files used for capture have names at that point (and it’s not actually wise to even rely on that). All objects do have unique IDs but they are for internal use only and cannot be utilized meaningfully by anything else.

No, not directly. I suggest to call a script that starts things in the background and redirects the output to log file.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.