mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-13 18:16:35 +01:00
update MIDIEvent lua bindings/example
This commit is contained in:
parent
3ab200acaa
commit
e8cd2949bd
2 changed files with 4 additions and 3 deletions
|
|
@ -1303,6 +1303,7 @@ LuaBindings::dsp (lua_State* L)
|
||||||
.addFunction ("size", &Evoral::Event<framepos_t>::size)
|
.addFunction ("size", &Evoral::Event<framepos_t>::size)
|
||||||
.addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
|
.addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
|
||||||
.addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
|
.addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
|
||||||
|
.addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
.beginClass <Evoral::Beats> ("Beats")
|
.beginClass <Evoral::Beats> ("Beats")
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
||||||
if ib ~= ARDOUR.ChanMapping.Invalid then
|
if ib ~= ARDOUR.ChanMapping.Invalid then
|
||||||
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:MidiBuffer
|
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:MidiBuffer
|
||||||
local mb = bufs:get_midi (ib) -- get the mapped buffer
|
local mb = bufs:get_midi (ib) -- get the mapped buffer
|
||||||
events = mb:table () -- copy event list into a lua table
|
local events = mb:table () -- copy event list into a lua table
|
||||||
|
|
||||||
-- iterate over all MIDI events
|
-- iterate over all MIDI events
|
||||||
for _, e in pairs (events) do
|
for _, e in pairs (events) do
|
||||||
-- e is-a http://manual.ardour.org/lua-scripting/class_reference/#Evoral:MidiEvent
|
-- e is-a http://manual.ardour.org/lua-scripting/class_reference/#Evoral:MidiEvent
|
||||||
|
|
||||||
-- do something with the event
|
-- do something with the event e.g.
|
||||||
--print (e:channel ())
|
print (e:channel (), e:time (), e:size (), e:buffer ():array ()[1], e:buffer ():get_table (e:size ())[1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue