3 name = "MIDI Generator II",
6 author = "Ardour Lua Task Force",
7 description = [[An Example Midi Generator for prototyping.]]
10 function dsp_ioconfig ()
11 return { { midi_in = 1, midi_out = 1, audio_in = -1, audio_out = -1}, }
14 function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
15 local ob = out_map:get (ARDOUR.DataType ("midi"), 0)
16 if ob ~= ARDOUR.ChanMapping.Invalid then
17 local mb = bufs:get_midi (ob)
19 -- see _midigenerator.lua for
20 -- how to use a timed sequence
22 local ba = C.ByteVector () -- construct a byte vector
23 ba:add ({0x90, 64, 127}) -- add some data to the vector
24 -- send a message at cycle-start
25 mb:push_back (offset, ba:size (), ba:to_array());
28 ba:add ({0x80, 64, 127})
29 mb:push_back (n_samples - 1 - offset, ba:size (), ba:to_array());
32 -- passthrough audio, apply pin/channel mapping
33 ARDOUR.DSP.process_map (bufs, in_map, out_map, n_samples, offset, ARDOUR.DataType ("audio"))