From 503dfd69efb5337f3fb75d36274f134e77db9fdd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 15 Nov 2021 01:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E8=B0=83=E6=95=B4SFX.playSample?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E6=94=AF=E6=8C=81=E7=94=A8=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E4=BB=A3=E8=A1=A8=E7=BB=9D=E5=AF=B9=E9=9F=B3=E9=AB=98?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=98=AF=E7=A7=BB=E9=99=A4=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E9=9F=B3=E9=87=8F=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/sfx.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 20b7a71b..fd7e30dd 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -79,18 +79,18 @@ function SFX.setStereo(v) stereo=v end -function SFX.playSample(pack,...)--vol-2, sampSet1, vol-3, sampSet2, vol-1 +function SFX.playSample(pack,...)--vol-1, sampSet1, vol-2, sampSet2 if ... then local arg={...} local vol - if type(arg[#arg])=='number'then vol=rem(arg)end for i=1,#arg do - if type(arg[i])=='number'then - vol=arg[i] + local a=arg[i] + if type(a)=='number'and a<=1 then + vol=a else local base=packSetting[pack].base local top=packSetting[pack].top - local tune=_getTuneHeight(arg[i])--Absolute tune in number + local tune=type(a)=='string'and _getTuneHeight(a)or a--Absolute tune in number local playTune=tune+rnd(-2,2) if playTune<=base then--Too low notes playTune=base+1