mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
api to change cutoff
This commit is contained in:
parent
5856cda6de
commit
a34532500e
@ -10,17 +10,21 @@ class SfxPlayer:
|
|||||||
UseInverseSquare = 0
|
UseInverseSquare = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Distance at which sounds can no longer be heard
|
|
||||||
# This was determined experimentally
|
|
||||||
self.cutoffDistance = 120.0
|
|
||||||
|
|
||||||
# cutoff for inverse square attenuation
|
|
||||||
if SfxPlayer.UseInverseSquare:
|
|
||||||
self.cutoffDistance = 300.0
|
|
||||||
# volume attenuates according to the inverse square of the
|
# volume attenuates according to the inverse square of the
|
||||||
# distance from the source. volume = 1/(distance^2)
|
# distance from the source. volume = 1/(distance^2)
|
||||||
# this is the volume at which a sound is nearly inaudible
|
# this is the volume at which a sound is nearly inaudible
|
||||||
self.cutoffVolume = .02
|
self.cutoffVolume = .02
|
||||||
|
|
||||||
|
# cutoff for inverse square attenuation
|
||||||
|
if SfxPlayer.UseInverseSquare:
|
||||||
|
self.setCutoffDistance(300.0)
|
||||||
|
else:
|
||||||
|
# Distance at which sounds can no longer be heard
|
||||||
|
# This was determined experimentally
|
||||||
|
self.setCutoffDistance(120.0)
|
||||||
|
|
||||||
|
def setCutoffDistance(self, d):
|
||||||
|
self.cutoffDistance = d
|
||||||
# this is the 'raw' distance at which the volume of a sound will
|
# this is the 'raw' distance at which the volume of a sound will
|
||||||
# be equal to the cutoff volume
|
# be equal to the cutoff volume
|
||||||
rawCutoffDistance = math.sqrt(1./self.cutoffVolume)
|
rawCutoffDistance = math.sqrt(1./self.cutoffVolume)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user