summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-07-12 01:46:17 +0200
committerRobin Gareus <robin@gareus.org>2016-07-12 01:46:58 +0200
commite8cd2949bdec2e81187d74232193eb920c918459 (patch)
treeafac2e45da72fb6a182004c07c05a56afe7f320f
parent3ab200acaabddd38ee12a45a906f497e2df54173 (diff)
update MIDIEvent lua bindings/example
-rw-r--r--libs/ardour/luabindings.cc1
-rw-r--r--scripts/rawmidi.lua6
2 files changed, 4 insertions, 3 deletions
diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc
index 5174078cc1..93012bf82e 100644
--- a/libs/ardour/luabindings.cc
+++ b/libs/ardour/luabindings.cc
@@ -1303,6 +1303,7 @@ LuaBindings::dsp (lua_State* L)
.addFunction ("size", &Evoral::Event<framepos_t>::size)
.addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_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 ()
.beginClass <Evoral::Beats> ("Beats")
diff --git a/scripts/rawmidi.lua b/scripts/rawmidi.lua
index 9791fcbe95..76fd491a04 100644
--- a/scripts/rawmidi.lua
+++ b/scripts/rawmidi.lua
@@ -31,14 +31,14 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
if ib ~= ARDOUR.ChanMapping.Invalid then
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:MidiBuffer
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
for _, e in pairs (events) do
-- e is-a http://manual.ardour.org/lua-scripting/class_reference/#Evoral:MidiEvent
- -- do something with the event
- --print (e:channel ())
+ -- do something with the event e.g.
+ print (e:channel (), e:time (), e:size (), e:buffer ():array ()[1], e:buffer ():get_table (e:size ())[1])
end
end