Hi everyone,
I am trying to write CC automation data to a MIDI region via a Lua script with full undo support. I was looking into the midi_cc_to_automation.lua and lfo_automation.lua scripts bundled with Ardour for guidance. I am already able to delete stuff from an existing midi region’s cc parameters via midi_region:control (EvoralParameter (...)): list()
and its methods, but I struggle to add undo support for the script (the Control
type’s list()
doesn’t have a get_state()
method).
The scripts linked above use the plugin_automation()
utility function of the track the region in question belongs to to get access to an AutomationControl
type which offers undo/redo functionality via the get_state()
method, but I struggle to find an equivalent for generic MIDI CC automation.
I was trying to do the following:
local automation_list = track:nth_processor (0):to_automatable (): automation_control (
Evoral.Parameter (ARDOUR.AutomationType.MidiCCAutomation, midi_channel, midi_cc),
false):alist ()
but this only results in a shared_ptr is nil
error.
I guess that I might have not yet fully grasped the scripting interface, and guess that I am likely poking at the wrong end. Can anybody tell me what to do in order to achieve what I want?