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
property active bool

inits to manager’s state.

inits to manager’s state.

property balance float

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0.

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0.

configure_filters(config: FilterProperties) bool
get_3d_max_distance() float
get_3d_min_distance() float
get_active() bool
get_balance() float
static get_class_type() TypeHandle
get_finished_event() str
get_loop() bool
get_loop_count() int
get_loop_start() float
get_name() str

There is no set_name(), this is intentional.

get_play_rate() float
get_priority() int
get_speaker_mix(speaker: int) float

speaker_mix is for use with FMOD.

get_time() float
get_volume() float
is_positional() bool

Returns true if this was created as a positional sound.

length() float

return: playing time in seconds.

property name string

There is no set_name(), this is intentional.

There is no set_name(), this is intentional.

There is no set_name(), this is intentional.

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).

property play_rate float

play_rate is any positive PN_stdfloat value. inits to 1.0.

play_rate is any positive PN_stdfloat value. inits to 1.0.

property positional bool

Returns true if this was created as a positional sound.

set_3d_attributes(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).

set_3d_max_distance(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

set_3d_min_distance(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

set_active(flag: bool)

inits to manager’s state.

set_balance(balance_right: float)

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0.

set_finished_event(event: str)

Set (or clear) the event that will be thrown when the sound finishes playing. To clear the event, pass an empty string.

set_loop(loop: bool)

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

set_loop_count(loop_count: int)

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

set_loop_start(loop_start: float)

loop_start: 0 = beginning. expressed in seconds. inits to 0.

set_play_rate(play_rate: float)

play_rate is any positive PN_stdfloat value. inits to 1.0.

set_priority(priority: int)
set_speaker_mix(frontleft: float, frontright: float, center: float, sub: float, backleft: float, backright: float, sideleft: float, sideright: float)
set_time(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.

In the past, this call did nothing if the sound was currently playing, and it was necessary to call play() to effect the change. This is no longer the case; the time change takes effect immediately.

If a sound is playing, calling get_time() repeatedly will return different results over time. e.g.

PN_stdfloat percent_complete = s.get_time() / s.length();
set_volume(volume: float)

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

status() SoundStatus
stop()
property 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.

In the past, this call did nothing if the sound was currently playing, and it was necessary to call play() to effect the change. This is no longer the case; the time change takes effect immediately.

If a sound is playing, calling get_time() repeatedly will return different results over time. e.g.

PN_stdfloat percent_complete = s.get_time() / s.length();

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.

In the past, this call did nothing if the sound was currently playing, and it was necessary to call play() to effect the change. This is no longer the case; the time change takes effect immediately.

If a sound is playing, calling get_time() repeatedly will return different results over time. e.g.

PN_stdfloat percent_complete = s.get_time() / s.length();
property volume float

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

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

write(out: ostream)