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.
This commit is contained in:
Matthias Richter 2012-01-30 12:09:12 +01:00
parent 18df87baf6
commit bb0eaeb0e2

View File

@ -97,7 +97,7 @@ function Source:removeTags(tag, ...)
end end
function Source:isStatic() function Source:isStatic()
return how ~= "stream" return self.how ~= "stream"
end end
-- getter/setter for looping, pitch and volume -- getter/setter for looping, pitch and volume
@ -128,6 +128,9 @@ function love.audio.newSource(what, how)
pitch = 1, pitch = 1,
volume = 1, volume = 1,
} }
if how == 'static' and type(what) == 'string' then
s.what = love.sound.newSoundData(what)
end
love.audio.tags.all[s] = s love.audio.tags.all[s] = s
return setmetatable(s, Source) return setmetatable(s, Source)
end end