Fix off by one in Lua scripts
Lua arrays (tables) start counting at one. Also `for i = a, b do .. end` is inclusive: a <= i <= b
This commit is contained in:
@@ -29,7 +29,7 @@ function factory () return function ()
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#C:FloatArray
|
||||
local d = cmem:to_float (0):array()
|
||||
-- iterate over the audio sample data
|
||||
for i = 0, s do
|
||||
for i = 1, s do
|
||||
if math.abs (d[i]) > peak then
|
||||
peak = math.abs (d[i])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user