mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Use editor_add to avoid unwanted event points
This commit is contained in:
parent
fb9aa647bb
commit
2e7992dd58
1 changed files with 5 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
ardour {
|
ardour {
|
||||||
["type"] = "EditorAction",
|
["type"] = "EditorAction",
|
||||||
name = "Add LFO automation to region",
|
name = "Add LFO automation to region",
|
||||||
version = "0.2.0",
|
version = "0.2.1",
|
||||||
license = "MIT",
|
license = "MIT",
|
||||||
author = "Daniel Appelt",
|
author = "Daniel Appelt",
|
||||||
description = [[Add LFO-like plugin automation to any automatable parameter below a selected region]]
|
description = [[Add LFO-like plugin automation to any automatable parameter below a selected region]]
|
||||||
|
|
@ -134,11 +134,7 @@ function factory (unused_params)
|
||||||
Session:begin_reversible_command("Add LFO automation to region")
|
Session:begin_reversible_command("Add LFO automation to region")
|
||||||
local before = al:get_state() -- save previous state (for undo)
|
local before = al:get_state() -- save previous state (for undo)
|
||||||
-- Clear events in target automation-list for the selected region.
|
-- Clear events in target automation-list for the selected region.
|
||||||
-- al:clear(region:position() - region:start(), region:position() - region:start() + region:length())
|
al:clear(region:position() - region:start(), region:position() - region:start() + region:length())
|
||||||
-- TODO: Clearing automation events only for the region generally leads to strange
|
|
||||||
-- extranous automation events (see https://tracker.ardour.org/view.php?id=8115).
|
|
||||||
-- For now, we just truncate the automation-list in order to avoid this problem.
|
|
||||||
al:truncate_end(region:position() - region:start())
|
|
||||||
|
|
||||||
local values = lut[wave]
|
local values = lut[wave]
|
||||||
local last = nil
|
local last = nil
|
||||||
|
|
@ -156,8 +152,9 @@ function factory (unused_params)
|
||||||
|
|
||||||
if k > 1 or v ~= last then
|
if k > 1 or v ~= last then
|
||||||
-- Create automation point re-scaled to parameter target range. Do not create a new point
|
-- Create automation point re-scaled to parameter target range. Do not create a new point
|
||||||
-- at cycle start if the last cycle ended on the same value.
|
-- at cycle start if the last cycle ended on the same value. Using al:add seems to lead
|
||||||
al:add(pos, lower + v * (upper - lower), false, true)
|
-- to unwanted extranous events. al:editor_add does not exhibit these side effects.
|
||||||
|
al:editor_add(pos, lower + v * (upper - lower), false)
|
||||||
end
|
end
|
||||||
last = v
|
last = v
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue