filters[c][k] = ARDOUR.DSP.Biquad (rate) -- initialize filters
end
end
+ cur = {0, 0, 0, 0}
end
-- helper functions for parameter interpolation
function param_changed (ctrl)
- if ctrl[1] == cur[1] and ctrl[2] == cur[2] and ctrl[3] == cur[3] and ctrl[4] == cur[4] then
+ if math.floor(ctrl[1]) == math.floor(cur[1]) and math.floor(ctrl[2]) == math.floor(cur[2]) and ctrl[3] == cur[3] and ctrl[4] == cur[4] then
return false
end
return true
siz = 64
end
- local o = cur[2]
+ local o = math.floor(cur[2])
while n_samples > 0 do
if changed then apply_params (CtrlPorts:array ()) end
for c = 1,#ins do
-- check if output and input buffers for this channel are identical
-- http://manual.ardour.org/lua-scripting/class_reference/#C:FloatArray
- if false then --- ins[c]:sameinstance (outs[c]) then
- for k = 1,o do
- filters[c][k]:run (ins[c]:offset (off), siz) -- in-place processing
- end
- else
+ if not ins[c]:sameinstance (outs[c]) then
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:DSP
ARDOUR.DSP.copy_vector (outs[c]:offset (off), ins[c]:offset (off), siz)
- for k = 1,o do
- filters[c][k]:run (outs[c]:offset (off), siz)
- end
+ end
+ for k = 1,o do
+ filters[c][k]:run (outs[c]:offset (off), siz) -- in-place processing
end
end
grid_freq (ctx, w, h, 10000)
ctx:unset_dash ()
- local o = cur[2]
+ local o = math.floor(cur[2])
-- draw transfer function line
ctx:set_source_rgba (.8, .8, .8, 1.0)
ctx:move_to (-.5, db_to_y (o * filt:dB_at_freq (freq_at_x (0, w)), h))