2004-06-02 12:43:27 +00:00
|
|
|
# $Id$
|
|
|
|
# Documentation for KX_SoundActuator
|
|
|
|
from SCA_IActuator import *
|
|
|
|
|
|
|
|
class KX_SoundActuator(SCA_IActuator):
|
|
|
|
"""
|
|
|
|
Sound Actuator.
|
|
|
|
|
|
|
|
The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
|
2009-04-20 15:06:46 +00:00
|
|
|
the actuator to be activated - they act instantly provided that the actuator has
|
|
|
|
been activated once at least.
|
|
|
|
|
|
|
|
@ivar filename: Sets the filename of the sound this actuator plays.
|
|
|
|
@type filename: string
|
|
|
|
|
|
|
|
@ivar volume: Sets the volume (gain) of the sound.
|
|
|
|
@type volume: float
|
|
|
|
|
|
|
|
@ivar pitch: Sets the pitch of the sound.
|
|
|
|
@type pitch: float
|
|
|
|
|
|
|
|
@ivar rollOffFactor: Sets the roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
|
|
|
|
@type rollOffFactor: float
|
|
|
|
|
|
|
|
@ivar looping: Sets the loop mode of the actuator.
|
|
|
|
@type looping: integer
|
|
|
|
|
|
|
|
@ivar position: Sets the position of the sound.
|
|
|
|
@type position: float array
|
|
|
|
|
|
|
|
@ivar velocity: Sets the speed of the sound; The speed of the sound alter the pitch.
|
|
|
|
@type velocity: float array
|
|
|
|
|
|
|
|
@ivar 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 orientation: 3x3 matrix [[float]]
|
|
|
|
|
|
|
|
@ivar 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 type: integer
|
2004-06-02 12:43:27 +00:00
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
@group Play Methods: startSound, pauseSound, stopSound.
|
2004-06-02 12:43:27 +00:00
|
|
|
"""
|
|
|
|
def setFilename(filename):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the filename property instead.
|
|
|
|
Sets the filename of the sound this actuator plays.
|
2004-06-02 12:43:27 +00:00
|
|
|
|
|
|
|
@type filename: string
|
|
|
|
"""
|
|
|
|
def getFilename():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the filename property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Returns the filename of the sound this actuator plays.
|
|
|
|
|
|
|
|
@rtype: string
|
|
|
|
"""
|
|
|
|
def startSound():
|
|
|
|
"""
|
|
|
|
Starts the sound.
|
|
|
|
"""
|
|
|
|
def pauseSound():
|
|
|
|
"""
|
|
|
|
Pauses the sound.
|
|
|
|
"""
|
|
|
|
def stopSound():
|
|
|
|
"""
|
|
|
|
Stops the sound.
|
|
|
|
"""
|
|
|
|
def setGain(gain):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the volume property instead
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the gain (volume) of the sound
|
|
|
|
|
|
|
|
@type gain: float
|
|
|
|
@param gain: 0.0 (quiet) <= gain <= 1.0 (loud)
|
|
|
|
"""
|
|
|
|
def getGain():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the volume property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Gets the gain (volume) of the sound.
|
|
|
|
|
|
|
|
@rtype: float
|
|
|
|
"""
|
|
|
|
def setPitch(pitch):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the pitch property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the pitch of the sound.
|
|
|
|
|
|
|
|
@type pitch: float
|
|
|
|
"""
|
|
|
|
def getPitch():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the pitch property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Returns the pitch of the sound.
|
|
|
|
|
|
|
|
@rtype: float
|
|
|
|
"""
|
|
|
|
def setRollOffFactor(rolloff):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the rollOffFactor property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
@type rolloff: float
|
|
|
|
"""
|
|
|
|
def getRollOffFactor():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the rollOffFactor property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Returns the rolloff factor for the sound.
|
|
|
|
|
|
|
|
@rtype: float
|
|
|
|
"""
|
|
|
|
def setLooping(loop):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the looping property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the loop mode of the actuator.
|
|
|
|
|
|
|
|
@bug: There are no constants defined for this method!
|
|
|
|
@param loop: - Play Stop 1
|
|
|
|
- Play End 2
|
|
|
|
- Loop Stop 3
|
|
|
|
- Loop End 4
|
|
|
|
- Bidirection Stop 5
|
|
|
|
- Bidirection End 6
|
|
|
|
@type loop: integer
|
|
|
|
"""
|
|
|
|
def getLooping():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the looping property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Returns the current loop mode of the actuator.
|
|
|
|
|
|
|
|
@rtype: integer
|
|
|
|
"""
|
|
|
|
def setPosition(x, y, z):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the position property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the position this sound will come from.
|
|
|
|
|
|
|
|
@type x: float
|
|
|
|
@param x: The x coordinate of the sound.
|
|
|
|
@type y: float
|
|
|
|
@param y: The y coordinate of the sound.
|
|
|
|
@type z: float
|
|
|
|
@param z: The z coordinate of the sound.
|
|
|
|
"""
|
|
|
|
def setVelocity(vx, vy, vz):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the velocity property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the velocity this sound is moving at.
|
|
|
|
|
|
|
|
The sound's pitch is determined from the velocity.
|
|
|
|
|
|
|
|
@type vx: float
|
|
|
|
@param vx: The vx coordinate of the sound.
|
|
|
|
@type vy: float
|
|
|
|
@param vy: The vy coordinate of the sound.
|
|
|
|
@type vz: float
|
|
|
|
@param vz: The vz coordinate of the sound.
|
|
|
|
"""
|
|
|
|
def setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the orientation property instead.
|
2004-06-02 12:43:27 +00:00
|
|
|
Sets the orientation of the sound.
|
|
|
|
|
|
|
|
The nine parameters specify a rotation matrix::
|
|
|
|
| o11, o12, o13 |
|
|
|
|
| o21, o22, o23 |
|
|
|
|
| o31, o32, o33 |
|
|
|
|
"""
|
2004-07-17 05:28:23 +00:00
|
|
|
|
|
|
|
def setType(mode):
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the type property instead.
|
2004-07-17 05:28:23 +00:00
|
|
|
Sets the operation mode of the actuator.
|
|
|
|
|
|
|
|
@param mode: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
|
|
|
|
@type mode: integer
|
|
|
|
"""
|
|
|
|
|
|
|
|
def getType():
|
|
|
|
"""
|
2009-04-20 15:06:46 +00:00
|
|
|
DEPRECATED: Use the type property instead.
|
2004-07-17 05:28:23 +00:00
|
|
|
Returns the operation mode of the actuator.
|
|
|
|
|
|
|
|
@rtype: integer
|
|
|
|
@return: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
|
|
|
|
"""
|