Sound Actuator Loop Bidirectional: distance_reference

distance_reference
  • gets/sets the distance you have to be for sound to be at maximum volume.
  • Sound Actuator name:  Reference Distance

Type: 
  • float number

Range:

  • 0.00 to 10,000.00
Loop Bidirectional:
  • Plays the sound file from start to finish.  Then finish to start.  Over and over.
  • Positive Pulse:  Starts playing the sound file from the beginning.
  • Negative pulse:  Keeps playing the sound file until it reaches the end, then stops playing.
Sample Code


################  get the distance for maximum volume

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# get the distance for maximum volume
max = act.distance_reference
 
Sample Code


################  set the distance for maximum volume

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# set the distance for maximum volume
act.distance_reference = 1.0