mirror of
https://github.com/nucular/sfxrlua.git
synced 2024-12-24 18:44:20 +00:00
Fixed extra iteration in various for loops
This commit is contained in:
parent
6379b1e7f9
commit
f10ef4f3da
8
sfxr.lua
8
sfxr.lua
@ -185,11 +185,11 @@ function sfxr.Sound:generate(freq, bits)
|
|||||||
local noisebuffer = {}
|
local noisebuffer = {}
|
||||||
|
|
||||||
-- Reset the sample buffers
|
-- Reset the sample buffers
|
||||||
for i=1, 1025 do
|
for i=1, 1024 do
|
||||||
phaserbuffer[i] = 0
|
phaserbuffer[i] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1, 33 do
|
for i=1, 32 do
|
||||||
noisebuffer[i] = random(-1, 1)
|
noisebuffer[i] = random(-1, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ function sfxr.Sound:generate(freq, bits)
|
|||||||
-- And finally the actual tone generation and supersampling
|
-- And finally the actual tone generation and supersampling
|
||||||
|
|
||||||
local ssample = 0
|
local ssample = 0
|
||||||
for si = 0, self.supersamples do
|
for si = 0, self.supersamples-1 do
|
||||||
local sample = 0
|
local sample = 0
|
||||||
|
|
||||||
phase = phase + 1
|
phase = phase + 1
|
||||||
@ -346,7 +346,7 @@ function sfxr.Sound:generate(freq, bits)
|
|||||||
--phase = 0
|
--phase = 0
|
||||||
phase = phase % period
|
phase = phase % period
|
||||||
if self.wavetype == sfxr.NOISE then
|
if self.wavetype == sfxr.NOISE then
|
||||||
for i = 1, 33 do
|
for i = 1, 32 do
|
||||||
noisebuffer[i] = random(-1, 1)
|
noisebuffer[i] = random(-1, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user