Skip to content

Commit

Permalink
fmod模块添加两个play函数的快捷方式
Browse files Browse the repository at this point in the history
修复应用音频高级设置时重启音频系统后音量设置没有应用
  • Loading branch information
MrZ626 committed Apr 20, 2024
1 parent c16db0a commit 032043f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions assets/fmod20221/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ end

--------------------------

---@type table|fun(name:string, args:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
M.music={}

---@param v number
Expand Down Expand Up @@ -210,8 +211,12 @@ function M.music.getPlaying()
return playing.event
end

local playMusic=M.music.play
setmetatable(M.music,{__call=function(_,...) playMusic(...) end})

--------------------------

---@type table|fun(name:string, args:{instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:table<number,number>, param?:table}):FMOD.Studio.EventInstance?
M.effect={}

---@param v number
Expand Down Expand Up @@ -309,6 +314,9 @@ function M.effect.stop(name,instant)
end
end

local playEffect=M.effect.play
setmetatable(M.effect,{__call=function(_,...) playEffect(...) end})

--------------------------

M.vocal={}
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/setting_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ scene.widgetList={
{name='2',type='slider', pos={0,0},x=340, y=800,w=650, fontSize=30,text=LANG'setting_fmod_DSPBufferLength', widthLimit=260, axis={3,16,1},valueShow=function(S) return 2^S.disp() end, disp=function() return MATH.roundLog(SETTINGS.system.fmod_DSPBufferLength,2) end, code=function(v) SETTINGS.system.fmod_DSPBufferLength=2^v end},
{name='2',type='button', pos={0,0},x=400, y=870,w=140, h=60,fontSize=30,text=LANG'setting_apply', code=function()
FMODLoadFunc()
debug.setupvalue(getBgm,1,nil)
FMOD.setMainVolume(SETTINGS.system.mainVol,true)
stopBgm()
PROGRESS.playExteriorBGM()
FMOD.effect.play('beep_notice')
end},

-- Video
Expand Down

0 comments on commit 032043f

Please sign in to comment.