mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Add example script to access midi-region events
This commit is contained in:
parent
6ceade76b3
commit
448bc635e5
1 changed files with 21 additions and 0 deletions
21
scripts/_dump_midiregion.lua
Normal file
21
scripts/_dump_midiregion.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
ardour { ["type"] = "Snippet", name = "Dump MIDI Region" }
|
||||||
|
|
||||||
|
function factory () return function ()
|
||||||
|
local sel = Editor:get_selection ()
|
||||||
|
for r in sel.regions:regionlist ():iter () do
|
||||||
|
local mr = r:to_midiregion ()
|
||||||
|
if mr:isnil () then goto next end
|
||||||
|
|
||||||
|
print (r:name (), "Pos:", r:position (), "Start:", r:start ())
|
||||||
|
local bfc = ARDOUR.BeatsFramesConverter (Session:tempo_map (), r:position ())
|
||||||
|
local nl = ARDOUR.LuaAPI.note_list (mr:model ())
|
||||||
|
for n in nl:iter () do
|
||||||
|
print (" Note @", bfc:to (n:time ()),
|
||||||
|
ARDOUR.ParameterDescriptor.midi_note_name (n:note ()),
|
||||||
|
"Vel:", n:velocity ())
|
||||||
|
end
|
||||||
|
print ("----")
|
||||||
|
::next::
|
||||||
|
end
|
||||||
|
end end
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue