View Issue Details

IDProjectCategoryView StatusLast Update
0008115ardourbugspublic2020-05-28 22:13
Reporterdaniel.appelt Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformSome Other LinuxOSSome Other LinuxOS Versionunknown
Product Version6.0-pre1 
Summary0008115: Lua: adding an event to an automation list creates unwanted events
DescriptionEvery time that I try to add an event (using ARDOUR:AutomationList's add method in Lua) at time x to an automation list that already contains events later in time (> x), actually three events are created at time x:
  1) an event having the value provided to add (as expected)
  2) an event having the same value as the event following in the automation list
  3) an event having the same value as the event preceeding in the automation list (or the initial value of the automation list).

This behaviour is prevalent regardless of the value provided for parameters three and four of the add method (with_guards, with_initials).

The expected behaviour if false is provided for parameters three and four is that only a single event point is added.
Steps To ReproduceCreate a new MIDI track in Ardour using instrument "a-Fluid Synth".
Create a MIDI region. Add a duplicate of the MIDI region.
Add at least one processor automation event for the first parameter of a-Fluid Synth (Output Level) in the second region.

Select the first MIDI region, and run the Lua script attached to this report which will add a new event at the beginning of the first region having value -36.

In my expectation the following statement in the given script is supposed to produce only a single event point in the automation list:
al:add(region:position() - region:start(), -36, false, false)

Instead three event points are created as described above.
Tagsautomation, Lua

Activities

daniel.appelt

2020-05-15 14:57

reporter  

automation_issue.lua (950 bytes)   
-- Use a-Fluid Synth, parameter Output Level to test
local region = nil
for r in Editor:get_selection().regions:regionlist():iter() do
   if region == nil then region = r end
end

-- Bail out if no region was selected
if region == nil then
   LuaDialog.Message("Automation issue", "Please select a region first!",
		     LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run()
   return
end

-- Identify the track the region belongs to. There really is no better way?!
local track = nil
for route in Session:get_tracks():iter() do
   for r in route:to_track():playlist():region_list():iter() do
      if r == region then track = route:to_track() end
   end
end

-- Get automation of first parameter for first plugin on selected track
proc = track:nth_plugin(0)
local al, _, pd = ARDOUR.LuaAPI.plugin_automation(proc, 0)

-- Add a new automation point at the beginning of the region
al:add(region:position() - region:start(), -36, false, false)
automation_issue.lua (950 bytes)   

daniel.appelt

2020-05-17 13:17

reporter   ~0024178

As it turns out the Lua method editor_add() of Evoral:ControlList leads to the desired result, i.e. no unwanted extranous event points.

Now, I see two things that should be looked into:

1.) The add() method seems to create guard points although with_guards was set to false.
2.) Documentation / explanation of editor_add() is missing in the Lua Bindings Class Reference in the Ardour manual.

x42

2020-05-17 13:30

administrator   ~0024179

ControlList::add () is indeed intended to write automation in realtime. There is an explicit case: `/* if the transport is stopped, add guard points */` (and also various checks if there's ongoing write-pass).
So using editor_add() seems indeed appropriate for your case.

Documentation is created from doxygen (libs/evoral/evoral/ControlList.h) and sadly a lot of methods are not documented :(

daniel.appelt

2020-05-28 22:13

reporter   ~0024296

https://github.com/Ardour/ardour/pull/515 clarifies the documentation.

Issue History

Date Modified Username Field Change
2020-05-15 14:57 daniel.appelt New Issue
2020-05-15 14:57 daniel.appelt Tag Attached: automation
2020-05-15 14:57 daniel.appelt Tag Attached: Lua
2020-05-15 14:57 daniel.appelt File Added: automation_issue.lua
2020-05-17 13:17 daniel.appelt Note Added: 0024178
2020-05-17 13:30 x42 Note Added: 0024179
2020-05-28 22:13 daniel.appelt Status new => closed
2020-05-28 22:13 daniel.appelt Resolution open => fixed
2020-05-28 22:13 daniel.appelt Note Added: 0024296