From e2b4a78b59836bd866bed2f64bb5998e39aee66c Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 10 Nov 2021 21:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B6=85=E9=9F=B3=E6=BA=90?= =?UTF-8?q?=E9=9F=B3=E5=9F=9F=E9=9F=B3=E7=AC=A6=E5=A4=84=E7=90=86=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/sfx.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 168b3231..b1a1b5d0 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -88,19 +88,16 @@ function SFX.playSample(pack,...)--vol-2, sampSet1, vol-3, sampSet2, vol-1 if type(arg[i])=='number'then vol=arg[i] else - local tune=arg[i] - local r=rnd(-1,1) - tune=_getTuneHeight(tune)-r local base=packSetting[pack].base local top=packSetting[pack].top - if tunetop then - r=(tune+r)-top - tune=top + local tune=_getTuneHeight(arg[i])--Absolute tune in number + local playTune=tune+rnd(-2,2) + if playTunetop then--Too high notes + playTune=top end - SFX.play(pack..tune-base,vol,nil,r) + SFX.play(pack..playTune-base,vol,nil,tune-playTune) end end end