修复bgm资源管理问题导致的一些音频bug close #557
This commit is contained in:
@@ -72,10 +72,11 @@ end
|
|||||||
local function task_fadeOut(src)
|
local function task_fadeOut(src)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
|
if tostring(src):find('NULL')then return end
|
||||||
local v=src:getVolume()-.025*volume
|
local v=src:getVolume()-.025*volume
|
||||||
src:setVolume(v>0 and v or 0)
|
src:setVolume(v>0 and v or 0)
|
||||||
if v<=0 then
|
if v<=0 then
|
||||||
src:pause()
|
src:stop()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -143,7 +144,6 @@ function BGM.play(name,args)
|
|||||||
end
|
end
|
||||||
SourceObjList[name].source:setLooping(not args:sArg('-noloop'))
|
SourceObjList[name].source:setLooping(not args:sArg('-noloop'))
|
||||||
BGM.lastPlayed=BGM.nowPlay
|
BGM.lastPlayed=BGM.nowPlay
|
||||||
BGM.playing:seek(0)
|
|
||||||
BGM.playing:play()
|
BGM.playing:play()
|
||||||
BGM.onChange(name)
|
BGM.onChange(name)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user