2 # Documentation for KX_SoundActuator
3 from SCA_IActuator import *
5 class KX_SoundActuator(SCA_IActuator):
9 The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
10 the actuator to be activated - they act instantly.
12 @ivar filename: Sets the filename of the sound this actuator plays.
13 @type filename: string
15 @ivar volume: Sets the volume (gain) of the sound.
18 @ivar pitch: Sets the pitch of the sound.
21 @ivar rollOffFactor: Sets the roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
22 @type rollOffFactor: float
24 @ivar looping: Sets the loop mode of the actuator.
25 @type looping: integer
27 @ivar position: Sets the position of the sound.
28 @type position: float array
30 @ivar velocity: Sets the speed of the sound; The speed of the sound alter the pitch.
31 @type velocity: float array
33 @ivar orientation: Sets the orientation of the sound. When setting the orientation you can
34 also use quaternion [float,float,float,float] or euler angles [float,float,float]
35 @type orientation: 3x3 matrix [[float]]
37 @ivar type: Sets the operation mode of the actuator. You can use one of the following constant:
38 KX_SOUNDACT_PLAYSTOP (1)
39 KX_SOUNDACT_PLAYEND (2)
40 KX_SOUNDACT_LOOPSTOP (3)
41 KX_SOUNDACT_LOOPEND (4)
42 KX_SOUNDACT_LOOPBIDIRECTIONAL (5)
43 KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6)
46 @group Play Methods: startSound, pauseSound, stopSound.
48 def setFilename(filename):
50 DEPRECATED: Use the filename property instead.
51 Sets the filename of the sound this actuator plays.
53 @type filename: string
57 DEPRECATED: Use the filename property instead.
58 Returns the filename of the sound this actuator plays.
76 DEPRECATED: Use the volume property instead
77 Sets the gain (volume) of the sound
80 @param gain: 0.0 (quiet) <= gain <= 1.0 (loud)
84 DEPRECATED: Use the volume property instead.
85 Gets the gain (volume) of the sound.
91 DEPRECATED: Use the pitch property instead.
92 Sets the pitch of the sound.
98 DEPRECATED: Use the pitch property instead.
99 Returns the pitch of the sound.
103 def setRollOffFactor(rolloff):
105 DEPRECATED: Use the rollOffFactor property instead.
106 Sets the rolloff factor for the sounds.
108 Rolloff defines the rate of attenuation as the sound gets further away.
109 Higher rolloff factors shorten the distance at which the sound can be heard.
113 def getRollOffFactor():
115 DEPRECATED: Use the rollOffFactor property instead.
116 Returns the rolloff factor for the sound.
120 def setLooping(loop):
122 DEPRECATED: Use the looping property instead.
123 Sets the loop mode of the actuator.
125 @bug: There are no constants defined for this method!
126 @param loop: - Play Stop 1
136 DEPRECATED: Use the looping property instead.
137 Returns the current loop mode of the actuator.
141 def setPosition(x, y, z):
143 DEPRECATED: Use the position property instead.
144 Sets the position this sound will come from.
147 @param x: The x coordinate of the sound.
149 @param y: The y coordinate of the sound.
151 @param z: The z coordinate of the sound.
153 def setVelocity(vx, vy, vz):
155 DEPRECATED: Use the velocity property instead.
156 Sets the velocity this sound is moving at.
158 The sound's pitch is determined from the velocity.
161 @param vx: The vx coordinate of the sound.
163 @param vy: The vy coordinate of the sound.
165 @param vz: The vz coordinate of the sound.
167 def setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33):
169 DEPRECATED: Use the orientation property instead.
170 Sets the orientation of the sound.
172 The nine parameters specify a rotation matrix::
180 DEPRECATED: Use the type property instead.
181 Sets the operation mode of the actuator.
183 @param mode: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
189 DEPRECATED: Use the type property instead.
190 Returns the operation mode of the actuator.
193 @return: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP