From 09e552bdd5ce8a5466870eaad0c2f83e9b6babaa Mon Sep 17 00:00:00 2001 From: nucular Date: Wed, 7 May 2014 20:00:45 +0200 Subject: [PATCH] But apparently it's faster this way :O --- sfxr.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sfxr.lua b/sfxr.lua index 6cd20fc..c7c35e3 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -390,12 +390,12 @@ function sfxr.Sound:generateTable() end function sfxr.Sound:generateSoundData(freq, bits) - local data = love.sound.newSoundData(self:getLimit() + 1, freq, bits, 1) + local tab = self:generateTable() - local i = 0 - for v in self:generate() do - data:setSample(i, v) - i = i + 1 + local data = love.sound.newSoundData(#tab, freq, bits, 1) + + for i = 0, #tab - 1 do + data:setSample(i, tab[i + 1]) end return data