lua: add midi bus

Hello

Using lua, I would like to add a new MIDI bus, and route the output of other MIDI channels into the input of this bus.
Is it doable in lua?

If possible, could you provide some pointers to functions I could use?

Thank you
Eric

A bus is an ARDOUR:Route in Lua. You might start there in the docs http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route

Creating tracks or busses is a Session operation. For a MIDI Bus: Session:new_midi_route() – Note: the arguments to that function changed recently so best check the source:

For inspiration, here’s a script which creates audio-busses and connects them: fan_out_instrument.lua: https://github.com/Ardour/ardour/blob/master/scripts/_fan_out_instrument.lua#L48

Thank you
I’ll try and post an example file if I succeed.

Regards VCAs is there a method for creating these with lua? Presumably they are Routes, but I can’t seem to get VCAs lke I can with audio tracks, midi tracks and buses. Can’t see the info in Lua Bindings Class Reference. Any help much appreciated.

(Didn’t want to start a new thread (sorry I’m new to the forum so don’t know the exact protocol. Paul please move/delete as necessary)