From 9d8fc0559a78ef880955b3220c7b41ea309f3575 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Mon, 29 Jul 2024 02:27:47 +0800 Subject: [PATCH] =?UTF-8?q?fmod=E6=A8=A1=E5=9D=97=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E6=8F=90=E7=A4=BA=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E9=9F=B3=E4=B9=90/=E9=9F=B3=E6=95=88=EF=BC=8C=E6=AF=8F?= =?UTF-8?q?=E7=A7=8D=E5=90=8D=E7=A7=B0=E7=9A=84=E5=8F=AA=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/fmod20221/init.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/assets/fmod20221/init.lua b/assets/fmod20221/init.lua index 92ba596e..681f1ff3 100644 --- a/assets/fmod20221/init.lua +++ b/assets/fmod20221/init.lua @@ -16,7 +16,7 @@ M.banks={} -- M.C2=ffi.load(fmodstudioPath) do -- Load library - local suc,res + local suc suc,M.C=pcall(ffi.load,'fmod') if not suc then MSG.new('error',"Loading FMOD lib:"..M.C) @@ -175,6 +175,8 @@ function M.music.getDesc(name) return musicLib[name] end +local unhintedBGM={} + ---@param name string ---@param args? {instant?:boolean, volume?:number, pitch?:number, tune?:number, fine?:number, pos?:number[], param?:table} ---@return FMOD.Studio.EventInstance? @@ -183,7 +185,10 @@ function M.music.play(name,args) FMOD.music.stop() local desc=musicLib[name] if not desc then - MSG.new('warn',"No BGM named "..name) + if not unhintedBGM[name] then + unhintedBGM[name]=true + MSG.new('warn',"No BGM named "..name) + end return end local event,res=desc:createInstance() @@ -308,6 +313,8 @@ function M.effect.getDesc(name) return effectLib[name] end +local unhintedSFX={} + ---priority: pitch>tune>fine --- ---pos:{x,y,z} @@ -320,7 +327,10 @@ function M.effect.play(name,args) if not studio then return end local desc=effectLib[name] if not desc then - MSG.new('warn',"No SE named "..name) + if not unhintedSFX[name] then + unhintedSFX[name]=true + MSG.new('warn',"No SE named "..name) + end return end local event,res=desc:createInstance()