From bb0eaeb0e21ae68f417060530846ddaaa89e9656 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 30 Jan 2012 12:09:12 +0100 Subject: [PATCH] Fix Source:isStatic(). Load SoundData only once. Source:isStatic() was missing `self.' Static sources now load the SoundData only once, unless the `what' argument is a decoder. --- slam/slam.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slam/slam.lua b/slam/slam.lua index fbe947b..7d91fab 100644 --- a/slam/slam.lua +++ b/slam/slam.lua @@ -97,7 +97,7 @@ function Source:removeTags(tag, ...) end function Source:isStatic() - return how ~= "stream" + return self.how ~= "stream" end -- getter/setter for looping, pitch and volume @@ -128,6 +128,9 @@ function love.audio.newSource(what, how) pitch = 1, volume = 1, } + if how == 'static' and type(what) == 'string' then + s.what = love.sound.newSoundData(what) + end love.audio.tags.all[s] = s return setmetatable(s, Source) end