diff options
author | Robin Gareus <robin@gareus.org> | 2016-04-26 17:51:48 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-04-26 18:16:14 +0200 |
commit | 09e5730ffdb89838e97e56da33e561c1be09b5d4 (patch) | |
tree | 8159138e73fa1296df92aaad0cfaee07bf4979c6 | |
parent | 5227f57f2eeb66b01756f1d2d26db96c358b2af1 (diff) |
lua snippet to interact with portengine
-rw-r--r-- | scripts/s_portengine.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/s_portengine.lua b/scripts/s_portengine.lua new file mode 100644 index 0000000000..5bbcabdf3f --- /dev/null +++ b/scripts/s_portengine.lua @@ -0,0 +1,33 @@ +ardour { ["type"] = "Snippet", name = "portengine" } +function factory () return function () + + 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()) + end + + print ("----- Port names queries from the backend ----"); + _, t = a:get_backend_ports ("", ARDOUR.DataType("audio"), 0, C.StringVector()) + -- table 't' holds argument references. t[4] is the StringVector + for n in t[4]:iter() do + print (n) + end + + print ("----- Connections from the backend ----"); + _, 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()) + for c in ct[2]:iter() do + if (not printed_name) then + printed_name = true; + print (n) + end + print (" ->", c) + end + end + +end end |