3 name = "Simple Amp III",
4 category = "Amplifier",
6 author = "Robin Gareus",
7 email = "robin@gareus.org",
8 site = "http://gareus.org",
10 An Example DSP Plugin for processing audio, to
11 be used with Ardour's Lua scripting facility.]]
14 function dsp_ioconfig ()
17 { audio_in = -1, audio_out = -1},
22 function dsp_params ()
25 { ["type"] = "input", name = "Gain", min = -20, max = 20, default = 6, unit="dB", scalepoints = { ["0"] = 0, ["twice as loud"] = 6 , ["half as loud"] = -6 } },
30 -- use ardour's vectorized functions
32 -- This is as efficient as Ardour doing it itself in C++
33 -- Lua function overhead is negligible
35 -- this also exemplifies the /simpler/ way of delegating the
36 -- channel-mapping to ardour.
38 function dsp_run (ins, outs, n_samples)
39 local ctrl = CtrlPorts:array() -- get control port array (read/write)
40 local gain = ARDOUR.DSP.dB_to_coefficient (ctrl[1])
41 assert (#ins == #outs) -- ensure that we can run in-place (channel count matches)
43 assert (ins[c]:sameinstance(outs[c])) -- check in-place
44 ARDOUR.DSP.apply_gain_to_buffer (ins[c], n_samples, gain); -- process in-place