from panda3d.core import AudioSound
- class AudioSound¶
- getSpeakerMix(speaker: int) float ¶
speaker_mix and speaker_level(s) serve the same purpose. speaker_mix is for use with FMOD. speaker_level(s) is for use with Miles. Both interfaces exist because of a significant difference in the two APIs. Hopefully the difference can be reconciled into a single interface at some point.
For best compatibility, set the loop_count, volume, and balance, prior to calling play(). You may set them while they’re playing, but it’s implementation specific whether you get the results. - Calling play() a second time on the same sound before it is finished will start the sound again (creating a skipping or stuttering effect).
- set3dAttributes(px: float, py: float, pz: float, vx: float, vy: float, vz: float)¶
Controls the position of this sound’s emitter. px, py and pz are the emitter’s position. vx, vy and vz are the emitter’s velocity in UNITS PER SECOND (default: meters).
- set3dMaxDistance(dist: float)¶
Controls the maximum distance (in units) that this sound stops falling off. The sound does not stop at that point, it just doesn’t get any quieter. You should rarely need to adjust this. Default is 1000000000.0
- set3dMinDistance(dist: float)¶
Controls the distance (in units) that this sound begins to fall off. Also affects the rate it falls off. Default is 1.0 CloserFaster, <1.0 FartherSlower, >1.0
- setFinishedEvent(event: str)¶
Set (or clear) the event that will be thrown when the sound finishes playing. To clear the event, pass an empty string.
- setLoopCount(loop_count: int)¶
loop_count: 0 = forever; 1 = play once; n = play n times. inits to 1.
- setSpeakerLevels(level1: float, level2: float, level3: float, level4: float, level5: float, level6: float, level7: float, level8: float, level9: float)¶
- setSpeakerMix(frontleft: float, frontright: float, center: float, sub: float, backleft: float, backright: float, sideleft: float, sideright: float)¶
- setTime(start_time: float)¶
Control time position within the sound, in seconds. This is similar (in concept) to the seek position within a file. The value starts at 0.0 (the default) and ends at the value given by the
The current time position will not change while the sound is playing; you must call
play()again to effect the change. To play the same sound from a time offset a second time, explicitly set the time position again. When looping, the second and later loops will start from the beginning of the sound.
If a sound is playing, calling
getTime()repeatedly will return different results over time. e.g.
PN_stdfloat percent_complete = s.get_time() / s.length();
- status() SoundStatus ¶