13
0

Optimize ACE-Hi/Lo pass filter automation performance a bit

This commit is contained in:
Robin Gareus 2022-04-02 19:19:38 +02:00
parent a946046532
commit 4f43d5d024
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -174,10 +174,15 @@ function apply_params (ctrl)
cur[6] = low_pass_filter_param (cur[6], ctrl[6], 0.01) -- LP quality cur[6] = low_pass_filter_param (cur[6], ctrl[6], 0.01) -- LP quality
cur[7] = ctrl[7] cur[7] = ctrl[7]
hp[1][1]:compute (ARDOUR.DSP.BiquadType.HighPass, cur[2], cur[3], 0)
lp[1][1]:compute (ARDOUR.DSP.BiquadType.LowPass, cur[5], cur[6], 0)
for c = 1, chn do for c = 1, chn do
for k = 1,4 do for k = 1,4 do
hp[c][k]:compute (ARDOUR.DSP.BiquadType.HighPass, cur[2], cur[3], 0) if not (k == 1 and c == 1) then
lp[c][k]:compute (ARDOUR.DSP.BiquadType.LowPass, cur[5], cur[6], 0) hp[c][k]:configure (hp[1][1])
lp[c][k]:configure (hp[1][1])
end
end end
end end
end end
@ -189,15 +194,16 @@ function dsp_run (ins, outs, n_samples)
assert (#ins == chn) assert (#ins == chn)
local ctrl = santize_params (CtrlPorts:array ()) local ctrl = santize_params (CtrlPorts:array ())
local changed = false local redraw = false
local siz = n_samples local siz = n_samples
local off = 0 local off = 0
-- if a parameter was changed, process at most lpf_chunk samples -- if a parameter was changed, process at most lpf_chunk samples
-- at a time and interpolate parameters until the current settings -- at a time and interpolate parameters until the current settings
-- match the target values -- match the target values
if param_changed (ctrl) then local changed = param_changed (ctrl)
changed = true if changed then
redraw = true
siz = lpf_chunk siz = lpf_chunk
end end
@ -214,7 +220,14 @@ function dsp_run (ins, outs, n_samples)
-- process all channels -- process all channels
while n_samples > 0 do while n_samples > 0 do
if changed then apply_params (ctrl) end if changed then
apply_params (ctrl)
changed = param_changed (ctrl)
if not changed then
siz = n_samples
end
end
if siz > n_samples then siz = n_samples end if siz > n_samples then siz = n_samples end
local ho = math.floor(cur[1]) local ho = math.floor(cur[1])
@ -283,7 +296,7 @@ function dsp_run (ins, outs, n_samples)
off = off + siz off = off + siz
end end
if changed then if redraw then
-- notify display -- notify display
self:queue_draw () self:queue_draw ()
end end