From f10ef4f3da18eac3dede12ec897c594131cc6d21 Mon Sep 17 00:00:00 2001 From: Iliyas Jorio Date: Thu, 21 Aug 2014 19:09:48 +0200 Subject: [PATCH] Fixed extra iteration in various for loops --- sfxr.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sfxr.lua b/sfxr.lua index c655ac2..d409ba6 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -185,11 +185,11 @@ function sfxr.Sound:generate(freq, bits) local noisebuffer = {} -- Reset the sample buffers - for i=1, 1025 do + for i=1, 1024 do phaserbuffer[i] = 0 end - for i=1, 33 do + for i=1, 32 do noisebuffer[i] = random(-1, 1) end @@ -336,7 +336,7 @@ function sfxr.Sound:generate(freq, bits) -- And finally the actual tone generation and supersampling local ssample = 0 - for si = 0, self.supersamples do + for si = 0, self.supersamples-1 do local sample = 0 phase = phase + 1 @@ -346,7 +346,7 @@ function sfxr.Sound:generate(freq, bits) --phase = 0 phase = phase % period if self.wavetype == sfxr.NOISE then - for i = 1, 33 do + for i = 1, 32 do noisebuffer[i] = random(-1, 1) end end