AudioSound

from panda3d.core import AudioSound
class AudioSound

Bases:

Bases: TypedReferenceCount

Inheritance diagram

Inheritance diagram of AudioSound

enum SoundStatus
enumerator BAD = 0
enumerator READY = 1
enumerator PLAYING = 2
configureFilters(config: FilterProperties) bool
get3dMaxDistance() float
get3dMinDistance() float
getActive() bool
getBalance() float
static getClassType() TypeHandle
getFinishedEvent() str
getLoop() bool
getLoopCount() int
getName() str

There is no set_name(), this is intentional.

getPlayRate() float
getPriority() int
getSpeakerLevel(index: int) float
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.

getTime() float
getVolume() float
length() float

return: playing time in seconds.

output(out: ostream)
play()

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

setActive(flag: bool)

inits to manager’s state.

setBalance(balance_right: float)

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.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.

setLoop(loop: bool)

loop: false = play once; true = play forever. inits to false.

setLoopCount(loop_count: int)

loop_count: 0 = forever; 1 = play once; n = play n times. inits to 1.

setPlayRate(play_rate: float)

play_rate is any positive PN_stdfloat value. inits to 1.0.

setPriority(priority: int)
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 length() method.

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();
setVolume(volume: float)

0 = minimum; 1.0 = maximum. inits to 1.0.

status() SoundStatus
stop()
write(out: ostream)