Sound Actuator Loop Bidirectional: sound

sound
  • get/set the sound the actuator should play.

Return Type: 
  • Audaspace factory
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 sound

# 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 Audaspace Factory type
AFType = act.sound
 
Sample Code



################  Set the sound

# import bge module
import bge

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

# get the 1st sound actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# get sound 1st actuator
sound_1 = act.sound

# get the 2nd actuator attached to the controller
# my actuator is named Song_2

act2 = cont.actuators["Song_2"]

# set 2nd actuator to play sound from 1st actuator
act2.sound = sound_1