添加音效包选择(暂无其他音效包)
整理音频文件目录(文件夹名都小写)
This commit is contained in:
@@ -63,7 +63,7 @@ function BGM.init(list)
|
||||
Sources[name]:setVolume(0)
|
||||
return true
|
||||
-- else
|
||||
-- MES.new('warn',"No BGM file: "..Sources[name],5)
|
||||
-- MES.new('warn',"[no BGM] "..Sources[name],5)
|
||||
end
|
||||
elseif Sources[name]then
|
||||
return true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local SFX={
|
||||
getCount=function()return 0 end,
|
||||
loadAll=function()error("Cannot load before init!")end,
|
||||
load=function()error("Cannot load before init!")end,
|
||||
fieldPlay=NULL,
|
||||
play=NULL,
|
||||
fplay=NULL,
|
||||
@@ -12,13 +12,13 @@ function SFX.init(list)
|
||||
local Sources={}
|
||||
|
||||
local count=#list function SFX.getCount()return count end
|
||||
function SFX.loadAll()
|
||||
function SFX.load(path)
|
||||
for i=1,count do
|
||||
local N='media/SFX/'..list[i]..'.ogg'
|
||||
if love.filesystem.getInfo(N)then
|
||||
Sources[list[i]]={love.audio.newSource(N,'static')}
|
||||
local fullPath=path..list[i]..'.ogg'
|
||||
if love.filesystem.getInfo(fullPath)then
|
||||
Sources[list[i]]={love.audio.newSource(fullPath,'static')}
|
||||
else
|
||||
MES.new('warn',"No SFX file: "..N,.1)
|
||||
MES.new('warn',"[no SFX] "..list[i]..'.ogg',.1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local VOC={
|
||||
getCount=function()return 0 end,
|
||||
getQueueCount=function()return 0 end,
|
||||
loadAll=function()error("Cannot load before init!")end,
|
||||
load=function()error("Cannot load before init!")end,
|
||||
getFreeChannel=NULL,
|
||||
play=NULL,
|
||||
update=NULL,
|
||||
@@ -15,14 +15,15 @@ function VOC.init(list)
|
||||
local Source={}
|
||||
|
||||
local count=#list function VOC.getCount()return count end
|
||||
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,'stream')}
|
||||
local function _loadVoiceFile(path,N,vocName)
|
||||
local fullPath=path..vocName..'.ogg'
|
||||
if love.filesystem.getInfo(fullPath)then
|
||||
bank[vocName]={love.audio.newSource(fullPath,'stream')}
|
||||
table.insert(Source[N],vocName)
|
||||
return true
|
||||
end
|
||||
end
|
||||
--Load voice with string
|
||||
local function _getVoice(str)
|
||||
local L=bank[str]
|
||||
local n=1
|
||||
@@ -35,18 +36,17 @@ function VOC.init(list)
|
||||
end
|
||||
end
|
||||
return L[n]
|
||||
--Load voice with string
|
||||
end
|
||||
function VOC.loadAll()
|
||||
function VOC.load(path)
|
||||
for i=1,count do
|
||||
Source[list[i]]={}
|
||||
|
||||
local n=0
|
||||
repeat n=n+1 until not _loadVoiceFile(list[i],list[i]..'_'..n)
|
||||
repeat n=n+1 until not _loadVoiceFile(path,list[i],list[i]..'_'..n)
|
||||
|
||||
if n==1 then
|
||||
_loadVoiceFile(list[i],list[i])
|
||||
-- if not _loadVoiceFile(list[i],list[i])then MES.new('warn',"No VOICE file: "..list[i],.1)end
|
||||
_loadVoiceFile(path,list[i],list[i])
|
||||
-- if not _loadVoiceFile(path,list[i],list[i])then MES.new('warn',"[]no VOC] "..list[i],.1)end
|
||||
end
|
||||
if not Source[list[i]][1]then
|
||||
Source[list[i]]=nil
|
||||
|
||||
Reference in New Issue
Block a user