update MIDIEvent lua bindings/example
authorRobin Gareus <robin@gareus.org>
Mon, 11 Jul 2016 23:46:17 +0000 (01:46 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 11 Jul 2016 23:46:58 +0000 (01:46 +0200)
libs/ardour/luabindings.cc
scripts/rawmidi.lua

index 5174078cc133fcef95566e86f939f2249a07c21d..93012bf82e0b7977c4c55ed2848d93379f8d64ab 100644 (file)
@@ -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")
index 9791fcbe957e7f87e036b3a7df9643ac2bd38cc6..76fd491a041a9fcf8b317e6fcd052e4c32aaf429 100644 (file)
@@ -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