From 5218c104f9fd5feae59a4952639cc2ead1fa3bd4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 5 Aug 2020 20:28:14 +0200 Subject: [PATCH] Fix off by one (Lua arrays are 1-based) --- share/scripts/_dsp_plugin_communication.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/scripts/_dsp_plugin_communication.lua b/share/scripts/_dsp_plugin_communication.lua index e422e08cca..1118eeb626 100644 --- a/share/scripts/_dsp_plugin_communication.lua +++ b/share/scripts/_dsp_plugin_communication.lua @@ -65,14 +65,14 @@ function dsp_run (ins, outs, n_samples) local a = shmem:to_float (0):array () if s == 0 then -- the first plugin saves the peak - a[0] = peak + a[1] = peak ctrl[2] = -1 else -- all later plugins display the difference to the first. - if (a[0] == 0) then + if (a[1] == 0) then ctrl[2] = 1 else - ctrl[2] = peak / a[0] + ctrl[2] = peak / a[1] end end end