mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
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:
parent
82541b33a4
commit
1a69bc4a96
3 changed files with 4 additions and 4 deletions
|
|
@ -41,7 +41,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue