13
0

Fix off by one (Lua arrays are 1-based)

This commit is contained in:
Robin Gareus 2020-08-05 20:28:14 +02:00
parent 73165aae95
commit 5218c104f9
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -65,14 +65,14 @@ function dsp_run (ins, outs, n_samples)
local a = shmem:to_float (0):array () local a = shmem:to_float (0):array ()
if s == 0 then if s == 0 then
-- the first plugin saves the peak -- the first plugin saves the peak
a[0] = peak a[1] = peak
ctrl[2] = -1 ctrl[2] = -1
else else
-- all later plugins display the difference to the first. -- all later plugins display the difference to the first.
if (a[0] == 0) then if (a[1] == 0) then
ctrl[2] = 1 ctrl[2] = 1
else else
ctrl[2] = peak / a[0] ctrl[2] = peak / a[1]
end end
end end
end end