provide some Keyboard:: methods to get access to other versions of modifier names
[ardour.git] / scripts / amp3.lua
1 ardour {
2         ["type"]    = "dsp",
3         name        = "Simple Amp III",
4         category    = "Amplifier",
5         license     = "MIT",
6         author      = "Robin Gareus",
7         email       = "robin@gareus.org",
8         site        = "http://gareus.org",
9         description = [[
10         An Example DSP Plugin for processing audio, to
11         be used with Ardour's Lua scripting facility.]]
12 }
13
14 function dsp_ioconfig ()
15         return
16         {
17                 { audio_in = -1, audio_out = -1},
18         }
19 end
20
21
22 function dsp_params ()
23         return
24         {
25                 { ["type"] = "input", name = "Gain", min = -20, max = 20, default = 6, unit="dB", scalepoints = { ["0"] = 0, ["twice as loud"] = 6 , ["half as loud"] = -6 } },
26         }
27 end
28
29
30 -- use ardour's vectorized functions
31 --
32 -- This is as efficient as Ardour doing it itself in C++
33 -- Lua function overhead is negligible
34 --
35 -- this also exemplifies the /simpler/ way of delegating the
36 -- channel-mapping to ardour.
37
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)
42         for c = 1,#ins do
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
45         end
46 end