Module KX_SoundActuator :: Class KX_SoundActuator

Class KX_SoundActuator

SCA_ILogicBrick.SCA_ILogicBrick --+    
                                  |    
        SCA_IActuator.SCA_IActuator --+
                                      |
                                     KX_SoundActuator

Sound Actuator.

The startSound(), pauseSound() and stopSound() do not require the actuator to be activated - they act instantly provided that the actuator has been activated once at least.

Instance Methods
 
setFilename(filename)
DEPRECATED: Use the filename property instead.
string
getFilename()
DEPRECATED: Use the filename property instead.
 
setGain(gain)
DEPRECATED: Use the volume property instead Sets the gain (volume) of the sound
float
getGain()
DEPRECATED: Use the volume property instead.
 
setPitch(pitch)
DEPRECATED: Use the pitch property instead.
float
getPitch()
DEPRECATED: Use the pitch property instead.
 
setRollOffFactor(rolloff)
DEPRECATED: Use the rollOffFactor property instead.
float
getRollOffFactor()
DEPRECATED: Use the rollOffFactor property instead.
 
setLooping(loop)
DEPRECATED: Use the looping property instead.
integer
getLooping()
DEPRECATED: Use the looping property instead.
 
setPosition(x, y, z)
DEPRECATED: Use the position property instead.
 
setVelocity(vx, vy, vz)
DEPRECATED: Use the velocity property instead.
 
setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33)
DEPRECATED: Use the orientation property instead.
 
setType(mode)
DEPRECATED: Use the type property instead.
integer
getType()
DEPRECATED: Use the type property instead.
integer
getExecutePriority()
Gets the execution priority of this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
KX_GameObject
getOwner()
Gets the game object associated with this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
 
setExecutePriority(priority)
Sets the priority of this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
    Play Methods
 
startSound()
Starts the sound.
 
pauseSound()
Pauses the sound.
 
stopSound()
Stops the sound.
Instance Variables
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
string filename
Sets the filename of the sound this actuator plays.
integer looping
Sets the loop mode of the actuator.
3x3 matrix [[float]] orientation
Sets the orientation of the sound.
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read only). (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
float pitch
Sets the pitch of the sound.
float array position
Sets the position of the sound.
float rollOffFactor
Sets the roll off factor.
integer type
Sets the operation mode of the actuator.
float array velocity
Sets the speed of the sound; The speed of the sound alter the pitch.
float volume
Sets the volume (gain) of the sound.
Method Details

setFilename(filename)

 

DEPRECATED: Use the filename property instead. Sets the filename of the sound this actuator plays.

Parameters:
  • filename (string)

getFilename()

 

DEPRECATED: Use the filename property instead. Returns the filename of the sound this actuator plays.

Returns: string

setGain(gain)

 

DEPRECATED: Use the volume property instead Sets the gain (volume) of the sound

Parameters:
  • gain (float) - 0.0 (quiet) <= gain <= 1.0 (loud)

getGain()

 

DEPRECATED: Use the volume property instead. Gets the gain (volume) of the sound.

Returns: float

setPitch(pitch)

 

DEPRECATED: Use the pitch property instead. Sets the pitch of the sound.

Parameters:
  • pitch (float)

getPitch()

 

DEPRECATED: Use the pitch property instead. Returns the pitch of the sound.

Returns: float

setRollOffFactor(rolloff)

 

DEPRECATED: Use the rollOffFactor property instead. Sets the rolloff factor for the sounds.

Rolloff defines the rate of attenuation as the sound gets further away. Higher rolloff factors shorten the distance at which the sound can be heard.

Parameters:
  • rolloff (float)

getRollOffFactor()

 

DEPRECATED: Use the rollOffFactor property instead. Returns the rolloff factor for the sound.

Returns: float

setLooping(loop)

 

DEPRECATED: Use the looping property instead. Sets the loop mode of the actuator.

Parameters:
  • loop (integer) - - Play Stop 1
    • Play End 2
    • Loop Stop 3
    • Loop End 4
    • Bidirection Stop 5
    • Bidirection End 6

Bug: There are no constants defined for this method!

getLooping()

 

DEPRECATED: Use the looping property instead. Returns the current loop mode of the actuator.

Returns: integer

setPosition(x, y, z)

 

DEPRECATED: Use the position property instead. Sets the position this sound will come from.

Parameters:
  • x (float) - The x coordinate of the sound.
  • y (float) - The y coordinate of the sound.
  • z (float) - The z coordinate of the sound.

setVelocity(vx, vy, vz)

 

DEPRECATED: Use the velocity property instead. Sets the velocity this sound is moving at.

The sound's pitch is determined from the velocity.

Parameters:
  • vx (float) - The vx coordinate of the sound.
  • vy (float) - The vy coordinate of the sound.
  • vz (float) - The vz coordinate of the sound.

setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33)

 

DEPRECATED: Use the orientation property instead. Sets the orientation of the sound.

The nine parameters specify a rotation matrix:

       | o11, o12, o13 |
       | o21, o22, o23 |
       | o31, o32, o33 |

setType(mode)

 

DEPRECATED: Use the type property instead. Sets the operation mode of the actuator.

Parameters:
  • mode (integer) - KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP

getType()

 

DEPRECATED: Use the type property instead. Returns the operation mode of the actuator.

Returns: integer
KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP

Instance Variable Details

orientation

Sets the orientation of the sound. When setting the orientation you can also use quaternion [float,float,float,float] or euler angles [float,float,float]
Type:
3x3 matrix [[float]]

rollOffFactor

Sets the roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
Type:
float

type

Sets the operation mode of the actuator. You can use one of the following constant:
  • KX_SOUNDACT_PLAYSTOP (1)
  • KX_SOUNDACT_PLAYEND (2)
  • KX_SOUNDACT_LOOPSTOP (3)
  • KX_SOUNDACT_LOOPEND (4)
  • KX_SOUNDACT_LOOPBIDIRECTIONAL (5)
  • KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6)
Type:
integer