summaryrefslogtreecommitdiff
path: root/scripts/HiAndLowPass.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-07-18 10:53:40 +0200
committerRobin Gareus <robin@gareus.org>2016-07-18 10:53:48 +0200
commit7e1a722a15e02ef159b54bd294736f328d42ff29 (patch)
treee0e9b965942a01ebaa61dc7bcf579964145cdf26 /scripts/HiAndLowPass.lua
parent05ec8c46a7d85446333aa5a6e50401fb548f1de7 (diff)
clean up Hp/Lp code
Diffstat (limited to 'scripts/HiAndLowPass.lua')
-rw-r--r--scripts/HiAndLowPass.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/scripts/HiAndLowPass.lua b/scripts/HiAndLowPass.lua
index dae22a0083..f9e18f4912 100644
--- a/scripts/HiAndLowPass.lua
+++ b/scripts/HiAndLowPass.lua
@@ -4,7 +4,7 @@ ardour {
category = "Filter",
license = "GPLv2",
author = "Ardour Team",
- description = [[Example Ardour Lua DSP Plugin]]
+ description = [[High Low Pass filter with up to 48dB / octave]]
}
function dsp_ioconfig ()
@@ -49,7 +49,7 @@ end
local hp = {} -- the biquad high-pass filter instances (DSP)
local lp = {} -- the biquad high-pass filter instances (DSP)
local filt = nil -- the biquad filter instance (GUI, response)
-local cur = {0, 0, 0, 0, 0, 0, 0} -- current parameters
+local cur = {0, 0, 0, 0, 0, 0} -- current parameters
local lpf = 0.03 -- parameter low-pass filter time-constant
local chn = 0 -- channel/filter count
@@ -64,7 +64,7 @@ function dsp_init (rate)
tbl['samplerate'] = rate
self:table ():set (tbl)
- -- interpolation time constant, 64fpp
+ -- interpolation time constant, ~15Hz @ 64fpp
lpf = 5000 / rate
end
@@ -161,7 +161,6 @@ function dsp_run (ins, outs, n_samples)
for c = 1, #ins do
local xfade = cur[1] - ho
- assert (xfade >= 0 and xfade < 1)
ARDOUR.DSP.copy_vector (mem:to_float (off), ins[c]:offset (off), siz)
@@ -192,19 +191,18 @@ function dsp_run (ins, outs, n_samples)
-- low pass
xfade = cur[4] - lo
- assert (xfade >= 0 and xfade < 1)
-- copy output of high-pass into "processing memory"
ARDOUR.DSP.copy_vector (mem:to_float (off), outs[c]:offset (off), siz)
if cur[4] > 0 then
- -- clear output, Low-pass mixes interpolated data into output,
- -- in which case we just keep the output
+ -- Clear output, Low-pass mixes interpolated data into output.
+ -- (Except if the filter is disabled (0) in which case we just keep the output.)
ARDOUR.DSP.memset (outs[c]:offset (off), 0, siz)
end
for k = 1,4 do
- if xfade > 0 and k > lo and k <= lo + 1 then
+ if xfade > 0 and k == lo + 1 then
ARDOUR.DSP.mix_buffers_with_gain (outs[c]:offset (off), mem:to_float (off), siz, 1 - xfade)
end
@@ -212,7 +210,7 @@ function dsp_run (ins, outs, n_samples)
if k == lo and xfade == 0 then
ARDOUR.DSP.copy_vector (outs[c]:offset (off), mem:to_float (off), siz)
- elseif k > lo and k <= lo + 1 then
+ elseif k == lo + 1 then
ARDOUR.DSP.mix_buffers_with_gain (outs[c]:offset (off), mem:to_float (off), siz, xfade)
end
end