移除SFX和VOC模块的loadOne方法

This commit is contained in:
MrZ626
2021-07-21 04:40:20 +08:00
parent 3d128d4850
commit d5ab596749
2 changed files with 3 additions and 19 deletions

View File

@@ -1,6 +1,5 @@
local SFX={
getCount=function()return 0 end,
loadOne=function()error("Cannot load before init!")end,
loadAll=function()error("Cannot load before init!")end,
fieldPlay=NULL,
play=NULL,
@@ -13,7 +12,7 @@ function SFX.init(list)
local Sources={}
local count=#list function SFX.getCount()return count end
local function load(skip)
function SFX.loadAll()
for i=1,count do
local N='media/SFX/'..list[i]..'.ogg'
if love.filesystem.getInfo(N)then
@@ -21,11 +20,7 @@ function SFX.init(list)
else
MES.new('warn',"No SFX file: "..N,.1)
end
if not skip and i~=count then
coroutine.yield()
end
end
SFX.loadOne=nil
function SFX.play(s,vol,pos)
if SETTING.sfx==0 or vol==0 then return end
@@ -88,8 +83,5 @@ function SFX.init(list)
end
end
end
SFX.loadOne=coroutine.wrap(load)
function SFX.loadAll()load(true)end
end
return SFX

View File

@@ -1,7 +1,6 @@
local VOC={
getCount=function()return 0 end,
getQueueCount=function()return 0 end,
loadOne=function()error("Cannot load before init!")end,
loadAll=function()error("Cannot load before init!")end,
getFreeChannel=NULL,
play=NULL,
@@ -19,7 +18,7 @@ function VOC.init(list)
local function loadVoiceFile(N,vocName)
local fileName='media/VOICE/'..SETTING.cv..'/'..vocName..'.ogg'
if love.filesystem.getInfo(fileName)then
bank[vocName]={love.audio.newSource(fileName,'static')}
bank[vocName]={love.audio.newSource(fileName,'stream')}
table.insert(Source[N],vocName)
return true
end
@@ -38,7 +37,7 @@ function VOC.init(list)
return L[n]
--Load voice with string
end
local function load(skip)
function VOC.loadAll()
for i=1,count do
Source[list[i]]={}
@@ -51,11 +50,7 @@ function VOC.init(list)
end
end
if not Source[list[i]][1]then Source[list[i]]=nil end
if not skip and i~=count then
coroutine.yield()
end
end
VOC.loadOne=nil
function VOC.getQueueCount()
return #voiceQueue
@@ -119,8 +114,5 @@ function VOC.init(list)
end
end
end
VOC.loadOne=coroutine.wrap(load)
function VOC.loadAll()load(true)end
end
return VOC