Module GameTypes :: Class KX_SoundActuator
[hide private]
[frames] | no frames]

Class KX_SoundActuator

source code

PyObjectPlus --+            
               |            
          CValue --+        
                   |        
     SCA_ILogicBrick --+    
                       |    
           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 [hide private]
    Play Methods
 
startSound()
Starts the sound.
source code
 
pauseSound()
Pauses the sound.
source code
 
stopSound()
Stops the sound.
source code
    Deprecated
 
setFilename(filename)
Sets the filename of the sound this actuator plays.
source code
string
getFilename()
Returns the filename of the sound this actuator plays.
source code
 
setGain(gain)
Sets the gain (volume) of the sound
source code
float
getGain()
Gets the gain (volume) of the sound.
source code
 
setPitch(pitch)
Sets the pitch of the sound.
source code
float
getPitch()
Returns the pitch of the sound.
source code
 
setRollOffFactor(rolloff)
Sets the rolloff factor for the sounds.
source code
float
getRollOffFactor()
Returns the rolloff factor for the sound.
source code
 
setLooping(loop)
Sets the loop mode of the actuator.
source code
integer
getLooping()
Returns the current loop mode of the actuator.
source code
 
setPosition(x, y, z)
Sets the position this sound will come from.
source code
 
setVelocity(vx, vy, vz)
Sets the velocity this sound is moving at.
source code
 
setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33)
Sets the orientation of the sound.
source code
 
setType(mode)
Sets the operation mode of the actuator.
source code
integer
getType()
Returns the operation mode of the actuator.
source code
    Inherited from SCA_ILogicBrick
integer
getExecutePriority()
Gets the execution priority of this logic brick.
source code
KX_GameObject
getOwner()
Gets the game object associated with this logic brick.
source code
 
setExecutePriority(priority)
Sets the priority of this logic brick.
source code
    Inherited from CValue
string
getName()
Returns the name of the CValue.
source code
    Inherited from PyObjectPlus
bool
isA(game_type)
Check if this is a type or a subtype game_type.
source code
Instance Variables [hide private]
string fileName
The filename of the sound this actuator plays.
integer looping
The loop mode of the actuator.
integer mode
The operation mode of the actuator.
3x3 matrix [[float]] orientation
The orientation of the sound.
float pitch
The pitch of the sound.
float array position
The position of the sound as a list: [x, y, z].
float rollOffFactor
The roll off factor.
float array velocity
The velocity of the emitter as a list: [x, y, z].
float volume
The volume (gain) of the sound.
    Inherited from SCA_ILogicBrick
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
string name
The name of this CValue derived object (read-only).
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only).
    Inherited from PyObjectPlus
bool invalid
Test if the object has been freed by the game engine and is no longer valid.
Method Details [hide private]

setFilename(filename)

source code 
Sets the filename of the sound this actuator plays.

Deprecated: Use the fileName attribute instead.

getFilename()

source code 
Returns the filename of the sound this actuator plays.
Returns: string

Deprecated: Use the fileName attribute instead.

setGain(gain)

source code 
Sets the gain (volume) of the sound
Parameters:
  • gain (float) - 0.0 (quiet) <= gain <= 1.0 (loud)

Deprecated: Use the volume attribute instead.

getGain()

source code 
Gets the gain (volume) of the sound.
Returns: float

Deprecated: Use the volume attribute instead.

setPitch(pitch)

source code 
Sets the pitch of the sound.

Deprecated: Use the pitch attribute instead.

getPitch()

source code 
Returns the pitch of the sound.
Returns: float

Deprecated: Use the pitch attribute instead.

setRollOffFactor(rolloff)

source code 

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.

Deprecated: Use the rollOffFactor attribute instead.

getRollOffFactor()

source code 
Returns the rolloff factor for the sound.
Returns: float

Deprecated: Use the rollOffFactor attribute instead.

setLooping(loop)

source code 
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!

Deprecated: Use the looping attribute instead.

getLooping()

source code 
Returns the current loop mode of the actuator.
Returns: integer

Deprecated: Use the looping attribute instead.

setPosition(x, y, z)

source code 
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.

Deprecated: Use the position attribute instead.

setVelocity(vx, vy, vz)

source code 

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.

Deprecated: Use the velocity attribute instead.

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

source code 

Sets the orientation of the sound.

The nine parameters specify a rotation matrix:
       | o11, o12, o13 |
       | o21, o22, o23 |
       | o31, o32, o33 |

Deprecated: Use the orientation attribute instead.

setType(mode)

source code 
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

Deprecated: Use the type attribute instead.

getType()

source code 
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

Deprecated: Use the type attribute instead.


Instance Variable Details [hide private]

mode

The operation mode of the actuator. You can use one of the following constants:
  • 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

orientation

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

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

velocity

The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
Type:
float array