From 5828ed7d09f7c049b53646daf56133ef7d03482f Mon Sep 17 00:00:00 2001 From: Dima Pulkinen Date: Sun, 10 Nov 2024 19:15:20 +0200 Subject: [PATCH] optimize iterating over samples a little bit --- sfxr.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfxr.lua b/sfxr.lua index d594dbc..4de8216 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -870,8 +870,8 @@ function sfxr.Sound:generateSoundData(rate, depth, sounddata) local data = sounddata or love.sound.newSoundData(count, freq, bits, 1) - for i = 0, #tab - 1 do - data:setSample(i, tab[i + 1]) + for i = 1, count do + data:setSample(i - 1, tab[i]) end return data, count