mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Second round of Lua script API updates
This commit is contained in:
parent
1abf6a77d6
commit
76c0f42ecb
23 changed files with 76 additions and 112 deletions
|
|
@ -91,16 +91,12 @@ function factory () return function ()
|
|||
if ec:isnil () then goto next end
|
||||
if ec:list ():events ():size () == 0 then goto next end
|
||||
|
||||
-- MIDI events are timestamped in "bar-beat" units, we need to convert those
|
||||
-- using the tempo-map, relative to the region-start
|
||||
local bfc = ARDOUR.BeatsSamplesConverter (Session:tempo_map (), r:start ())
|
||||
|
||||
-- iterate over CC-events
|
||||
for av in ec:list ():events ():iter () do
|
||||
-- re-scale event to target range
|
||||
local val = pd.lower + (pd.upper - pd.lower) * av.value / 127
|
||||
-- and add it to the target-parameter automation-list
|
||||
al:add (r:position () - r:start () + bfc:to (av.when), val, false, true)
|
||||
al:add (r:position () - r:start () + av.when, val, false, true)
|
||||
add_undo = true
|
||||
end
|
||||
::next::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue