summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/scripts/__readable.lua2
-rw-r--r--share/scripts/_find_nonzero_sample.lua4
-rw-r--r--share/scripts/s_region_gain.lua2
3 files changed, 4 insertions, 4 deletions
diff --git a/share/scripts/__readable.lua b/share/scripts/__readable.lua
index b9a991a782..3c918e0091 100644
--- a/share/scripts/__readable.lua
+++ b/share/scripts/__readable.lua
@@ -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
diff --git a/share/scripts/_find_nonzero_sample.lua b/share/scripts/_find_nonzero_sample.lua
index c23d2b0b4d..b79f832c9c 100644
--- a/share/scripts/_find_nonzero_sample.lua
+++ b/share/scripts/_find_nonzero_sample.lua
@@ -42,10 +42,10 @@ 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]) > 0 then
if (nonzeropos < 0 or pos + i < nonzeropos) then
- nonzeropos = pos + i
+ nonzeropos = pos + i - 1
end
break
end
diff --git a/share/scripts/s_region_gain.lua b/share/scripts/s_region_gain.lua
index 648e76629c..87a1760b0f 100644
--- a/share/scripts/s_region_gain.lua
+++ b/share/scripts/s_region_gain.lua
@@ -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