AudioManager

from panda3d.core import AudioManager
class AudioManager

Bases:

Bases: TypedReferenceCount

Inheritance diagram

Inheritance diagram of AudioManager

enum SpeakerId
enumerator SPK_none = 0
enumerator SPK_frontleft = 1
enumerator SPK_frontright = 2
enumerator SPK_center = 3
enumerator SPK_sub = 4
enumerator SPK_backleft = 5
enumerator SPK_backright = 6
enumerator SPK_sideleft = 7
enumerator SPK_sideright = 8
enumerator SPK_COUNT = 9
enum SpeakerModeCategory
enumerator SPEAKERMODE_raw = 0

These enumerants line up one-to-one with the FMOD SPEAKERMODE enumerants.

enumerator SPEAKERMODE_mono = 1
enumerator SPEAKERMODE_stereo = 2
enumerator SPEAKERMODE_quad = 3
enumerator SPEAKERMODE_surround = 4
enumerator SPEAKERMODE_5point1 = 5
enumerator SPEAKERMODE_7point1 = 6
enumerator SPEAKERMODE_max = 7
enumerator SPEAKERMODE_COUNT = 8
enum StreamMode
enumerator SM_heuristic = 0
enumerator SM_sample = 1
enumerator SM_stream = 2
audio_3d_get_distance_factor() float
audio_3d_get_doppler_factor() float
audio_3d_get_drop_off_factor() float
audio_3d_set_distance_factor(factor: float)

Control the “relative scale that sets the distance factor” units for 3D spacialized audio. This is a float in units-per-meter. Default value is 1.0, which means that Panda units are understood as meters; for e.g. feet, set 3.28. This factor is applied only to Fmod and OpenAL at the moment.

audio_3d_set_doppler_factor(factor: float)

Control the presence of the Doppler effect. Default is 1.0 Exaggerated Doppler, use >1.0 Diminshed Doppler, use <1.0

audio_3d_set_drop_off_factor(factor: float)

Exaggerate or diminish the effect of distance on sound. Default is 1.0 Valid range is 0 to 10 Faster drop off, use >1.0 Slower drop off, use <1.0

audio_3d_set_listener_attributes(px: float, py: float, pz: float, vx: float, vy: float, vz: float, fx: float, fy: float, fz: float, ux: float, uy: float, uz: float)

This controls the “set of ears” that listens to 3D spacialized sound px, py, pz are position coordinates. vx, vy, vz are a velocity vector in UNITS PER SECOND (default: meters). fx, fy and fz are the respective components of a unit forward-vector ux, uy and uz are the respective components of a unit up-vector

clear_cache()
configure_filters(config: FilterProperties) bool
static create_AudioManager() AudioManager
property dls_pathname Filename
get_active() bool
get_cache_limit() int
static get_class_type() TypeHandle
get_concurrent_sound_limit() int
static get_dls_pathname() Filename
get_null_sound() AudioSound
get_sound(file_name: Filename, positional: bool, mode: int) AudioSound

Get a sound:

get_sound(source: MovieAudio, positional: bool, mode: int) AudioSound
get_speaker_setup() int
get_volume() float
is_valid() bool

If you’re interested in knowing whether this audio manager is valid, here’s the call to do it. It is not necessary to check whether the audio manager is valid before making other calls. You are free to use an invalid sound manager, you may get silent sounds from it though. The sound manager and the sounds it creates should not crash the application even when the objects are not valid.

output(out: ostream)
reduce_sounds_playing_to(count: int)

This is likely to be a utility function for the concurrent_sound_limit options. It is exposed as an API, because it’s reasonable that it may be useful to be here. It reduces the number of concurrently playing sounds to count by some implementation specific means. If the number of sounds currently playing is at or below count then there is no effect.

set_active(flag: bool)

Turn the manager on or off. If you play a sound while the manager is inactive, it won’t start. If you deactivate the manager while sounds are playing, they’ll stop. If you activate the manager while looping sounds are playing (those that have a loop_count of zero), they will start playing from the beginning of their loop. Defaults to true.

set_cache_limit(count: int)
set_concurrent_sound_limit(limit: int)

This controls the number of sounds that you allow at once. This is more of a user choice – it avoids talk over and the creation of a cacophony. It can also be used to help performance. 0 == unlimited. 1 == mutually exclusive (one sound at a time). Which is an example of: n == allow n sounds to be playing at the same time.

set_speaker_setup(cat: SpeakerModeCategory)
set_volume(volume: float)

Control volume: FYI: If you start a sound with the volume off and turn the volume up later, you’ll hear the sound playing at that late point. 0 = minimum; 1.0 = maximum. inits to 1.0.

shutdown()
stop_all_sounds()

Stop playback on all sounds managed by this manager. This is effectively the same as reduce_sounds_playing_to(0), but this call may be for efficient on some implementations.

uncache_sound(file_name: Filename)

Tell the AudioManager there is no need to keep this one cached. This doesn’t break any connection between AudioSounds that have already given by get_sound() from this manager. It’s only affecting whether the AudioManager keeps a copy of the sound in its poolcache.

update()

This should be called every frame. Failure to call could cause problems.

write(out: ostream)