4 category = "Example", -- "Utility"
6 author = "Ardour Lua Task Force",
7 description = [[An Example Midi Filter for prototyping.]]
10 function dsp_ioconfig ()
11 return { { midi_in = 1, midi_out = 1, audio_in = 0, audio_out = 0}, }
14 function dsp_run (_, _, n_samples)
15 assert (type(midiin) == "table")
16 assert (type(midiout) == "table")
19 function tx_midi (time, data)
21 midiout[cnt]["time"] = time;
22 midiout[cnt]["data"] = data;
26 -- for each incoming midi event
27 for _,b in pairs (midiin) do
28 local t = b["time"] -- t = [ 1 .. n_samples ]
29 local d = b["data"] -- get midi-event
31 if #d == 0 then event_type = -1 else event_type = d[1] >> 4 end
33 if (#d == 3 and event_type == 9) then -- note on
35 elseif (#d == 3 and event_type == 8) then -- note off