LUA enable MIDI Input

Hi, another LUA question/

How does one toggle the status of the “Enable/Disable MIDI Input” of a MIDI track (the MIDI plug icon) ?

image

While I can successfully connect the input I want to that track using the MidiPort:connect method; I thought the MidiPort:set_input_active (bool) method would be the one to toggle that switch but nothing happens …

Any hints ?

function factory () return function ()
	local sel = Editor:get_selection ()
	-- for each selected track/bus
	for r in sel.tracks:routelist ():iter () do
		if not r:to_track ():isnil () and not r:to_track ():to_midi_track ():isnil () then
			local inputmidiport = r:input():midi(0)
			inputmidiport:disconnect_all()
			inputmidiport:connect("Hydrogen-midi:TX")
			inputmidiport:set_input_active(true)
		end
	end
end end

It would require MidiTrack::set_input_active() to be exported to Lua, which at this time it is not.

1 Like

That explains it; it’s a feature of the track, not the port. Got it.
Thanks Paul ! I’ll raise a (non urgent) feature request.

Already done in git master.

2 Likes

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