播放立体声音效限制输入值范围

This commit is contained in:
MrZ626
2021-12-23 13:19:01 +08:00
parent 200d270fee
commit 46d95b33e4

View File

@@ -1,5 +1,6 @@
local type,rem=type,table.remove
local int,rnd=math.floor,math.random
local interval=MATH.interval
local sfxList={}
local packSetting={}
@@ -140,7 +141,7 @@ local function _play(name,vol,pos,pitch)
S=S[n]--AU_SRC
if S:getChannelCount()==1 then
if pos then
pos=pos*stereo
pos=interval(pos,-1,1)*stereo
S:setPosition(pos,1-pos^2,0)
else
S:setPosition(0,0,0)