summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-09-28 04:25:50 +0200
committerRobin Gareus <robin@gareus.org>2017-09-29 05:03:48 +0200
commit1339d42c787f07417b9b88c5b3d3925037d0c7e4 (patch)
tree80c96c7ff8ed13935f33d4a1e1625cecf271ee9b /scripts
parent2b20f30d81c3371e58c69c3bbc836767ff7e81d1 (diff)
Add DiskIOProc & Latency related Lua bindings & scripts
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_dump_latency.lua57
-rw-r--r--scripts/s_portengine.lua8
2 files changed, 56 insertions, 9 deletions
diff --git a/scripts/_dump_latency.lua b/scripts/_dump_latency.lua
index 79b043bfa5..d21af36804 100644
--- a/scripts/_dump_latency.lua
+++ b/scripts/_dump_latency.lua
@@ -4,14 +4,59 @@ ardour { ["type"] = "Snippet", name = "Dump Latency",
}
function factory () return function ()
+ local all_procs = true
+ local show_ports = false
+
print (" -- Session --")
print ("Worst Output Latency: ", Session:worst_output_latency ())
print ("Worst Input Latency: ", Session:worst_input_latency ())
- print ("Worst Track Latency: ", Session:worst_track_latency ())
- print ("Worst Playback Latency:", Session:worst_playback_latency ())
- print (" -- Tracks --")
- for t in Session:get_tracks ():iter () do
- print (string.format ("%-24s roll-delay: %4d proc: %4d io: %4d",
- t:name(), t:initial_delay (), t:signal_latency (), t:output():latency()))
+ print ("Worst Track Latency: ", Session:worst_route_latency ())
+ print ("Worst Latency Preroll: ", Session:worst_latency_preroll ())
+
+ print (" -- Routes --")
+ for t in Session:get_routes ():iter () do
+ print (string.format ("%-30s signal-latency: %4d align: %4d play: %4d || in: %4d out: %4d",
+ t:name(),
+ t:signal_latency (), t:playback_latency (false), t:playback_latency (true),
+ t:input():latency(), t:output():latency()))
+ local i = 0
+ while true do
+ local proc = t:nth_processor (i)
+ if proc:isnil () then break end
+ if all_procs and not proc:to_send():isnil () then
+ print (string.format (" * %-27s L: %4d in: %4d out: %4d capt: %4d play %4d DLY-SRC: %4d DLY-DST: %4d",
+ string.sub (proc:name(), 0, 27) , proc:signal_latency(),
+ proc:input_latency(), proc:output_latency(),
+ proc:capture_offset(), proc:playback_offset(),
+ proc:to_send():get_delay_in(), proc:to_send():get_delay_out()
+ ))
+ elseif all_procs or not proc:to_diskioprocessor():isnil () then
+ print (string.format (" * %-27s L: %4d in: %4d out: %4d capt: %4d play %4d",
+ string.sub (proc:name(), 0, 27) , proc:signal_latency(),
+ proc:input_latency(), proc:output_latency(),
+ proc:capture_offset(), proc:playback_offset()
+ ))
+ end
+ i = i + 1
+ end
+ end
+
+ if show_ports then
+ print (" -- Ports -- (latencies: port, priv, pub)")
+ local a = Session:engine()
+ _, t = a:get_ports (ARDOUR.DataType("audio"), ARDOUR.PortList())
+ -- table 't' holds argument references. t[2] is the PortList
+ for p in t[2]:iter() do
+ local lp = p:get_connected_latency_range (ARDOUR.LatencyRange(), true)
+ local lc = p:get_connected_latency_range (ARDOUR.LatencyRange(), false)
+ local ppl = p:private_latency_range (true)
+ local pcl = p:private_latency_range (false)
+ local bpl = p:public_latency_range (true)
+ local bcl = p:public_latency_range (false)
+ print (string.format ("%-30s play: (%4d, %4d) (%4d, %4d) (%4d, %4d) capt: (%4d, %4d) (%4d, %4d) (%4d, %4d)",
+ p:name(),
+ lp[1].min, lp[1].max, ppl.min, ppl.max, bpl.min, bpl.max,
+ lc[1].min, lc[1].max, pcl.min, pcl.max, bcl.min, bcl.max))
+ end
end
end end
diff --git a/scripts/s_portengine.lua b/scripts/s_portengine.lua
index 5bbcabdf3f..ebca9ff696 100644
--- a/scripts/s_portengine.lua
+++ b/scripts/s_portengine.lua
@@ -1,12 +1,14 @@
ardour { ["type"] = "Snippet", name = "portengine" }
function factory () return function ()
- a = Session:engine()
+ local a = Session:engine()
print ("----- Port objects from Ardour's engine ----");
_, t = a:get_ports (ARDOUR.DataType("audio"), ARDOUR.PortList())
-- table 't' holds argument references. t[2] is the PortList
for p in t[2]:iter() do
- print (p:name())
+ local lp = p:get_connected_latency_range (ARDOUR.LatencyRange(), true)
+ local lc = p:get_connected_latency_range (ARDOUR.LatencyRange(), false)
+ print (p:name(), " -- Play lat.", lp[1].min, lp[1].max, "Capt lat.", lc[1].min, lc[1].max)
end
print ("----- Port names queries from the backend ----");
@@ -20,7 +22,7 @@ function factory () return function ()
_, t = a:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput, C.StringVector())
for n in t[4]:iter() do
local printed_name = false;
- _, ct = a:get_connections (n, C.StringVector())
+ local _, ct = a:get_connections (n, C.StringVector())
for c in ct[2]:iter() do
if (not printed_name) then
printed_name = true;