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

整理音频文件目录(文件夹名都小写)
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)
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

View File

@@ -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

View File

@@ -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

View File

@@ -220,22 +220,22 @@ SKIN.init{
--Initialize sound libs
SFX.init((function()
local L={}
for _,v in next,fs.getDirectoryItems('media/SFX')do
if fs.getRealDirectory('media/SFX/'..v)~=SAVEDIR then
for _,v in next,fs.getDirectoryItems('media/effect/chiptune/')do
if fs.getRealDirectory('media/effect/chiptune/'..v)~=SAVEDIR then
table.insert(L,v:sub(1,-5))
else
MES.new('warn',"Dangerous file : %SAVE%/media/SFX/"..v)
MES.new('warn',"Dangerous file : %SAVE%/media/effect/chiptune/"..v)
end
end
return L
end)())
BGM.init((function()
local L={}
for _,v in next,fs.getDirectoryItems('media/BGM')do
if fs.getRealDirectory('media/BGM/'..v)~=SAVEDIR then
table.insert(L,{name=v:sub(1,-5),path='media/BGM/'..v})
for _,v in next,fs.getDirectoryItems('media/music')do
if fs.getRealDirectory('media/music/'..v)~=SAVEDIR then
table.insert(L,{name=v:sub(1,-5),path='media/music/'..v})
else
MES.new('warn',"Dangerous file : %SAVE%/media/BGM/"..v)
MES.new('warn',"Dangerous file : %SAVE%/media/music/"..v)
end
end
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
SETTING.frameMul=100
end
if SETTING.cv then
SETTING.vocPack,SETTING.cv=SETTING.cv
end
for _,v in next,VK_org do v.color=nil end
if RANKS.infinite then

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