添加音效包选择(暂无其他音效包)

整理音频文件目录(文件夹名都小写)
This commit is contained in:
MrZ626
2021-09-15 00:25:47 +08:00
parent 4be5933dc8
commit 9468c0435a
379 changed files with 72 additions and 57 deletions

View File

@@ -63,7 +63,7 @@ function BGM.init(list)
Sources[name]:setVolume(0) Sources[name]:setVolume(0)
return true return true
-- else -- else
-- MES.new('warn',"No BGM file: "..Sources[name],5) -- MES.new('warn',"[no BGM] "..Sources[name],5)
end end
elseif Sources[name]then elseif Sources[name]then
return true return true

View File

@@ -1,6 +1,6 @@
local SFX={ local SFX={
getCount=function()return 0 end, getCount=function()return 0 end,
loadAll=function()error("Cannot load before init!")end, load=function()error("Cannot load before init!")end,
fieldPlay=NULL, fieldPlay=NULL,
play=NULL, play=NULL,
fplay=NULL, fplay=NULL,
@@ -12,13 +12,13 @@ function SFX.init(list)
local Sources={} local Sources={}
local count=#list function SFX.getCount()return count end local count=#list function SFX.getCount()return count end
function SFX.loadAll() function SFX.load(path)
for i=1,count do for i=1,count do
local N='media/SFX/'..list[i]..'.ogg' local fullPath=path..list[i]..'.ogg'
if love.filesystem.getInfo(N)then if love.filesystem.getInfo(fullPath)then
Sources[list[i]]={love.audio.newSource(N,'static')} Sources[list[i]]={love.audio.newSource(fullPath,'static')}
else else
MES.new('warn',"No SFX file: "..N,.1) MES.new('warn',"[no SFX] "..list[i]..'.ogg',.1)
end end
end end

View File

@@ -1,7 +1,7 @@
local VOC={ local VOC={
getCount=function()return 0 end, getCount=function()return 0 end,
getQueueCount=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, getFreeChannel=NULL,
play=NULL, play=NULL,
update=NULL, update=NULL,
@@ -15,14 +15,15 @@ function VOC.init(list)
local Source={} local Source={}
local count=#list function VOC.getCount()return count end local count=#list function VOC.getCount()return count end
local function _loadVoiceFile(N,vocName) local function _loadVoiceFile(path,N,vocName)
local fileName='media/VOICE/'..SETTING.cv..'/'..vocName..'.ogg' local fullPath=path..vocName..'.ogg'
if love.filesystem.getInfo(fileName)then if love.filesystem.getInfo(fullPath)then
bank[vocName]={love.audio.newSource(fileName,'stream')} bank[vocName]={love.audio.newSource(fullPath,'stream')}
table.insert(Source[N],vocName) table.insert(Source[N],vocName)
return true return true
end end
end end
--Load voice with string
local function _getVoice(str) local function _getVoice(str)
local L=bank[str] local L=bank[str]
local n=1 local n=1
@@ -35,18 +36,17 @@ function VOC.init(list)
end end
end end
return L[n] return L[n]
--Load voice with string
end end
function VOC.loadAll() function VOC.load(path)
for i=1,count do for i=1,count do
Source[list[i]]={} Source[list[i]]={}
local n=0 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 if n==1 then
_loadVoiceFile(list[i],list[i]) _loadVoiceFile(path,list[i],list[i])
-- if not _loadVoiceFile(list[i],list[i])then MES.new('warn',"No VOICE file: "..list[i],.1)end -- if not _loadVoiceFile(path,list[i],list[i])then MES.new('warn',"[]no VOC] "..list[i],.1)end
end end
if not Source[list[i]][1]then if not Source[list[i]][1]then
Source[list[i]]=nil Source[list[i]]=nil

View File

@@ -220,22 +220,22 @@ SKIN.init{
--Initialize sound libs --Initialize sound libs
SFX.init((function() SFX.init((function()
local L={} local L={}
for _,v in next,fs.getDirectoryItems('media/SFX')do for _,v in next,fs.getDirectoryItems('media/effect/chiptune/')do
if fs.getRealDirectory('media/SFX/'..v)~=SAVEDIR then if fs.getRealDirectory('media/effect/chiptune/'..v)~=SAVEDIR then
table.insert(L,v:sub(1,-5)) table.insert(L,v:sub(1,-5))
else else
MES.new('warn',"Dangerous file : %SAVE%/media/SFX/"..v) MES.new('warn',"Dangerous file : %SAVE%/media/effect/chiptune/"..v)
end end
end end
return L return L
end)()) end)())
BGM.init((function() BGM.init((function()
local L={} local L={}
for _,v in next,fs.getDirectoryItems('media/BGM')do for _,v in next,fs.getDirectoryItems('media/music')do
if fs.getRealDirectory('media/BGM/'..v)~=SAVEDIR then if fs.getRealDirectory('media/music/'..v)~=SAVEDIR then
table.insert(L,{name=v:sub(1,-5),path='media/BGM/'..v}) table.insert(L,{name=v:sub(1,-5),path='media/music/'..v})
else else
MES.new('warn',"Dangerous file : %SAVE%/media/BGM/"..v) MES.new('warn',"Dangerous file : %SAVE%/media/music/"..v)
end end
end end
return L return L
@@ -383,6 +383,9 @@ do
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then
SETTING.frameMul=100 SETTING.frameMul=100
end end
if SETTING.cv then
SETTING.vocPack,SETTING.cv=SETTING.cv
end
for _,v in next,VK_org do v.color=nil end for _,v in next,VK_org do v.color=nil end
if RANKS.infinite then if RANKS.infinite then

Some files were not shown because too many files have changed in this diff Show More