3 name = "Simple Amp III",
5 author = "Robin Gareus",
6 email = "robin@gareus.org",
7 site = "http://gareus.org",
9 An Example DSP Plugin for processing audio, to
10 be used with Ardour's Lua scripting facility.]]
13 function dsp_ioconfig ()
16 { audio_in = -1, audio_out = -1},
21 function dsp_params ()
24 { ["type"] = "input", name = "Gain", min = -20, max = 20, default = 6, unit="dB", scalepoints = { ["0"] = 0, ["twice as loud"] = 6 , ["half as loud"] = -6 } },
29 -- use ardour's vectorized functions
31 -- This is as efficient as Ardour doing it itself in C++
32 -- Lua function overhead is negligible
34 -- this also exemplifies the /simpler/ way of letting ardour to
35 -- the channel and offset mapping.
37 function dsp_run (ins, outs, n_samples)
38 local ctrl = CtrlPorts:array() -- get control port array (read/write)
39 local gain = ARDOUR.DSP.dB_to_coefficient (ctrl[1])
40 assert (#ins == #outs) -- ensure that we can run in-place
42 --for c in pairs (ins) do -- also works, slightly less effective
43 ARDOUR.DSP.apply_gain_to_buffer (ins[c], n_samples, gain); -- process in-place