summaryrefslogtreecommitdiff
path: root/scripts/_amp3.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-08-10 03:12:11 +0200
committerRobin Gareus <robin@gareus.org>2016-08-10 03:12:11 +0200
commita8143ea44e83a87fb6a9500d59409a14a94ad655 (patch)
tree3aac8610dc26fb63abd4cc1c7afe864714a2f408 /scripts/_amp3.lua
parent2b7a89ecffa92a616cd61774d42bea1e99db6f79 (diff)
prefix no-inst script with an underscore and skip install
Diffstat (limited to 'scripts/_amp3.lua')
-rw-r--r--scripts/_amp3.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/_amp3.lua b/scripts/_amp3.lua
new file mode 100644
index 0000000000..bb1a589b27
--- /dev/null
+++ b/scripts/_amp3.lua
@@ -0,0 +1,44 @@
+ardour {
+ ["type"] = "dsp",
+ name = "Simple Amp III",
+ category = "Example",
+ license = "MIT",
+ author = "Ardour Lua Task Force",
+ description = [[
+ An Example DSP Plugin for processing audio, to
+ be used with Ardour's Lua scripting facility.]]
+}
+
+function dsp_ioconfig ()
+ return
+ {
+ { audio_in = -1, audio_out = -1},
+ }
+end
+
+
+function dsp_params ()
+ return
+ {
+ { ["type"] = "input", name = "Gain", min = -20, max = 20, default = 6, unit="dB", scalepoints = { ["0"] = 0, ["twice as loud"] = 6 , ["half as loud"] = -6 } },
+ }
+end
+
+
+-- use ardour's vectorized functions
+--
+-- This is as efficient as Ardour doing it itself in C++
+-- Lua function overhead is negligible
+--
+-- this also exemplifies the /simpler/ way of delegating the
+-- channel-mapping to ardour.
+
+function dsp_run (ins, outs, n_samples)
+ local ctrl = CtrlPorts:array() -- get control port array (read/write)
+ local gain = ARDOUR.DSP.dB_to_coefficient (ctrl[1])
+ assert (#ins == #outs) -- ensure that we can run in-place (channel count matches)
+ for c = 1,#ins do
+ assert (ins[c]:sameinstance(outs[c])) -- check in-place
+ ARDOUR.DSP.apply_gain_to_buffer (ins[c], n_samples, gain); -- process in-place
+ end
+end